Semaphores: where can I learn about basic concepts such as permissions, justice, barges, etc.

An overview of the Semaphore class on developer.android.com looks good - for those who are already familiar with the concepts and terminology.

I am familiar with some abbreviations and other jargon (e.g. FIFO, lock, etc.), but others, such as permits , fairness and barging , are new to me.

Can you recommend a good online source to explain these concepts? (Probably, I can find out what permissions and justice are, but barging is still unknown).

EDIT: after getting two answers below, I realized that I need to update the semaphores (for re-purchase () terminology). I found the following resources useful:

+6
source share
3 answers

I didn’t come across this myself, but I thought that I would investigate and summarize my conclusions, as it is better to answer direct answers than external links (although, yes, read the OP after the recommendation):

allows the number of concurrent permissions allowed for semaphore protected code. Although semaphores are often simple mutex, it is sometimes desirable to have more than one touch of code. This is like a call to a call center, where one phone number is connected to 8 lines / operators.

justice - this is when the semaphore becomes available to the requesting persons in the strict order of the one who asked first. Remaining with the call center analogy, this means that the waiting queue is in strict FIFO.

barging is essentially an out-of-band request that puts the stream at the top of the queue for the semaphore. The analogy is that preferred clients (or internal calls) go to the top of the call center queue rather than waiting in line.

If neither justice nor barging is indicated , then it is in the specification to provide access to the most recent request, depending on the context switching time. β€œA telephone analogy is a call to a company’s switch / receiver, where even if calls are waiting to be answered, you may get lucky and make calls between one end of the call and the other is disarmed.

Let me know through the comments if I am wrong and I will correct / cw my answer.

+1
source

Source: https://habr.com/ru/post/887035/


All Articles