简体   繁体   中英

How does concurrent garbage collection work with parallel computations?

In .NET 4 it is possible to enable concurrent GC.

Q1 How does it work with parallel computations: Parallel , Task , PLINQ etc?
Q2 As a software developer what shall I be aware of when working with concurrent GC?

  1. The Concurrent GC will work fine with parallel computations. It runs inside of its own dedicated thread - so it's already handling working in concert with other threads. The runtime itself handles any synchronization required for you.
  2. In general, you shouldn't have to worry about this at all. The beauty of the GC is that you rarely have to worry about its implementation details. The only time I would worry about this is more if you profile and discover that a large amount of your processing time is spent in GC. However, this is not really specific to one form of GC, but rather overall profiling and memory usage in general.

That being said, in .NET 4, the new "Background GC" was added. There is a detailed post describing this here as well as this Channel 9 video .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM