This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process puestos[i=0..9] | |
{ | |
FILA.desencolar(id) | |
while(id <> -1) | |
{ | |
HINCHA[id].atender(i); | |
PUESTO[i].atender(); | |
FILA.desencolar(id); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Monitor SALA; | |
{ | |
int cant = 0; domidos = 0; | |
Cond espera; | |
procedure usar | |
{ | |
if(cant == 1) { | |
dormidos++: | |
wait(espera); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cola int espera; | |
Sem cola = 1; | |
Sem maq_libre = 1; | |
Sem colaInv[0..9] = 0; | |
process investigador[0..99] | |
{ | |
P(cola); | |
espera.push(i); //me pongo en espera | |
V(cola); | |
P(maq_libre); //si la maquina esta libre |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sem mutex = 1; int bolsas = 0; | |
process voluntario [0..4] | |
{ | |
P(mutex) //espero a poder acceder a bolsa | |
while(bolsas < 1000) | |
{ | |
bolsas++ | |
V(mutex) //libero bolsa | |
lleno_bolsa() | |
P(mutex) //espero a que se libere bolsa para la vuelta del loop |