{
    "componentChunkName": "component---src-templates-note-note-js",
    "path": "/notes/locks-versus-semaphores",
    "result": {"data":{"mdx":{"body":"var _excluded = [\"components\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Locks and Semaphores:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Locks are acquired per thread, not per invocation. Semaphores are acquired per invocation.\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.cs.tufts.edu/comp/150CCP/lectures/Lecture16.pdf\"\n  }, \"2\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Locks have a \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"/notes/counter\",\n    \"title\": \"counter\"\n  }, \"counter\"), \" that tracks the number of times a thread has acquired the lock. The lock is only released when the counter reaches zero.\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.cs.tufts.edu/comp/150CCP/lectures/Lecture16.pdf\"\n  }, \"2\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Semaphores have an initial value that represents the number of available \\\"\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"/notes/permits\",\n    \"title\": \"permits\"\n  }, \"permits\"), \"\\\". Threads must acquire a permit from the semaphore to proceed.\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://openclassrooms.com/en/courses/5684021-scale-up-your-code-with-java-concurrency/6631251-restrict-access-to-limited-resources-with-semaphores\"\n  }, \"4\"), \" \")));\n}\n;\nMDXContent.isMDXComponent = true;","inboundReferences":[]}},"pageContext":{"slug":"locks-versus-semaphores","node":{"childMdx":{"slug":"locks-versus-semaphores"}}}},
    "staticQueryHashes": []}