Actually threads from several processes work

In the Windows operating system with two physical x86 / amd64 processors (P0 + P1), 2 processes (A + B) work, each of which has two threads (T0 + T1), is it possible (or even ordinary) to see the following:

P0:A:T0 works simultaneously with P1:B:T0

then after 1 (or is it 2?) the context switch (es?)

P0:B:T1 works simultaneously with P1:A:T1

In short, I would like to know if - on a multiprocessor machine - the operating system can schedule any thread from any process at any time, regardless of what other threads from other processes are already running.

EDIT: To clarify a stupid example, imagine that process A thread A: T0 has an affinity for processor P0 (and A: T1-P1), while thread B of process B: T0 has an affinity for processor P1 (and B: from T1 to P0). It probably doesn't matter if these processors are cores or sockets.

Is there a first class context switch concept? Perfmon shows context switches in the Thread object, but nothing under the Process object.

+3
source share
2 answers

, , .
CPU ( , ).
Windows - , .

EDIT ( )

" ". , ( ) / ( ), "" , ( ).

"" , , L1 ( L2) ( /), , , "" ( "" ).
NUMA, (, - /).

: ( ), , ( ).

( ), , .

, .

, ( , ​​ ..), , , , ( ).

, - , ( ), , .. , , . , , , SQL- .NET Java- , HyperThreading.

+6

, .

, , , -. :

  • . - .
  • .

(2) . - L2, . : - L2, L2 , .

, ( ). , : " ".

+2

Source: https://habr.com/ru/post/1748509/


All Articles