{"id":96185,"date":"2017-05-18T07:00:00","date_gmt":"2017-05-18T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=96185"},"modified":"2019-03-13T01:11:39","modified_gmt":"2019-03-13T08:11:39","slug":"20170518-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20170518-00\/?p=96185","title":{"rendered":"Why is the !locks command called !locks even though it debugs only critical sections?"},"content":{"rendered":"<p>Commenter DWalker07 notes that the <code>!locks<\/code> command is called <code>!locks<\/code> <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20170301-00\/?p=95615#comment-1286845\">even though it doesn&#8217;t actually debug all types of locks<\/a>, only critical sections. Why the bad name? <\/p>\n<p>Because at the time it was written, critical sections were the only types of user-mode locks. <\/p>\n<p>In the original incarnation of Win32, there were semaphores and mutexes and other kernel-mode synchronization objects, but the only user-mode synchronization objects were critical sections. Seeing as they were the only type of synchronization objects available in user mode, they were informally referred to as &#8220;locks&#8221; because when you have only one kind of thing, you don&#8217;t really worry too much about being specific. <\/p>\n<p>If there&#8217;s only kind of wristwatch, then you don&#8217;t really bother being specific about the fact that it&#8217;s a spring-wound analog-readout time-only watch. You just call it a watch. Of course, later, when battery-powered digital-readout smart watches become commonplace, your old documents that talk about &#8220;watches&#8221; may seem confusing. &#8220;Why do these instructions for troubleshooting watches not work for my battery-powered digital-readout smart watch?&#8221; <\/p>\n<p>Indeed, for a very long time, critical sections were the only user-mode synchronization objects that came with Win32. It wasn&#8217;t until Windows Vista that a whole bunch of new user-mode synchronization objects became available, things like slim reader-writer locks, condition variables, and one-time initialization. Until then, the word &#8220;lock&#8221;  was sufficient. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because those were the only kind of locks, back in the day.<\/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-96185","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Because those were the only kind of locks, back in the day.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/96185","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=96185"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/96185\/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=96185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=96185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=96185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}