当前位置:网站首页>C multithreading learning note 1

C multithreading learning note 1

2022-06-10 13:58:00 HollowKnightZ

Thread space overhead

Thread Data structure of

Thread Kernel data structure, which has osid( Threads ID),context( Context )=> CPU Some variables of the register ( Time slice , A time slice 30ms)
 Insert picture description here

User mode stack

A thread assignment 1M Of stack space to store some 【 Parameter or local variable 】

Kernel mode stack

stay CLR Thread operation of , Include thread synchronization , Most of them call the underlying win32 function , The user mode stack needs to be passed to the kernel mode

Thread time overhead

The process will load a lot when it starts dll、exe、 resources 、 Metadata

When the process starts , There are three application domains by default :System Domain、Shared Domain、Domain 1. To start a thread, Destroy one thread Will notify those in progress dll、attach、detach Sign a . notice dll My destination is to thread Do the preparatory work , Compare destroy , Let these dll Do resource cleanup .

Time slice switching

With a 12 A processor computer ,12 Logical processors are available for 12 Threads executing concurrently ,13 When threads execute concurrently, there must be one thread Sleep 30ms

原网站

版权声明
本文为[HollowKnightZ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101342364352.html