# Mutex vs Semorphore

{% embed url="<https://www.guru99.com/mutex-vs-semaphore.html>" %}

* Mutex is a locking mechanism whereas Semaphore is a signaling mechanism
* Mutex is just an object while Semaphore is an integer
* Mutex has no subtype whereas Semaphore has two types, which are counting semaphore and binary semaphore.
* Semaphore supports wait and signal operations modification, whereas Mutex is only modified by the process that may request or release a resource.
* Semaphore value is modified using wait () and signal () operations, on the other hand, Mutex operations are locked or unlocked.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chenxing-cao.gitbook.io/space/multi-threading/mutex-vs-semorphore.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
