AryaKesharwani / os

srm 4th year os course repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

what is semaphore??

In computer science, a semaphore is a synchronization tool used for interprocess communication (IPC) and mutual exclusion (mutex) to control access to a shared resource, such as a shared memory buffer, between multiple threads or processes.

A semaphore is essentially a counter that is shared among the threads or processes, and it can be used to signal when a resource is available or unavailable. Semaphores can have two types: binary and counting.

A binary semaphore is used for mutual exclusion, where the value of the semaphore can only be 0 or 1. It is used to restrict access to a shared resource to only one thread or process at a time.

A counting semaphore, on the other hand, can have any positive integer value and is used to control access to a shared resource that can be used by multiple threads or processes at the same time, but with a limit to the number of concurrent accesses.

Semaphores are often used in operating systems, multi-threaded applications, and real-time systems where synchronization is critical to prevent race conditions and ensure correct operation.

SYSTEM V semaphore

About

srm 4th year os course repo


Languages

Language:C 73.7%Language:Shell 26.3%