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.1. Primitivas <strong>de</strong> sincronización en monitores (cont.)<br />

• Ejemplo <strong>de</strong> monitor: Planificador <strong>de</strong> un único recurso (sem. binario)<br />

monitor recurso;<br />

var ocupado: boolean;<br />

noocupado: condicion;<br />

procedure adquirir;<br />

{if ocupado then noocupado.wait; ocupado := true}<br />

procedure liberar;<br />

{ocupado := false; noocupado.signal;}<br />

begin<br />

ocupado := false /* valor inicial*/<br />

end;

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

Saved successfully!

Ooh no, something went wrong!