Lock / Mutex / Semaphore
Last updated
What is Lock / Mutex / Semaphore?
A lock allows only one thread to enter the part that's locked and the lock is not shared with any other processes.
A mutex is the same as a lock but it can be system wide (shared by multiple processes).
A semaphore does the same as a mutex but allows x number of threads to enter, this can be used for example to limit the number of cpu, io or ram intensive tasks running at the same time.
Free resources to learn Lock / Mutex / Semaphore
More in stage 22: Processes and Threads
Lock / Mutex / Semaphore: common questions
Can I learn Lock / Mutex / Semaphore in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Lock / Mutex / Semaphore in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Lock / Mutex / Semaphore tutorial for beginners?
It is lesson 184 of 188 in the free Computer Science roadmap, in stage 22, Processes and Threads. If you are new to Computer Science, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.