11.07.2015 Views

Principper for Samtidighed og Styresystemer - Processer og Tråde

Principper for Samtidighed og Styresystemer - Processer og Tråde

Principper for Samtidighed og Styresystemer - Processer og Tråde

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Hardwareunderstøttelse: Test and SetExampleint mutex = 0;thread P0 { thread P1 {while(test_and_set(mutex)==1) while(test_and_set(mutex)==1){ } { }/* kritisk region */ /* kritisk region */mutex = 0; mutex = 0;} }test and set findes ofte som en atomisk processorinstruktionBusy waitingPSS2011 (Forelæsning 03) <strong>Processer</strong> <strong>og</strong> Tråde Feb 2011 16 / 19

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

Saved successfully!

Ooh no, something went wrong!