Skip to Main Content
Operating Systems: Concurrent and Distributed Software Design
book

Operating Systems: Concurrent and Distributed Software Design

by Jean Bacon, Tim Harris
March 2003
Intermediate to advanced content levelIntermediate to advanced
912 pages
27h 17m
English
Pearson Business
Content preview from Operating Systems: Concurrent and Distributed Software Design

12.1. Critical regions in programming languages

We discussed earlier the general concept of the critical region, as that section of code where shared data is accessed. Here we show a possible implementation of the concept. A critical region construct requires syntax such as the following to be added to the high-level language:

  • declaring a data type to be shared, such as:

    shared DataType someSharedData 
    
  • a region declaration such as:

    region (someSharedData) { ....} 
    

For each shared data declaration the compiler could create a semaphore, for example crSem. Then, at the start of any critical region construct for that data it could insert a crSem.semWait() operation and a crSem.semSignal() at the end. If the Java syntax included this facility, it would ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Principles of Concurrent and Distributed Programming, Second Edition

Principles of Concurrent and Distributed Programming, Second Edition

M. Ben-Ari
Operating Systems in Depth

Operating Systems in Depth

Thomas W. Doeppner

Publisher Resources

ISBN: 0321117891Purchase book