<GCNoAffinitize> 項目<GCNoAffinitize> element

指定是否要使用 Cpu 將相似化為伺服器 GC 執行緒。Specifies whether or not to affinitize server GC threads with CPUs.

<configuration>
  <runtime>
    <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 不會將相似化為伺服器 GC 執行緒與 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 屬性設定為 true ,您可以指定伺服器 GC 執行緒和 cpu 不應緊密結合。Starting with .NET Framework 4.6.2, by setting the GCNoAffinitize element's enabled attribute to true, you can specify that server GC threads and CPUs should not be tightly coupled.

您可以單獨指定GCNoAffinitize設定元素,而不是使用 cpu 將相似化為伺服器 GC 執行緒。You can specify the GCNoAffinitize configuration element alone to not affinitize server GC threads with CPUs. 您也可以將它與GCHeapCount元素搭配使用,以控制應用程式所使用的 GC 堆積和執行緒數目。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 屬性GCNoAffinitizefalse (其預設值),您也可以使用GCHeapCount專案來指定 gc 執行緒和堆積的數目,以及GCHeapAffinitizeMask元素,以指定 gc 執行緒和堆積相似化為的處理器。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