22 What is a semaphore
-
1 A mechanism to share non-sharable resources
-
2 A mechanism to access memory very fast
-
3 A mechanism to access kernel details
-
4 None
A semaphore is a synchronization mechanism used to control access to shared, non-sharable resources in concurrent systems. It maintains a counter and uses wait (P) and signal (V) operations to coordinate process access, preventing race conditions. It is not related to fast memory access or kernel details.
A semaphore is a synchronization primitive used to control access to a resource that can't safely be used by multiple processes/threads simultaneously (a non-sharable resource), by tracking how many 'permits' are available and blocking requesters when none remain. It's not about speeding up memory access or exposing kernel internals — those aren't what semaphores are designed for.