CLR Exploration Series: Server and workstation garbage collection exploration (garbage collection Series)

Source: Internet
Author: User

First, we recommend a book:
Garbage Collection: Algorithms for Automatic Dynamic Memory Management (hardcover)
If you are interested in the GC automatic memory management algorithm, refer to this book. Links on Amazon:
Http://www.amazon.com/exec/obidos/ASIN/0471941484/qid=1030028976/sr=1-1/ref=sr_1_1/103-9503275-3854231

There are two modes for GC in CLR. GC of server mode and GC of workstation mode. At the same time, in some cases, concurrent GC may occur.

Server GC is only applicable to hosts with multiple CPUs. In this GC mode, a GC heap is created independently for each processor, so that concurrent collection can be performed. The benefits of doing so are obvious: more user requests can be processed at the same time. This effectively doubles the performance. At the same time, this mode is more effective than using the concurrency mode in a multi-processor.

 

Workstation mode GC is suitable for single-processor machines. It is also the default GC mode.

 

Here, we also need to talk about a combined GC, that is, the GC operation mode configured on the multi-processor machine in the workstation mode GC mode. When an application running on a multi-processor can be concurrently collected to reduce the request wait time. This mode is suitable for applications with graphical user interfaces or systems with high real-time requirements.

 

The implementation of server GC is in mscorsvr. dll. The implementation of workstation GC is encapsulated in mscorwks. dll. Knowing this, It is also easy to judge whether server GC or wrokstation GC is running on your computer. You can use the tasklist command:

 

> Tasklist/M mscorwks. dll

Image name PID modules

 

Outlook. EXE 3352 mscorwks. dll

Mmc.exe 2084 mscorwks. dll

W3wp.exe 3436 mscorwks. dll

 

Alternatively, you can view the system configuration in the management tool. Control Panel, and then open Microsoft. NET Framework 2.0 configuration. Check my computer attributes:



By default, wrokstation GC is used.

 

Another particularly common method is to host an application, that is, a user app, in the configuration file, you can manually add a configuration node to change the GC mode:

<Configuration>
<Runtime>
<Gcserver enabled = "true"/>
</Runtime>
</Configuration>

 

Here, we need to note that it is a non-hosted application. If the running application is hosted, the GC configuration of the host will overwrite the configuration of the GC mode in the. config file.

 

Workstation GC is used for single-processor machines when these modes are configured. If you are using a multi-processor, you can use server GC if you are looking at the throughput of the entire system. If you are interested in the real-time response characteristics of the entire system, you can select the GC of the concurrency mode.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.