03.05.2013 Views

Concurrency en race condities

Concurrency en race condities

Concurrency en race condities

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

HW ondersteuning: Test-and-set instructie<br />

Atomaire machine instructie (ook op SMP)<br />

TAS address<br />

– reserveert bus,<br />

leest van address,<br />

zet status bit voor nul/niet nul,<br />

schrijft 1 naar address,<br />

geeft bus vrij<br />

– Werkt ook op shared-memory multi-processor<br />

system<strong>en</strong><br />

– Gebruik (pseudo-assembler):<br />

try_address: TAS address<br />

BNZ try_address # branch if not zero<br />

critical section # if (*address == 0)<br />

CLR address # clear address<br />

College OS 2010 – 2011 18

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

Saved successfully!

Ooh no, something went wrong!