Strong semaphore discipline and hunger

In William Stallings' book Operating Systems, he defines a strong semaphore as one that has discipline in the FIFO queue, and a weak semaphore that is disordered. Of course, there are other lines for strong semaphores, for example, by priority? Or will it not be a strong semaphore anymore, since hunger will become possible? (Stallings says strong semaphores do not allow starvation.) Is the main difference between strong and weak ordered / disordered, or is fasting possible / impossible?

+5
source share
3 answers

When it comes to semaphore literature, I have never seen (with my limited knowledge) those using FIFO or some form of order as criteria for weak / strong classification. In fact, freedom of hunger is also not always a criterion. The original literature (due to Morris ('79), Martin and J. R. Burch ('85), Uding ('86), Friedberg and Peterson ('87) and Haldar and Subramanian ('88) used certain characteristics of 'P and 'vto identify a weak semaphore. Interestingly, all definitions from the cited researchers ultimately suggest a possible hunger in the case of weak semaphores. In addition, although FIFO guarantees freedom of fasting, referring to the term FIFO or some form of order, in my opinion, limits the behavior of the semaphore. One form of restriction may be that, for example, the FIFO order will mean that the semaphore has some kind of buffer attached to it in order to keep track of blocked processes / threads in operation "P, For the hardware implementation of semaphores, this definition may be too restrictive. Another form of restriction may be that instead of considering all possible ordering schemes with the same limited overtaking by k (i.e., no process will be overtaken more than k times), one could consider each scheme as one kind of semaphore. So my personal opinion is to define a weak semaphore as one that DOES NOT guarantee freedom of hunger (but guarantees freedom from blocking). However, if you are even deeper involved in research, then, in any case, do not hesitate to use more mathematical or / or fine-grained definitions at your discretion.

+1
source

, -FIFO ( ) , . , 1, 2, 3, 4, 1 , 4, 3 , 3. P , P, P.

" " Google " " "FIFO". "" - - ( , ), , , , .

+3

I think that there is no starvation with a priority queue with a predefined priority for the elements of the queue. As you can see, this is just the next queue, except that the next item has the highest priority. Therefore, if you implement priorities with the FIFO logic (the first has the highest priority), there will be no starvation. Otherwise, it can cause hunger.

0
source

All Articles