Created
May 5, 2017 02:16
-
-
Save lsartori94/ed8247b02304fbe41bd400b1cb81c0d6 to your computer and use it in GitHub Desktop.
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 | |
} | |
V(mutex) //libero bolsa antes de irme para que el proximo pueda evaluar el loop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment