{"id":15733,"date":"2009-12-08T07:00:01","date_gmt":"2009-12-08T07:00:01","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2009\/12\/08\/how-do-i-determine-the-processors-cache-line-size\/"},"modified":"2009-12-08T07:00:01","modified_gmt":"2009-12-08T07:00:01","slug":"how-do-i-determine-the-processors-cache-line-size","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20091208-01\/?p=15733\/","title":{"rendered":"How do I determine the processor&#039;s cache line size?"},"content":{"rendered":"<p>When doing high-performance computing, you need to worry about the CPU cache line size in order to avoid issues like <i>false sharing<\/i>. But how can you determine the processor&#8217;s cache size?\n The <code>GetLogicalProcessorInformation<\/code> function will give you characteristics of the logical processors in use by the system. You can <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms683194(VS.85).aspx\"> walk the <code>SYSTEM_LOGICAL_PROCESSOR_INFORMATION<\/code><\/a> returned by the function looking for entries of type <code>RelationCache<\/code>. Each such entry contains a <code>ProcessorMask<\/code> which tells you which processor(s) the entry applies to, and in the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms681979(VS.85).aspx\"> <code>CACHE_DESCRIPTOR<\/code><\/a>, it tells you what type of cache is being described and how big the cache line is for that cache.<\/p>\n<p> Windows&nbsp;7 adds the function <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd405488(VS.85).aspx\"> <code>GetLogicalProcessorInformationEx<\/code><\/a> which does the <code>RelationCache<\/code> filtering for you. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When doing high-performance computing, you need to worry about the CPU cache line size in order to avoid issues like false sharing. But how can you determine the processor&#8217;s cache size? The GetLogicalProcessorInformation function will give you characteristics of the logical processors in use by the system. You can walk the SYSTEM_LOGICAL_PROCESSOR_INFORMATION returned by the [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-15733","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>When doing high-performance computing, you need to worry about the CPU cache line size in order to avoid issues like false sharing. But how can you determine the processor&#8217;s cache size? The GetLogicalProcessorInformation function will give you characteristics of the logical processors in use by the system. You can walk the SYSTEM_LOGICAL_PROCESSOR_INFORMATION returned by the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/15733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=15733"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/15733\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=15733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=15733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=15733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}