{"id":415,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:25:59","modified_gmt":"2020-08-22T20:25:59","slug":"this-is-the-page-title-toplevel-248","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=415","title":{"rendered":"Buzz Locks"},"content":{"rendered":"\n<title>Buzz Locks<\/title>\n<p>\nBuzz locks, better known as spin locks, are a primitive way of protecting a data\nstructure or piece of code. They only allow one process at a time to be within a critical\nregion of code. They are used in Linux to restrict access to fields in data structures,\nusing a single integer field as a lock.\nEach process wishing to enter the region attempts to change the lock&#8217;s initial value from\n0 to 1. If its current value is 1, the process tries again, spinning in a tight loop of\ncode. The access to the memory location holding the lock must be atomic, the action of\nreading its value, checking that it is 0 and then changing it to 1 cannot be interrupted\nby any other process. Most <glossary>CPU<\/glossary> architectures provide support for this via special\ninstructions but you can also implement buzz locks using uncached main memory.\n<p>\nWhen the owning process leaves the critical region of code it decrements the buzz lock,\nreturning its value to 0. Any processes spinning on the lock will now read it as 0,\nthe first one to do this will increment it to 1 and enter the critical region.\n","protected":false},"excerpt":{"rendered":"<p>Buzz Locks Buzz locks, better known as spin locks, are a primitive way of protecting a data structure or piece of code. They only allow one process at a time to be within a critical region of code. They are &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=415\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-415","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=415"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/415\/revisions"}],"predecessor-version":[{"id":512,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/415\/revisions\/512"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}