How .NET defines the boundaries between threads that execute the same code

When several threads work with the same code fragment, how the CLR manages to keep them from each other. Is it the AppDomain that manages these threads and defines the boundaries between different threads, even if they can act on the same code (and possibly data)? If so, how?

TIA

+3
source share
2 answers

Plain; for method variables (excluding captured variables, iterator blocks, etc.) the variables are on the stack. Each thread has a different stack. This is no different from a recursive method in a single thread - the method variables are separate and independent for each call.

... !. ; . .., .

, .

+7

. Windows . . EIP, ESP, . , . . .

, . , . . . , , , , . . , , .

Threading , , . .NET- , , . , ​​ , . .

AppDomain , (, ). . , . Windows. AppDomains CLR, ASP.NET SQL Server. , , , -, , .

+2

All Articles