Prove scritte 2011

From Sistemi Operativi
Revision as of 09:08, 30 August 2020 by Acsor (talk | contribs) (Created page with "== Esame 11/05/2011 == [http://www.cs.unibo.it/~renzo/so/compiti/2011-05-11.con.pdf 2011-05-11.con.pdf] === Esercizio 2 (da controllare) === <source lang="c"> stack s; semapho...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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();
}