3
$\begingroup$

So first off do the modern operating systems like windows and linux have a method for detecting starvation? if not, why? and if they do, then how are they going to detect starvation of a process? (this was a question in our exam)

my take was this so correct me if this is not good or not possible:

i said we should implement a linked list of waiting processes (that are waiting for a resource or etc) then we periodically run a function(using interrupts) which checks this list and we have a variable for each process and we increase that everytime, when it reaches certain point then we would know its starving(but i still dont know how to know this "certain point")

so is this correct? if so then how can we know this "certain point"? ( I suppose one way is just look at the statistic of average waiting time of processes and do a little math?)

if not, what is your solution?

$\endgroup$
  • $\begingroup$ In the general case, I don't think we can detect we have reached the "certain point" and know there is starvation. You can detect deadlocks, sure. But if processes are still running there's always the chance they release their resources so to make other processes progress, and avoid their starvation. $\endgroup$ – chi Jul 25 '18 at 12:32
  • $\begingroup$ A possible solution OS like windows 10,use a scheduling algorithm with priority queue that also uses the aging technique. Aging is a technique of gradually increasing the priority of processes that wait in the system for a long time.And this has been improving due to the effectiveness and efficiency of concurrency control updates. $\endgroup$ – quintumnia Jul 26 '18 at 3:56
  • $\begingroup$ @quintumnia but how is this aging implemented? how do operating systems increase the age of a processes ? lets say we have n processes in the waiting queue, waiting for some resource to be free, how do we age them? $\endgroup$ – John P Jul 26 '18 at 5:38
  • $\begingroup$ @chi so how the modern Operating systems detect starvations? $\endgroup$ – John P Jul 26 '18 at 7:24
  • 1
    $\begingroup$ @chi so if in an exam they asked me how can we implement a way to detect if there is a process which is starving, what should i say? $\endgroup$ – John P Jul 26 '18 at 10:46
-1
$\begingroup$

Inline with @chi 's comment; lets say process "x" gets starved in linux or windows, then for example if we are in the windows, wouldn't we get an error message saying the process "x" is not responding? Approximately no.

Now let's assume we want to detect process "x",before starvation nor aging;we have to read it's arrival time, burst time,process id, priority from the text file and calculate the average waiting time and show the central processing unit utilization of each cycle,for instance;

Time 1 process X arrives

Time 2 process X runs

Time 3 process B arrives

Time 4 process X finishes..........,randomly.

Hope this can give you a little bit of insight.

$\endgroup$
  • $\begingroup$ But in the real life scenario we won't know the burst time of a process because we won't know how much time its going to need, and we also don't know how long its gonna wait in queue, so how are we gonna calculate the average waiting time? $\endgroup$ – John P Jul 26 '18 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.