[so] [Tema 4]Test3
Stefan Munteanu
stef8803 at gmail.com
Fri May 6 21:50:54 EEST 2011
2011/5/6 VLAD TUDOSE <vlad_tudose at yahoo.com>:
>
> Thread 1: Enter, Wait(1), sleep(1), ...
> Thread 2: Enter, Wait(0), sleep(1), ...
> Thread 3: sleep(1), Enter, sleep(2), Signal(1)...
> Thread 4: sleep(2), Enter, sleep(1), ...
>
> Thread-ul 3 iese din sleep face Signal(1) -> trece Thread-ul 1 in coada Waiting dupa care asteapta
> in coada Signaler.
Dupa ce cedezi monitorul trebuie sa planifici pe cineva (daca avem
threaduri in coada de asteptare). Atat threadul 1, cat si threadul 3
pot fi planificate, dar coada de Wait este prioritara in detrimentul
cozii Signal => vei planifica threadul 1
Stefan
More information about the so
mailing list