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.4.3. Implementación con semáforos <strong>de</strong>l productor/consumidor<br />

procedure productor;<br />

var v: integer;<br />

{while (true) {producir(v); añadir(v)}<br />

procedure consumidor;<br />

var v:integer;<br />

{while (true) {tomar(v); consumir(v)}<br />

{in =out=n = 0; s = 1;<br />

contnolleno = semnolleno = 0;<br />

contnovacio = semnovacio = 0;<br />

cobegin<br />

productor;<br />

consumidor;<br />

coend;}

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

Saved successfully!

Ooh no, something went wrong!