22.11.2014 Views

Tema 3: MONITORES - Departamento de Lenguajes y Sistemas ...

Tema 3: MONITORES - Departamento de Lenguajes y Sistemas ...

Tema 3: MONITORES - Departamento de Lenguajes y Sistemas ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2. Sincronización en Monitores<br />

2.3. Equivalencia entre semáforos y monitores (cont.)<br />

Propuesta <strong>de</strong> Hoare:<br />

– Semáforo urgente (inic. a 0) para cola <strong>de</strong> bloqueados en Signal<br />

– Contador procs. esperando en urgente (conturgente, inic. a 0).<br />

• Procesos que invocan un signal ejecutan:<br />

if (existen procs. bloqueados en wait) { conturgente ++;<br />

P(urgente) }<br />

• Para liberar procs. bloqueados en signal, antes <strong>de</strong> liberar la<br />

exclusión mútua, cada proceso ejecuta:<br />

if conturgente>0 V(urgente)<br />

else V(mutex);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!