02.03.2014 Views

SO-mod 3-Procesos - Facultad de Ingeniería - Universidad Nacional ...

SO-mod 3-Procesos - Facultad de Ingeniería - Universidad Nacional ...

SO-mod 3-Procesos - Facultad de Ingeniería - Universidad Nacional ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Problema <strong>de</strong>l Productor-Consumidor<br />

Paradigma procesos cooperativos, el proceso<br />

productor produce información que es<br />

consumida por un proceso consumidor .<br />

buffer ilimitado - no tiene límites prácticos en<br />

el tamaño <strong>de</strong>l buffer.<br />

buffer limitado supone que hay un tamaño fijo<br />

<strong>de</strong> buffer.<br />

JRA © 2008<br />

Sistemas Operativos – <strong>Procesos</strong><br />

Buffer limitado – Solución con memoria compartida<br />

<br />

<br />

Datos compartidos<br />

var n;<br />

type item = … ;<br />

var buffer. array [0..n–1] of item;<br />

in, out: 0..n–1;<br />

Proceso Productor<br />

repeat<br />

…<br />

produce un item en nextp<br />

…<br />

while in+1 <strong>mod</strong> n = out do no-op;<br />

buffer [in] :=nextp;<br />

in :=in+1 <strong>mod</strong> n;<br />

until false;<br />

JRA © 2008<br />

Sistemas Operativos – <strong>Procesos</strong>

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

Saved successfully!

Ooh no, something went wrong!