This commit is contained in:
Ilkka Seppälä
2019-12-13 21:09:28 +02:00
parent 0335c61512
commit b2b1ba95eb
127 changed files with 282 additions and 450 deletions

View File

@ -5,13 +5,13 @@ folder: mutex
permalink: /patterns/mutex/
categories: Concurrency
tags:
- Java
- Difficulty-Intermediate
- Decoupling
---
## Also known as
Mutual Exclusion Lock
Binary Semaphore
* Mutual Exclusion Lock
* Binary Semaphore
## Intent
Create a lock which only allows a single thread to access a resource at any one instant.
@ -22,8 +22,8 @@ Create a lock which only allows a single thread to access a resource at any one
## Applicability
Use a Mutex when
* you need to prevent two threads accessing a critical section at the same time
* concurrent access to a resource could lead to a race condition
* You need to prevent two threads accessing a critical section at the same time
* Concurrent access to a resource could lead to a race condition
## Credits