Workstation GC Vs Background GC

Well, there has been a confusion around the developer community on the differences between the Workstation GC which is by default recommended for standalone machines which targets one single CPU Core and the Background GC which provides multicore execution of Garbage Collections.

In general aspect first let us consider how the Workstation is different from the server.

A Workstation is generally used to provide throughput. There could be a single application running which could use multiple Threads, but the basic idea is to give precedence on the application engine rather than the memory.

On the other hand, Server applications are generally very very long running (for instance ASP.NET Applications) and are job specific, such that when a job needs to be performed, a CPU is assigned to it to perform the task, and once the Task is complete the Thread needs to return back to the Pool. Thus server needs continuous maintenance of its memory usage without hampering the peformance of the application.

1. Concurrent GC

Concurrent GC maintains a dedicated thread to collect memory footprints. When the GC is performed, all the managed thread may continue to run. For responsive applications, it is recommended to use Concurrent GC as it can still allocate memory while GC is running.

2. Background Workstation GC.

This type of GC is mainly recommended for a client application like Windows Forms or console applications which runs on a single processor. The Workstation GC is a single Thread running on the whole application and collect the whole memory heap at a time concurrently using a single Thread.

3. Background Server GC.

This type of GC is ideal for multi-core processor. This kind of GC provides separate managed heap and GC Thread for each processor and can perform more than one GC in parallel. When the GC is performed, all the Threads pointing to the current Core gets suspended. For servers the Background GC is much more recommended.

Share this:

About Abhishek Sur

Abhishek Sur is a Microsoft MVP since year 2011. He is an architect in the .NET platform. He has profound theoretical insight and years of hands on experience in different .NET products and languages. He leads the Microsoft User Group in Kolkata named KolkataGeeks, and regularly organizes events and seminars in various places for spreading .NET awareness. He is associated with the Microsoft Insider list on WPF and C#, and is in constant touch with product group teams. He blogs at http://www.abhisheksur.com His Book : Visual Studio 2012 and .NET 4.5 Expert Development Cookbook. Follow Abhishek at Twitter : @abhi2434

Actually Concurrent GC can be applied on either Workstation GC or Server GC. When Concurrent flag is turned off, it will be truely background, that means it wont stop the EE while collecting. Workstation will indicate whether finalizer is single thread or one for every core.

Here is the configuration for Concurrency.

There was a mistake in the post above.

In fact, you can do like :

Which means the GC will have a Single Thread and Single Heap for the entire process and will halt the execution engine during Garbage Collection and Heap Compaction.