Computer Architecture
Computer Architecture
Computer Architecture
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Mutual Exclusion<br />
Proposals for achieving mutual exclusion (continued)<br />
• Test and Set Lock (TSL)<br />
Atomic operation at machine level. Cannot be interrupted. TSL reads the content of the<br />
memory word lock into register R and then stores a nonzero value at the memory<br />
address lock. The memory bus is locked, no other process(or) can access lock.<br />
enter_region: TSL R, lock<br />
CMP R, #0<br />
JNZ enter_region<br />
RET<br />
leave_region: MOV lock, #0<br />
RET<br />
indivisible operation<br />
Pseudo assembler listing providing the functions enter_region() and leave_region().<br />
<strong>Computer</strong> <strong>Architecture</strong> WS 06/07 Dr.-Ing. Stefan Freinatis<br />
IPC<br />
CPU must support TSL<br />
Busy waiting