当前位置:网站首页>2020-11-06:go中,谈一下调度器。
2020-11-06:go中,谈一下调度器。
2020-11-06 22:43:00 【福大大架构师每日一题】
福哥答案2020-11-06:
·MPG模型:goroutine的并发模型可以归纳为MPG模型;
·MPG概念:线程(machine,系统线程,物理线程)-内核(processor)-协程(goroutine,用户线程,逻辑线程);
·多对多调度模型:整体调度遵循多对多模型,多个协程(约百万级)同时调度在多个线程(约千级)下;
·LRQ(LocalRunningQueue):本地运行队列,一个M执行在一个P的上下文中,P中挂载着一个G队列;
·GRQ(GlobalRunningQueue):全局运行队列,G没有初始化时或者没有LRQ可供挂载时就被丢入GRQ;
·GRQ=>LRQ:MP会在LRQ执行完毕检查GRQ,并从中窃取任务挂载到当前LRQ中执行,平时也会定期检查;
·调度的目的:调度的目的是防止线程堵塞、闲置、被OS挂起(syscall);
·防止线程M堵塞:G1协程IO时脱离MP,G2从当前MP的LRQ中弹出并执行;
·防止线程M闲置:M1闲置时,会从M2的LRQ中窃取一半任务,挂载到自己的LRQ中执行;
·防止线程M被OS挂起(syscall):P带着LRQ挂到其它线程的下面执行,当syscall结束时,M会尝试将G0挂载到其它LRQ中或GRQ中;
详细go调度器模型参考:
Go语言中文网:https://studygolang.com/articles/9610
简书:https://www.jianshu.com/p/f9024e250ac6
版权声明
本文为[福大大架构师每日一题]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4553401/blog/4706933
边栏推荐
- Utility class functions (continuous update)
- image operating system windows cannot be used on this platform
- 心理咨询app开发所具备的优点与功能
- How does LeadTools detect, read and write barcodes
- Two dimensional code location and alarm system of Expressway
- 非易失性MRAM存储器应用于各级高速缓存
- Es create a new index database and copy the old index library, practice pro test effective!
- August 14, 2020: what are the execution engines for data tasks?
- 实验一
- LEADTOOLS如何检测,读取和写入条形码
猜你喜欢

#JVM 类加载机制

How to add modules to nginx image?

1万辆!理想汽车召回全部缺陷车:已发生事故97起,亏损将扩大

非易失性MRAM存储器应用于各级高速缓存

Experiment one

迅为iMX6开发板-设备树内核-menuconfig的使用

List to map (split the list according to the key, and the value of the same key is a list)

Characteristics of magnetic memory chip STT-MRAM

Mobile pixel adaptation scheme

In 2020, how can wechat seal numbers be quickly lifted?
随机推荐
如何使用甘特图图层和筛选器
About Devops seven misunderstandings, 99% of people have been hit!
非易失性MRAM存储器应用于各级高速缓存
.NETCore3.1+Vue.js打造的低代码工作流引擎
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
August 30, 2020: naked write algorithm: the nearest common ancestor of two nodes in a binary tree.
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
Mobile pixel adaptation scheme
条形码识别器Dynamsoft Barcode Reader v7.5全新上线!
The first choice for lightweight GPU applications is the NVIDIA vgpu instance launched by Jingdong Zhilian cloud
JS string - string string object method
Using JSON webtoken (JWT) to generate token in nodejs
STM32F030C6T6兼容替换MM32SPIN05PF
南京标识标牌设计制作,导视VI系统设计
JS array the usage of array is all here (array method reconstruction, array traversal, array de duplication, array judgment and conversion)
20个XR项目路演,近20个资本机构出席!诚邀您参加2020 Qualcomm XR生态合作伙伴大会
Interviewer: how about shardingsphere
Stm32f030f4p6 compatible with smart micro mm32f031f4p6
Es create a new index database and copy the old index library, practice pro test effective!
jenkins pipline stage 设置超时