<GCNoAffinitize > 元素<GCNoAffinitize> element

指定是否关联服务器 GC 线程与 Cpu。Specifies whether or not to affinitize server GC threads with CPUs.

<配置 > <configuration>
  <运行时 >   <runtime>
    <GCNoAffinitize >    <GCNoAffinitize>

语法Syntax

<GCNoAffinitize
   enabled="true|false"/>

特性和元素Attributes and elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
enabled 必需的特性。Required attribute.

指定服务器 GC 线程/堆是否与计算机上可用的处理器关联。Specifies whether server GC threads/heaps are affinitized with the processors available on the machine.

enabled 属性enabled attribute

“值”Value 描述Description
false 包含 Cpu 的关联服务器 GC 线程。Affinitizes server GC threads with CPUs. 这是默认设置。This is the default.
true 不关联具有 Cpu 的服务器垃圾回收线程。Does not affinitize server GC threads with CPUs.

子元素Child elements

无。None.

父元素Parent elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.

备注Remarks

默认情况下,服务器 GC 线程使用各自的 Cpu 进行关联。By default, server GC threads are hard-affinitized with their respective CPUs. 系统的每个可用处理器都有其自己的 GC 堆和线程。Each of the system's available processors has its own GC heap and thread. 这通常是首选的设置,因为它会优化缓存使用量。This is typically the preferred setting since it optimizes cache usage. 从 .NET Framework 4.6.2 开始,通过将GCNoAffinitize元素的 enabled 属性设置为 false,可以指定服务器 GC 线程和 cpu 不应紧密耦合。Starting with .NET Framework 4.6.2, by setting the GCNoAffinitize element's enabled attribute to false, you can specify that server GC threads and CPUs should not be tightly coupled.

您可以单独指定GCNoAffinitize配置元素,以不关联服务器 GC 线程与 cpu 一起工作。You can specify the GCNoAffinitize configuration element alone to not affinitize server GC threads with CPUs. 你还可以将它与GCHeapCount元素结合使用,以控制应用程序使用的垃圾回收堆和线程的数目。You can also use it along with the GCHeapCount element to control the number of GC heaps and threads used by an application.

如果GCNoAffinitize元素的 enabled 属性是 false (其默认值),则还可以使用GCHeapCount元素来指定垃圾回收器线程和堆的数目,同时还可以使用GCHeapAffinitizeMask元素指定垃圾回收线程和堆关联的处理器。If the enabled attribute of the GCNoAffinitize element is false (its default value), you can also use the GCHeapCount element to specify the number of GC threads and heaps, along with the GCHeapAffinitizeMask element to specify the processors to which the GC threads and heaps are affinitized.

示例Example

以下示例不关联服务器 GC 线程:The following example does not hard-affinitize server GC threads:

<configuration>
   <runtime>
      <gcServer enabled="true"/>
      <GCNoAffinitize enabled="true"/>
   </runtime>
</configuration>

以下示例不关联服务器 GC 线程,并将 GC 堆/线程数限制为10:The following example does not affinitize server GC threads and limits the number of GC heaps/threads to 10:

<configuration>
   <runtime>
      <gcServer enabled="true"/>
      <GCHeapCount enabled="10"/>
      <GCNoAffinitize enabled="true"/>
   </runtime>
</configuration>

请参阅See also