当前位置:网站首页>User level threads and kernel level threads
User level threads and kernel level threads
2022-06-29 09:39:00 【KingOfMyHeart】
Threading model
One to one thread model

Many to one threading model

N Yes M Thread model of

There are two ways to implement threads
User-level threads
Implement thread instances in user mode , Use one TCB(Thread Control Block) To describe a user thread , The TCB Stored in user mode .
- The kernel can't see the user level thread , For the kernel , You can only see the current process , Threads created in the current process cannot be scheduled by the operating system ;
- User level thread creation , The destruction , And switching is extremely fast , There is no need to switch back and forth between user mode and kernel mode ;
- When a user thread blocks or gets stuck in the kernel , Now the whole process will be blocked , Other user threads will not be able to use ( Consider using asynchronous invocation to mitigate );
- All user threads in the process need to actively give up CPU, Otherwise, it will CPU The time slice is gone , Because for the kernel , You can only see the process , Only time slices can be assigned to the current process ;
- Each process can customize the thread scheduling algorithm .
User level threads are implemented by thread libraries in some applications .
Kernel level threads
Implement thread instances in kernel mode , Use one TCB(Thread Control Block) To describe a user thread , The TCB Stored in kernel mode , The kernel can directly perform scheduling management .
- Thread creation , The overhead of termination and switching is large , It is all done by the kernel ;
- The kernel is aware of threads , Managed by the operating system , Scheduled by the operating system ;
- The allocation of kernel time slice is based on threads , The kernel allocates an entire slice of time to threads .
coroutines
coroutines = User-level threads + Scheduler
边栏推荐
猜你喜欢

Laravel 8 enables the order table to be divided by month level

LC236. 二叉树的最近公共祖先

Instance error iopub data rate exceeded

pytorch总结学习系列-数据操作

UE4 installs the datasmith plug-in in version 4.20-23

The principle of session and cookie

Wechat applet project: tab navigation bar

UE4 材质UV纹理不随模型缩放拉伸

基于keil5自动配置stm32f103标准库的官网freertos移植

Yolo nano: a highly compact one look convolutional neural network for target detection
随机推荐
云管理平台:OpenStack架构设计及详细解读
长安链数据存储介绍及Mysql存储环境搭建
UE4 材质UV纹理不随模型缩放拉伸
easyexecl导出100万行execl报字体错误的解决办法
UE4 去掉材质中Mask透明白边
Pytorch summary learning series - operation
Pytorch Summary - Automatic gradient
Mysql database and table splitting strategy and application scenarios
Visual assist plug-in settings for UE4 vs
你必须知道的23个最有用的Elasticseaerch检索技巧
数据可视化:数据可视化四象限,教你正确应用图标
LC236. 二叉树的最近公共祖先
UE4 在4.20-23版本安装Datasmith插件
UE4 插件报错 Cannot open include file: ‘ModuleManager.h‘解决
Print service IP setting scheme
UE4 编译单个文件(VS与编辑器分别启动)
数据治理:数据治理在数据中台下的解决方案
长安链GO语言智能合约编写与编译
1424. 对角线遍历 II
Simplicity studio does not recognize the new JLINK V9 solution