13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Mechanisms 2631 activity A:2 perform A’s work;3 Finishing(A);45 activity B:6 WaitFor(A);7 perform B’s work;8 Finishing(B);910 activity E:11 WaitFor(B);12 WaitFor(D);13 perform E’s work;14 Finishing(E);Even though both Finishing and WaitFor use the Done array, we don’t have to worryabout simultaneous access, since only one activity will ever call Finishing to modify anyparticular value in that array. Other activities may call WaitFor, but they only inspect thearray.If we treat each row in the graph as a separate activity, some of the explicit calls toWaitFor and Finishing are no longer needed:1 activity ABC:2 perform A’s work;3 Finishing(A);4 perform B’s work;5 Finishing(B);6 perform C’s work;7 Finishing(C);89 activity DEF:10 WaitFor(A);11 perform D’s work;12 Finishing(D);13 WaitFor(B);14 perform E’s work;15 Finishing(E);16 WaitFor(C);17 perform F’s work;18 Finishing(F);1920 activity GHI:21 WaitFor(D);22 perform G’s work;23 WaitFor(E);24 perform H’s work;25 WaitFor(F);26 perform I’s work;2.3 Switch variableA more liberal store-synchronous mechanism for ensuring mutual exclusion between twoactivities is for them to share a new variable called a switch. This variable lets either oneor the other enter its region. We depend on the synchronization atomicity of main store

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

Saved successfully!

Ooh no, something went wrong!