Below is not a simple transcript of the report from the CLRium workshop , but a revised version for the book .NET Platform Architecture . That part of it that relates to flows.
Threads and thread planning
What is a stream? Let's give a brief definition. At its core, a stream is:
, .NET β - . .NET - Windows. .NET Windows ( Windows thread id , ). , -.NET .NET, : , , . volatile, Interlocked SpinWait. lock
. .
. β . ? , β , . . .
β . : . - .. .
" ?", β , β " "Intel Xeon 8 16 ". - β β . 8 . Hyper-Threading, ( ). , . , , , , . +=2 Hyper-Threading. .. .
β : - ( , Hyper-Threading), - , , , , .. , .
: , - . , .
, ? , β . . , : , . β , . : . . , , , : , , . β Console.ReadKey()
.
Windows 10, , 1,5 . , 20 , , , 4, , 20 1 7,5 β¦ , . - . , β¦ , - .
, β - .
β CreateThread
. . CreateThread
new Thread()
, .NET .
:
1) :
- (SECURITY_ATTRIBUTES) + .
.NET , ;
2) :
3) β
4) .
, .NET β . , , .. . . , .
: .NET , , ManageThreadId Thread.
: CREATE_SUSPENDED
β . .NET .
CreateRemoteThread
, . ( Snoop). . .NET , . β .NET runtime. , : WinAPI , . , .NET , ( ). β runtime. : , ( -.NET runtime, C/C++ , ). .NET - .
: .NET - (, )
, , . , . . : , . : , , . Windows. β , .
, . Windows : . , , . β , , (UMS ). , .. , . ? . , , , . , . , , , .

Windows 32 (0-31)
- 1 (00 β 00) β Zero Page Thread;
- 15 (01 β 15) β ;
- 16 (16 β 31) β .
Zero Page Thread. β , , , , , .. . : , - . , , - . runtime ( β .NET CLR) . , : - , , : . - , : . . , ?
, , , - - , . , Real Time . . .. - ( β , , , , ) 15
, : 16
, β . "" .
Windows API.
β . , : - ( ) : . , , , . , , β . . , , , . , - , . .. .
, : , : - β . , . ?
6 . β , . " ", - .
β , . , . β , Normal:
- Normal Normal, Normal 8 ( β4 );
- Above Normal, 10. , : Normal 10.
? , .
, ,
, : ( ). , . .
, , . , , - Below Normal. , 6 . . ?
3
Normal +0 . Below normal β (-1) . .. Below Normal
'Below Normal' 8 - 1 = 7
( Normal
), 6 - 1 = 5
. Lowest (-2) 4
.
Idle
Time Critical
β (-15 +15). Normal β 0
: -2, -1, +1 +2? . , (5,4,3,2,1) , : 5 β , 4 β , 3 β , 2 β , 1 β , 4. 10- ( β 100-), : 9 7? , 3 4?
. Normal. , Normal
Normal (Normal above), Normal (Normal below).
(Higest Lowest). , , . , , , : . Time Critical
. : , . Idle
. β .
?

Normal ( 3) Normal β 8. Above Normal Normal 9. Higest, Normal 10.
Windows , :
- Normal Above-Normal
- Higest Normal
10.
: Normal, β Higest,
Higest Normal, .
, Real-Time , Real-Time β . .., , , . : , , real-time. , , Windows .
, ,
Real-Time , , .
, , . , Above-Normal Normal Below-Normal ( ):

, , . , (. 3).
, , β Normal.
, CLRium #7, . .
: , .