开发者

CLR: How is generation 0 shared by all threads?

开发者 https://www.devze.com 2023-02-05 10:46 出处:网络
I cannot imagine there is a single lock that all threads must acquire in order to allocate memory. So are there multiple Gen 0 heaps? Is there one that is partit开发者_开发百科ioned amongst the thread

I cannot imagine there is a single lock that all threads must acquire in order to allocate memory. So are there multiple Gen 0 heaps? Is there one that is partit开发者_开发百科ioned amongst the threads?


From this article: Garbage Collection Part 2: Automatic Memory Management in the Microsoft .NET Framework by Jeffrey Richter

Synchronization-free Allocations On a multiprocessor system, generation 0 of the managed heap is split into multiple memory arenas using one arena per thread. This allows multiple threads to make allocations simultaneously so that exclusive access to the heap is not required.

Scalable Collections On a multiprocessor system running the server version of the execution engine (MSCorSvr.dll), the managed heap is split into several sections, one per CPU. When a collection is initiated, the collector has one thread per CPU; all threads collect their own sections simultaneously. The workstation version of the execution engine (MSCorWks.dll) doesn't support this feature.

There is a lot other things going on, look for the "Performance for Multithreaded Applications" headline.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号