{"id":3442,"date":"2021-07-06T16:03:30","date_gmt":"2021-07-06T10:33:30","guid":{"rendered":"https:\/\/www.goseeko.com\/blog\/?p=3442"},"modified":"2021-10-30T07:40:37","modified_gmt":"2021-10-30T07:40:37","slug":"what-is-semaphore","status":"publish","type":"post","link":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/","title":{"rendered":"What is Semaphore?"},"content":{"rendered":"\n<p>Threads exchange a non-negative variable called semaphore. A semaphore is a signalling mechanism, and another thread can signal a thread that is waiting for a semaphore. For process synchronisation, it employs two atomic operations: 1) wait and 2) signal.<\/p>\n\n\n\n<p>Depending on that it is set up, a semaphore either enables or prevents access to a resource.<\/p>\n\n\n\n<p>Semaphores are integer variables that are using to solve the critical section problem by combining two atomic procedures for process synchronisation: wait and signal.<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Semaphore Animation | Operating System Concept Made Simple\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/LIzTbA3cAWY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Advantages<\/strong>&nbsp;of Semaphore&nbsp;&nbsp;<\/h2>\n\n\n\n<p>The following are some of the benefits of semaphores:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Only one process is allow to enter the critical part thanks to semaphores. They closely adhere to the mutual exclusion principle and are far more efficient than other synchronisation methods.<\/li><li>Because processor time is not wasted unnecessarily checking if a condition is met to allow a process to access the vital region, there is no resource waste due to busy waiting in semaphores.\u00a0<\/li><li>Semaphores are implement in the microkernel&#8217;s machine-independent code. As a result, they are machine-agnostic.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Disadvantages<\/strong><\/h2>\n\n\n\n<p>The following are some of the drawbacks of semaphores:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Due to the complexity of semaphores, the wait and signal actions may performing in the correct order to avoid deadlocks.<\/li><li>Semaphores are impractical for usage at the final scale because they reduce modularity. This occurs because the wait and signal procedures hinder the system from forming a structured layout.<\/li><li>Semaphores may cause a priority inversion, allowing low-priority processes to access the critical portion first and high-priority processes to access the vital section later.\u00a0<\/li><\/ul>\n\n\n\n<p>Interested in learning about similar topics? Here are a few hand-picked blogs for you!<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.goseeko.com\/blog\/what-is-api\" target=\"_blank\">What is API?<\/a><\/li><li><a href=\"https:\/\/www.goseeko.com\/blog\/what-is-cloud-computing\" target=\"_blank\" rel=\"noreferrer noopener\">Phenomena of cloud computing?<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.goseeko.com\/blog\/what-is-sorting-algorithm\" target=\"_blank\">What is sorting algorithm?<\/a><\/li><li><a href=\"https:\/\/www.goseeko.com\/blog\/index.php\/2021\/05\/31\/what-is-dns\/\" target=\"_blank\" rel=\"noreferrer noopener\">Phenomenal of DNS?<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.goseeko.com\/blog\/what-is-machine-learning\" target=\"_blank\">What is machine learning?<\/a><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Threads exchange a non-negative variable called semaphore.<\/p>\n","protected":false},"author":3,"featured_media":2033,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[36],"tags":[],"class_list":["post-3442","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer-science-software-engineering-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.3.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Semaphore? - Goseeko blog<\/title>\n<meta name=\"description\" content=\"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Semaphore? - Goseeko blog\" \/>\n<meta property=\"og:description\" content=\"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\" \/>\n<meta property=\"og:site_name\" content=\"Goseeko blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/goseeko\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-06T10:33:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-30T07:40:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Team Goseeko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@goseeko\" \/>\n<meta name=\"twitter:site\" content=\"@goseeko\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Team Goseeko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\"},\"author\":{\"name\":\"Team Goseeko\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/7ec300cd01b6116501943af14d546bae\"},\"headline\":\"What is Semaphore?\",\"datePublished\":\"2021-07-06T10:33:30+00:00\",\"dateModified\":\"2021-10-30T07:40:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\"},\"wordCount\":296,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1\",\"articleSection\":[\"Computers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\",\"url\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\",\"name\":\"What is Semaphore? - Goseeko blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1\",\"datePublished\":\"2021-07-06T10:33:30+00:00\",\"dateModified\":\"2021-10-30T07:40:37+00:00\",\"description\":\"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"Top 10 Jobs in Electronics and Telecommunications Engineering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.goseeko.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is Semaphore?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#website\",\"url\":\"https:\/\/www.goseeko.com\/blog\/\",\"name\":\"Goseeko blog\",\"description\":\"Learning beyond college, Students platform for life skills.\",\"publisher\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.goseeko.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#organization\",\"name\":\"Goseeko.com\",\"url\":\"https:\/\/www.goseeko.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/i1.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/09\/GoSeeko_Stacked-logo-01.png?fit=2471%2C2471&ssl=1\",\"contentUrl\":\"https:\/\/i1.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/09\/GoSeeko_Stacked-logo-01.png?fit=2471%2C2471&ssl=1\",\"width\":2471,\"height\":2471,\"caption\":\"Goseeko.com\"},\"image\":{\"@id\":\"https:\/\/www.goseeko.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/goseeko\",\"https:\/\/x.com\/goseeko\",\"https:\/\/www.instagram.com\/goseeko\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/7ec300cd01b6116501943af14d546bae\",\"name\":\"Team Goseeko\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Team Goseeko\"},\"url\":\"https:\/\/www.goseeko.com\/blog\/author\/team-goseeko\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Semaphore? - Goseeko blog","description":"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/","og_locale":"en_US","og_type":"article","og_title":"What is Semaphore? - Goseeko blog","og_description":"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.","og_url":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/","og_site_name":"Goseeko blog","article_publisher":"https:\/\/www.facebook.com\/goseeko","article_published_time":"2021-07-06T10:33:30+00:00","article_modified_time":"2021-10-30T07:40:37+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg","type":"image\/jpeg"}],"author":"Team Goseeko","twitter_card":"summary_large_image","twitter_creator":"@goseeko","twitter_site":"@goseeko","twitter_misc":{"Written by":"Team Goseeko","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#article","isPartOf":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/"},"author":{"name":"Team Goseeko","@id":"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/7ec300cd01b6116501943af14d546bae"},"headline":"What is Semaphore?","datePublished":"2021-07-06T10:33:30+00:00","dateModified":"2021-10-30T07:40:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/"},"wordCount":296,"commentCount":0,"publisher":{"@id":"https:\/\/www.goseeko.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1","articleSection":["Computers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/","url":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/","name":"What is Semaphore? - Goseeko blog","isPartOf":{"@id":"https:\/\/www.goseeko.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage"},"image":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1","datePublished":"2021-07-06T10:33:30+00:00","dateModified":"2021-10-30T07:40:37+00:00","description":"A semaphore is a signaling mechanism, another thread can signal a thread exchange a non-negative variable that is waiting for a semaphore.","breadcrumb":{"@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#primaryimage","url":"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"Top 10 Jobs in Electronics and Telecommunications Engineering"},{"@type":"BreadcrumbList","@id":"https:\/\/www.goseeko.com\/blog\/what-is-semaphore\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.goseeko.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What is Semaphore?"}]},{"@type":"WebSite","@id":"https:\/\/www.goseeko.com\/blog\/#website","url":"https:\/\/www.goseeko.com\/blog\/","name":"Goseeko blog","description":"Learning beyond college, Students platform for life skills.","publisher":{"@id":"https:\/\/www.goseeko.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.goseeko.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.goseeko.com\/blog\/#organization","name":"Goseeko.com","url":"https:\/\/www.goseeko.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.goseeko.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i1.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/09\/GoSeeko_Stacked-logo-01.png?fit=2471%2C2471&ssl=1","contentUrl":"https:\/\/i1.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/09\/GoSeeko_Stacked-logo-01.png?fit=2471%2C2471&ssl=1","width":2471,"height":2471,"caption":"Goseeko.com"},"image":{"@id":"https:\/\/www.goseeko.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/goseeko","https:\/\/x.com\/goseeko","https:\/\/www.instagram.com\/goseeko\/"]},{"@type":"Person","@id":"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/7ec300cd01b6116501943af14d546bae","name":"Team Goseeko","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.goseeko.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Team Goseeko"},"url":"https:\/\/www.goseeko.com\/blog\/author\/team-goseeko\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.goseeko.com\/blog\/wp-content\/uploads\/2021\/06\/Top-10-Jobs-in-Electronics-and-Telecommunications-Engineering.jpg?fit=1280%2C720&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/posts\/3442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/comments?post=3442"}],"version-history":[{"count":1,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/posts\/3442\/revisions"}],"predecessor-version":[{"id":6034,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/posts\/3442\/revisions\/6034"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/media\/2033"}],"wp:attachment":[{"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/media?parent=3442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/categories?post=3442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.goseeko.com\/blog\/wp-json\/wp\/v2\/tags?post=3442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}