Prove scritte 2011

From Sistemi Operativi
Jump to navigation Jump to search

Esame 11/05/2011

2011-05-11.con.pdf

Esercizio 2 (da controllare)

stack s;
semaphore mutex(1);

lifocs_enter()
{
    s.push(getpid());
    mutex.p();
    while(s.lastElement() != getpid())
    {
        mutex.v();
        mutex.p();
    }
    s.pop();
}

lifocs_exit()
{
    mutex.v();
}