Concurrency en race condities
Concurrency en race condities
Concurrency en race condities
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Maak e<strong>en</strong> tell<strong>en</strong>de semafoor met binaire<br />
(oplossing is niet goed - waarom?)<br />
class countingSemaphore<br />
{<br />
procedure Wait();<br />
begin<br />
mutex.WaitB();<br />
s = s - 1;<br />
if s < 0 th<strong>en</strong> begin<br />
mutex.SignalB();<br />
delay.WaitB()<br />
<strong>en</strong>d<br />
else<br />
mutex.SignalB()<br />
<strong>en</strong>d;<br />
procedure Signal();<br />
begin<br />
mutex.WaitB();<br />
s = s + 1;<br />
if s