211 Formal Modeling of Synchronization Methods for Formal Modeling of Synchronization Methods for Concurrent Objects in Concurrent Objects in Ada 95 Ada 95 Ravi K. Gedela Dept. of EECS Concurrent Software Lab The University of Illinois at Chicago Tel: +1-303-473-6722 R.Gedela@ericsson.com Sol M. Shatz Dept. of EECS Concurrent Software Lab The University of Illinois at Chicago Tel: +1-312-996-5488 shatz@eecs.uic.edu Haiping Xu Dept. of EECS Concurrent Software Lab The University of Illinois at Chicago Tel: +1-312-666-8588 hxu1@eecs.uic.edu 1. 1. ABSTRACT ABSTRACT One important role for One important role for Ada programming is Ada programming is to aid engineering of concurrent and to aid engineering of concurrent and distributed software. In a concurrent and distributed software. In a concurrent and distributed environment, objects may distributed environment, objects may execute concurrently and need to be execute concurrently and need to be synchronized to serve a common goal. Three synchronized to serve a common goal. Three basic methods by which objects in a basic methods by which objects in a concurrent environment can be constructed concurrent environment can be constructed and synchronized have been identified [1]. and synchronized have been identified [1]. To formalize the semantics of these methods To formalize the semantics of these methods and to provide a formal model of their core and to provide a formal model of their core behavior, we provide some graphic models behavior, we provide some graphic models based on the based on the Petri net formalism. The Petri net formalism. The purpose of this formal modeling is to purpose of this formal modeling is to illustrate the possibility of automatic illustrate the possibility of automatic program analysis for object-oriented program analysis for object-oriented features in Ada-95. Models for the three features in Ada-95. Models for the three distributed-object synchronization methods distributed-object synchronization methods are discussed, and a potential deadlock are discussed, and a potential deadlock situation for one of the methods/models is situation for one of the methods/models is illustrated. We conclude with some illustrated. We conclude with some comparison of the three methods in terms of comparison of the three methods in terms of the model abstractions. the model abstractions. 1.1 1.1 Keywords Keywords Ada-95, concurrent objects, distributed software, synchronization methods, Petri net formalism 2. 2. INTRODUCTION INTRODUCTION With the growing interest in concurrent and distributed computing applications, there is significant value in new capabilities to support the engineering of distributed software. One of the principle objectives of concurrent and distributed programming is to coordinate the behavior of concurrent tasks. This is aided by using object-oriented techniques in combination with concurrent programming. The resultant software systems consist of objects that execute concurrently and need to be synchronized to serve a common goal. There might be situations where access to an object is required by more than one other object or task. In such cases, it is vital to enforce synchronization. For example, consider a printer as an object. The services of this printer object (server) might be required by multiple tasks (clients). This would require synchronization among the client tasks so that only one task at a time can gain access to the printer object. There are many such practical situations where synchronization is very important. Thus, synchronization among tasks accessing an object is a critical issue. In the specific context of Ada-95 [2], Burns and Wellings have identified three methods to introduce synchronization among objects in a concurrent environment [1]. These methods are listed as follows: 1. Synchronization is added if and when it is required, by extending the object. 2. Synchronization is provided by the base (root) object type. 3. Synchronization is provided as a separate protected type and the data is passed as a discriminant. Unfortunately, these methods can be difficult to understand due to the lack of an abstraction formalism. We have used Petri nets [3] to formalize the behavior of these methods. Because Petri nets are graphically based, the models provide a visualization result with well- defined dynamic behavior. Petri nets provide a graphic model that supports the fundamental concepts of concurrency, synchronization, and nondeterminism. In Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. SIGAda'99 10/99 Redondo Beach, CA, USA © 1999 ACM 1-58113-127-5/99/0010...$5.00