Teaching predicates and invariants on shared data structures in concurrent programming

  • Authors:
  • Stein Gjessing;Arne Maus

  • Affiliations:
  • University of Oslo;University of Oslo

  • Venue:
  • Proceedings of the 2012 workshop on Developing competency in parallelism: techniques for education and training
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

In concurrent programing, threads may communicate via data structures that can be embedded in shared objects or monitors. In this paper we outline the basis for a short module that can be used to teach better programming of such monitors by emphasizing logical statements, called predicates, on the data structures inside these shared objects. We base the module on the general concepts of object oriented programming, where the (usually) private data structure is manipulated by public methods, and where an invariant predicate holds before an after the execution of each method. An important challenge when writing a monitor is to program correct synchronization, and the main contribution of this paper is to show how to teach the students to use predicates to reason about, and make code that performs correct waiting and signaling inside monitors. It is also important to teach students to select the most appropriate synchronizing tool.