UP | HOME
2016-09-06 | ../../

Semaphores

1 Semapahores

  1. Def: An ADT, with P, V operations on integers, and atomicity and await
  2. ./semaphoreSemantics.html

2 Split Binary Semaphores

2.1 Def

  1. Consider a binary semaphore b.
  2. Imagine "splitting" it into multiple binary semaphores such that
    1. sum-of b = {b1 + b2 + … + bn}, at all times

2.2 Uses

  1. Starvation-Free Mutex
  2. Passing the Baton Technique (cf. Readers-Writers)

3 Starvation-Free Mutex Semaphore

  1. The std solution is not starvation-free.
  2. Fairness: "Weak v Strong" semaphores.
  3. ./split-binary-semaphores.html
  4. ./udding-morris-algs.html

4 Distributed Semaphores

  1. Implement semaphores in the distributed context: strictly peer-to-peer
  2. Where is "the" "queue" of processes waiting to finish P(m) located?
  3. Andrews Algorithm: ./semaphore-distributed.html
  4. Many "better" algorithms now exist.
  5. Most distributed implementations are "suspect".

5 The Power of semaphores

  1. Semaphore Ops: P and V.
  2. Will we improve the "power" of Semaphores with additional ops?

5.1 Add Peek and Pp?

  1. peek(s) defined as "return <s > 0>"
  2. Pp(s) defined as
    function Pp(s): boolean
      if <s > 0> -> <s := s - 1>; return True
      [] <s < 0> -> return False
      fi
    end
    
  3. Would either of the two ops add "power" to the semaphore?

5.2 Cigarette Smokers Problem

  1. What problems of concurrency can semaphores solve?
  2. Introduces an array of semaphores.
  3. Cigarette Smokers Problem cannot be solved without arrays.
  4. Cigarette Smokers Problem

6 References

  1. Allen B. Downey, The Little Book of Semaphores, book, 290+ pp, 2016. Free pdf, http://greenteapress.com/wp/semaphores/.
  1. Leslie Lamport, title = {The Mutual Exclusion Problem - Part I: A Theory of Interprocess Communication}, year = {2000} http://research.microsoft.com/users/lamport/pubs/mutual1.pdf
  2. author = {L. Lamport}, title = {The Mutual Exclusion Problem - Part II: Statement and Solutions}, year = {2000} http://research.microsoft.com/users/lamport/pubs/mutual2.pdf
  1. Vlad Popov and Oleg Mazonka, Faster Fair Solution for the Reader-Writer Problem, 2013. http://arxiv.org/pdf/1309.4507.pdf

7 End


Copyright © 2016 • www.wright.edu/~pmateti • 2016-09-06