776 views
1 votes
1 votes

I am confused with what exactly Starvation mean ?

AFAIK Considering Process Scheduling eg SRTF and SJF , Starvation can be considered when some process is getting preempted by other high priority processes and hence not getting a chance to execute on CPU and hence is said to be "starving".

But, Considering Synchronization  eg TEST_AND_SET Lock ,

(1) TSL Ri,m[flag]

(2)CMP Ri,0

(3) JNZ to (1)

(4) **CS**

(5) Store m[flag],0

here also we say that starvation is there in the sense that ,

Suppose, Process P1 comes executes (1) to (3) and enters CS

Now, Processes P2,P3,P4,P5 comes and since flag=1 they loop in statements (1) to (3),

Now , P1 comes out of CS and sets flag=0, Now, Out of P2,P3,P4,P5  any one can go into CS first .

If the same scenario continues we could say any of P2,P3,P4,P5  may starve in the sense they never get access to CS but they obviously are executing on CPU.

Here, my confusion lies,

Starvation is w.r.t to getting executing on CPU or getting access to CS ?

PS: I have one more doubt , in synchronization ques , while solving do we consider a Single processor system or a Multiprocessor i.e. when we have multiple processing cores or CPUs available?

1 Answer

0 votes
0 votes

here  Processes P2,P3,P4,P5 comes ..but you can observe that they are not doing any useful WORK..

means yes they get CPU cycles..but what they are executing (checking flag)...is not a part of their program...

infact they are spending time to get CS...and CS contain such data which process want for their work....

so YES even they get the CPU cycles ..these cycles are used  to get access to the CS....

so starvation is in terms of CS...

in short they are not entering in CS...means not getting access to shared data ...logically they are STUCK..

(we generally assume only single processor) 

Related questions

1.0k
views
2 answers
1 votes
sumit chakraborty asked Nov 26, 2017
1,044 views
Given Processes P1: Wait(Sx); Wait(Sy); Do something;Signal(Sx); Signal(Sy); and Process P2: Wait(Sx); Wait(Sy); Do something;Signal(Sy); Signal(Sx); . Will it ever lead to starvation ?
355
views
0 answers
0 votes
admin asked Oct 30, 2019
355 views
Repeat the previous problem, but now avoid starvation. When a baboon that wants to cross to the east arrives at the rope and finds baboons crossing to the west ... are allowed to start until at least one baboon has crossed the other way.
239
views
0 answers
0 votes
vijju532 asked Dec 14, 2018
239 views
I HAVE ONE DOUBT REGARDING THE STARVATION AND BOUNDED WAITING BOUNDED WAITING → ~STARVATION THEN USING THE CONCEPT OF CONTRAPOSITIVE IT CAN BE STARVATION → ~BOUNDED WAITING CAN THIS CONCEPT IS APPLICABLE HERE ?
361
views
1 answers
0 votes
jaydip74 asked Jan 28
361 views
How much time is required to load a 64 KB program from a disk with an average seek time of 30 ms, a rotation time of 20 ms per rotation, a track size of ... pages are spread randomly around the disk.A. 1200 msB. 1300 msC. 1320 msD. 1400 ms