Abstract

In recent years, concurrent programming has become the norm rather than the exception in many applications. In particular, popularity of the Java programming language has accelerated this trend. Most textbooks on Operating Systems and concurrent programming teach concurrent programming by demonstrating solutions for some well-known problems, such as the producer/consumer, readers/writers, and dining philosophers problems. A more systematic and formal approach to develop concurrent programs is presented in [1, 2]. In this approach, for a given problem, we first specify a global invariant that implies the safety property. Then, we develop a so-called coarse-grained solution using the two synchronization constructs: and . Using Programming Logic, the global invariant is formally verified in the coarse-grained solution. Finally, the coarse-grained solution is mechanically translated to a fine-grained semaphore or monitor program that maintains the global invariant. This approach has many advantages. First, this is a formal approach that enables verification of programs being developed. Second, the most important activity in the programming process lies at a high level; namely, specifying global invariants. Once an appropriate global invariant is specified, much of the rest of the process is mechanical. Furthermore, global invariants and coarsegrained solutions are platform (synchronization primitive) independent. Thus, if the platform is switched from a semaphore-based to a monitor-based system, we only need to translate the existing coarse-grained solution to a monitor-based fine-grained program. The Java programming language encourages the use of multiple threads. Therefore, as Java’s popularity grows, concurrent programming using Java synchronization primitives will become more important. Java provides monitor-like synchronization primitives. However, these primitives have limitations. Each Java monitor object can only have one condition variable, which is associated with the object itself; all waits and signals (called notify in Java) refer to it. The translation

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call