Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I wouldn't say that resource starvation is a special case of a livelock. Usually:</p> <ul> <li><p>In a livelock, no thread makes progress but they keep executing. (In a deadlock, they don't even keep executing)</p></li> <li><p>When starving, some thread(s) DO make progress and some thread(s) aren't executing.</p></li> </ul> <p>A good explanation: <a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/starvelive.html" rel="noreferrer">http://docs.oracle.com/javase/tutorial/essential/concurrency/starvelive.html</a>. But I understand the choice of terminology may vary.</p> <p>When it comes to starvation, the definition I heard is:</p> <p>Suppose it is possible to specify an infinite path of execution (interlace) consistent with assumptions (semaphore semantics, OS scheduler behaviour...) such that thread T is suspended waiting for some resource and never resumed, even if it was possible infinitely many times. Then T is called starving.</p> <p>But the practice doesn't match that. Suppose two threads execute critial section in an infinite loop. Your synchronization code allows the first thread to enter the critial section once per hour. Is it starvation? Both threads are allowed to progress, but the first one is doing its work painfully slowly.</p> <p>The simplest source of starvation are weak semaphores. If you are using a synchronization primitive (or building your own) that behaves similarly, then starvation will result.</p> <p>Classical problems where starvation is well known:</p> <ul> <li><p>Readers-writers problem. It is possible to synchronize the threads such that (1) the readers will be able to starve the writers (2) the writers will be able to starve the readers (3) no starvation will occur (See <a href="http://en.wikipedia.org/wiki/Readers-writers_problem" rel="noreferrer">http://en.wikipedia.org/wiki/Readers-writers_problem</a>)</p></li> <li><p>Dining philosophers (<a href="http://en.wikipedia.org/wiki/Dining_philosophers_problem" rel="noreferrer">http://en.wikipedia.org/wiki/Dining_philosophers_problem</a>)</p></li> </ul> <p>For more details, I wholeheartedly recommend The Little Book of Semaphores (free): <a href="http://www.greenteapress.com/semaphores/" rel="noreferrer">http://www.greenteapress.com/semaphores/</a>.</p> <p>You are asking if every starvation is caused by waiting for some resource. I'd say - yes.</p> <p>A thread can be suspended:</p> <p>(1) on some blocking system call - waiting on/acquiring a mutex, semaphore, conditional variable; write(), poll() etc.</p> <p>(2) on some nonblocking operation - like performing computations.</p> <p>Starving on (1) is starving on resources (mutexes, buffer etc.).</p> <p>Starving on (2) is starving on CPU - you can regard it as a resource. If it happens, the problem is with scheduler.</p> <p>HTH</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload