in Operating System
351 views
2 votes
2 votes

Consider this implementation of semaphores b/w these $2$ processes :
PROCESS-1 :

V(s)

CS

P(S)

PROCESS-2:

P(s)

CS

V(S)

Assume that semaphore "s" is intialized to $0$ at initial stage .
Comment on these statments :

  • Process -$1$ can starve$.$
  • Process=$2$ can starve$.$
in Operating System
351 views

4 Comments

But P1 is already in CS ? Since it can't come out of it, that's why it is starvation?
0
0
Yes ! for subsequent computation it cannot access the resource.here CS i missed that point.
0
0
There is no starvation in process 1 and process 2
0
0

1 Answer

2 votes
2 votes
both processes can starve.

initially S=0, process P1 can only start the execution.

Process P1 can execute again and again without giving a chance to process P2. So P2 can starve.

Process P1 starts the execution, P1 preempts, P2 starts its execution, now P2 can keep on running without giving a chance to P1, hence P1 can also starve.