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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2. Sincronización en Monitores<br />

2.1.4. Colas <strong>de</strong> condición con prioridad (cont.)<br />

Ejemplo: Asignación recurso "siguiente trabajo el más corto".<br />

monitor asignador;<br />

var libre: boolean; turno: condicion;<br />

procedure petición (tiempo: integer);<br />

{if not libre then turno.wait (tiempo); libre:=false;}<br />

procedure liberar;<br />

{libre := true; turno.signal;}<br />

begin<br />

libre:= true;<br />

end;

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

Saved successfully!

Ooh no, something went wrong!