Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strong Semaphore Queuing Discipline and Starvation

In William Stallings' book on Operating Systems, he defines a strong semaphore as one that has a FIFO queuing discipline, and a weak semaphore one that is unordered. Surely there are other queuing disciplines for strong semaphores, such as by priority? Or would this no longer be a strong semaphore, since starvation would become possible? (Stallings says that strong semaphores do not allow for starvation.) Is the primary distinction between strong and weak ordered/unordered, or starvation possible/impossible?

like image 244
Keith Pinson Avatar asked Oct 10 '22 13:10

Keith Pinson


1 Answers

Yes, one non-FIFO non-starving possibility (among many) is to select the next process in a round-robin manner. For example, if the order is 1, 2, 3, 4, and while 1 is holding the semaphore, 4 and then 3 request it, then the next process up is 3. No process P starves because, after each request of P, each other process has at most one critical section before P's request is granted.

Definitions of "strong semaphore" in the first pages of hits from Google are split between "no starvation" and "FIFO". Which one is "right" is a matter of taste – given this mess (and the general overuse of strong as an adjective in mathematical writing), I'd probably use neither.

like image 189
red dolphin Avatar answered Oct 13 '22 12:10

red dolphin