{"id":23283,"date":"2008-02-28T10:00:00","date_gmt":"2008-02-28T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/02\/28\/why-are-process-and-thread-ids-multiples-of-four\/"},"modified":"2008-02-28T10:00:00","modified_gmt":"2008-02-28T10:00:00","slug":"why-are-process-and-thread-ids-multiples-of-four","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080228-00\/?p=23283","title":{"rendered":"Why are process and thread IDs multiples of four?"},"content":{"rendered":"<p>On Windows&nbsp;NT-based operating systems, process and thread IDs happen always to be a multiple of four. Is this just a coincidence?\n Yes, it&#8217;s just a coincidence, and you shouldn&#8217;t rely on it since it is not part of the programming contract. For example, Windows&nbsp;95 process and thread IDs were not always multiples of four. (By comparison, the reason that <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/01\/21\/358109.aspx\"> kernel handles are always a multiple of four<\/a> is part of the specification and will be guaranteed for the foreseeable future.)<\/p>\n<p> Process and thread IDs are multiples of four as a side-effect of code re-use. The same code the allocates kernel handles is also used to allocate process and thread IDs. Since kernel handles are a multiple of four, so too are process and thread IDs. This is an implementation detail, so don&#8217;t write code that relies on it. I&#8217;m just telling you to satify your curiosity. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Windows&nbsp;NT-based operating systems, process and thread IDs happen always to be a multiple of four. Is this just a coincidence? Yes, it&#8217;s just a coincidence, and you shouldn&#8217;t rely on it since it is not part of the programming contract. For example, Windows&nbsp;95 process and thread IDs were not always multiples of four. (By [&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":[2],"class_list":["post-23283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>On Windows&nbsp;NT-based operating systems, process and thread IDs happen always to be a multiple of four. Is this just a coincidence? Yes, it&#8217;s just a coincidence, and you shouldn&#8217;t rely on it since it is not part of the programming contract. For example, Windows&nbsp;95 process and thread IDs were not always multiples of four. (By [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/23283","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=23283"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/23283\/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=23283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=23283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=23283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}