28.11.2014 Views

System call - Processi, thread

System call - Processi, thread

System call - Processi, thread

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LinuxThreads: MUTEX<br />

• Lo standard POSIX 1003.1c (libreria )<br />

definisce i semafori binari (o lock, mutex, etc.)<br />

• sono semafori il cui valore puo` essere 0 oppure 1 (occupato o<br />

libero);<br />

• vengono utilizzati tipicamente per risolvere problemi di mutua<br />

esclusione<br />

• operazioni fondamentali:<br />

• inizializzazione: p<strong>thread</strong>_mutex_init<br />

• locking: p<strong>thread</strong>_mutex_lock<br />

• unlocking: p<strong>thread</strong>_mutex_unlock<br />

• Per operare sui mutex:<br />

p<strong>thread</strong>_mutex_t : tipo di dato associato al mutex; esempio:<br />

p<strong>thread</strong>_mutex_t mux;<br />

M-fosset - Sistemi Operativi 2004-2005

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

Saved successfully!

Ooh no, something went wrong!