<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文 &#187; . ə</title>
	<atom:link href="http://software.intel.com/zh-cn/blogs/author/426392/feed/" rel="self" type="application/rss+xml" />
	<link>http://software.intel.com/zh-cn/blogs</link>
	<description></description>
	<lastBuildDate>Mon, 28 May 2012 13:40:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>[Windows编程] 获取系统CPU 个数</title>
		<link>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-cpu/</link>
		<comments>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-cpu/#comments</comments>
		<pubDate>Tue, 05 May 2009 09:16:11 +0000</pubDate>
		<dc:creator>. ə</dc:creator>
				<category><![CDATA[博客征文专栏]]></category>

		<guid isPermaLink="false">http://software.intel.com/zh-cn/blogs/2009/05/05/windows-cpu/</guid>
		<description><![CDATA[随着多核CPU的普及， 程序中有必要考虑利用多核的优势来提高性能。 比如当创建线程池或者进程池的时候，可以根据系统CPU的个数来设定线程池/进程池的大小。 以下代码示例如何获取CPU的个数。 typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); DWORD GetNumberOfProcessors() { SYSTEM_INFO si; // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. PGNSI pfnGNSI = (PGNSI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo"); if(pfnGNSI) { pfnGNSI(&#38;si); } else { GetSystemInfo(&#38;si); } return si.dwNumberOfProcessors; }]]></description>
			<content:encoded><![CDATA[<p>随着多核CPU的普及， 程序中有必要考虑利用多核的优势来提高性能。 比如当创建线程池或者进程池的时候，可以根据系统CPU的个数来设定线程池/进程池的大小。</p>
<p>以下代码示例如何获取CPU的个数。</p>
<p>typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);</p>
<p>DWORD GetNumberOfProcessors()</p>
<p>{</p>
<p>SYSTEM_INFO si;</p>
<p>// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.</p>
<p>PGNSI pfnGNSI = (PGNSI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo");</p>
<p>if(pfnGNSI)</p>
<p>{</p>
<p>pfnGNSI(&amp;si);</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>GetSystemInfo(&amp;si);</p>
<p>}</p>
<p>return si.dwNumberOfProcessors;</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-cpu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Windows编程] Windows 7 对多核的支持</title>
		<link>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-windows-7/</link>
		<comments>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-windows-7/#comments</comments>
		<pubDate>Tue, 05 May 2009 09:14:16 +0000</pubDate>
		<dc:creator>. ə</dc:creator>
				<category><![CDATA[博客征文专栏]]></category>

		<guid isPermaLink="false">http://software.intel.com/zh-cn/blogs/2009/05/05/windows-windows-7/</guid>
		<description><![CDATA[Windows 7 和 Windows Server 2008 R2 一个重要更新是增强了对多核的支持。 现已可以支持超过64个逻辑处理器（也就是所谓的“核”），并且引入了NUMA 技术， 大幅度提高多核运算的性能。 传统的多核运算是使用SMP(Symmetric Multi-Processor )模式：将多个处理器与一个集中的存储器和I/O总线相连。所有处理器只能访问同一个物理存储器，因此SMP系统有时也被称为一致存储器访问（UMA）结构体系，一致性意指无论在什么时候，处理器只能为内存的每个数据保持或共享唯一一个数值。很显然，SMP的缺点是可伸缩性有限，因为在存储器和I/O接口达到饱和的时候，增加处理器并不能获得更高的性能。 NUMA模式是一种分布式存储器访问方式，处理器可以同时访问不同的存储器地址，大幅度提高并行性。 NUMA模式下，处理器被划分成多个"节点"（node）， 每个节点被分配有的本地存储器空间。 所有节点中的处理器都可以访问全部的系统物理存储器，但是访问本节点内的存储器所需要的时间，比访问某些远程节点内的存储器所花的时间要少得多。 在开发Windows7 上的多线程程序的时候， 应该把进程内所有的线程都安排到同一个节点，可以大大提高性能。 新的Windows 7 API 函数 SetProcessAffinityMask 可以实现这个功能。 如果你的程序使用内存比较频繁， 应该在进程所在节点的本地存储器空间分配内存，以避免跨节点存储器访问的开销。 Windows API VirtualAllocExNuma 可以实现这个功能。 以下是Windows 7/ WIndows Server2 2008R2 新增加的多核支持API函数： CreateRemoteThreadEx Creates a thread that runs in the virtual address space of another process and optionally [...]]]></description>
			<content:encoded><![CDATA[<p>Windows 7 和 Windows Server 2008 R2 一个重要更新是增强了对多核的支持。 现已可以支持超过64个逻辑处理器（也就是所谓的“核”），并且引入了NUMA 技术， 大幅度提高多核运算的性能。</p>
<p>传统的多核运算是使用SMP(Symmetric Multi-Processor )模式：将多个处理器与一个集中的存储器和I/O总线相连。所有处理器只能访问同一个物理存储器，因此SMP系统有时也被称为一致存储器访问（UMA）结构体系，一致性意指无论在什么时候，处理器只能为内存的每个数据保持或共享唯一一个数值。很显然，SMP的缺点是可伸缩性有限，因为在存储器和I/O接口达到饱和的时候，增加处理器并不能获得更高的性能。</p>
<p>NUMA模式是一种分布式存储器访问方式，处理器可以同时访问不同的存储器地址，大幅度提高并行性。 NUMA模式下，处理器被划分成多个"节点"（node）， 每个节点被分配有的本地存储器空间。 所有节点中的处理器都可以访问全部的系统物理存储器，但是访问本节点内的存储器所需要的时间，比访问某些远程节点内的存储器所花的时间要少得多。</p>
<p>在开发Windows7 上的多线程程序的时候， 应该把进程内所有的线程都安排到同一个节点，可以大大提高性能。 新的Windows 7 API 函数 SetProcessAffinityMask  可以实现这个功能。</p>
<p>如果你的程序使用内存比较频繁， 应该在进程所在节点的本地存储器空间分配内存，以避免跨节点存储器访问的开销。 Windows API VirtualAllocExNuma  可以实现这个功能。</p>
<p>以下是Windows 7/ WIndows Server2 2008R2 新增加的多核支持API函数：</p>
<p>CreateRemoteThreadEx</p>
<p>Creates a thread that runs in the virtual address space of another process and optionally specifies extended attributes such as processor group affinity.GetActiveProcessorCount<br />
Returns the number of active processors in a processor group or in the system.<br />
GetActiveProcessorGroupCount<br />
Returns the number of active processor groups in the system.</p>
<p>GetCurrentProcessorNumberEx<br />
Retrieves the processor group and number of the logical processor in which the calling thread is running.</p>
<p>GetLogicalProcessorInformationEx<br />
Retrieves information about the relationships of logical processors and related hardware.</p>
<p>GetMaximumProcessorCount<br />
Returns the maximum number of logical processors that a processor group or the system can support.</p>
<p>GetMaximumProcessorGroupCount<br />
Returns the maximum number of processor groups that the system supports.</p>
<p>GetNumaAvailableMemoryNodeEx<br />
Retrieves the amount of memory that is available in the specified node as a USHORT value.</p>
<p>GetNumaNodeNumberFromHandle<br />
Retrieves the NUMA node associated with the underlying device for a file handle.</p>
<p>GetNumaNodeProcessorMaskEx<br />
Retrieves the processor mask for the specified NUMA node as a USHORT value.</p>
<p>GetNumaProcessorNodeEx<br />
Retrieves the node number of the specified logical processor as a USHORT value.</p>
<p>GetNumaProximityNodeEx<br />
Retrieves the node number as a USHORT value for the specified proximity identifier.</p>
<p>GetProcessGroupAffinity<br />
Retrieves the processor group affinity of the specified process.</p>
<p>GetProcessorSystemCycleTime<br />
Retrieves the cycle time each processor in the specified group spent executing deferred procedure calls (DPCs) and interrupt service routines (ISRs).</p>
<p>GetThreadGroupAffinity<br />
Retrieves the processor group affinity of the specified thread.</p>
<p>GetThreadIdealProcessorEx<br />
Retrieves the processor number of the ideal processor for the specified thread.</p>
<p>QueryIdleProcessorCycleTimeEx<br />
Retrieves the accumulated cycle time for the idle thread on each logical processor in the specified processor group.</p>
<p>SetThreadGroupAffinity<br />
Sets the processor group affinity for the specified thread.</p>
<p>SetThreadIdealProcessorEx<br />
Sets the ideal processor for the specified thread and optionally retrieves the previous ideal processor.</p>
<p>以下是新的线程池 API 函数</p>
<p>QueryThreadpoolStackInformation<br />
Retrieves the stack reserve and commit sizes for threads in the specified thread pool.SetThreadpoolCallbackPersistent<br />
Specifies that the callback should run on a persistent thread.<br />
SetThreadpoolCallbackPriority<br />
Specifies the priority of a callback function relative to other work items in the same thread pool.</p>
<p>SetThreadpoolStackInformation<br />
Sets the stack reserve and commit sizes for new threads in the specified thread pool.</p>
]]></content:encoded>
			<wfw:commentRss>http://software.intel.com/zh-cn/blogs/2009/05/05/windows-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

