Semaphores

0.0(0)
Studied by 1 person
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:49 PM on 10/26/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

8 Terms

1
New cards

What is a semaphore in operating systems?

A semaphore is an integer variable used to synchronize processes by controlling access to shared resources.It can be either counting or binary, allowing for signaling between processes to prevent race conditions.


2
New cards

What does P(S) do?

It decrements S. If S ≤ 0, the calling process is blocked until S becomes positive

3
New cards

What does V(S) do?

it increments S and if there is a blocked processes, wake one up.

4
New cards

Why must P(S) and V(S) be executed atomically?

To avoid race conditions

5
New cards

What happens if multiple processes call P(S) while S ≤ 0?

The processes are blocked until a ‘v(s)‘ operation is called

6
New cards

What happens when V(S) is called while processes are waiting?

only one blocked process becomes unlocked and the others remains blocked

7
New cards

What happens if V(S) is called before P(S)?

S is gonna be incremented and When P(S) is called it will not block

8
New cards

What if the semaphore is initialized to S = 5?

up to 5 processes can enter the cs