Abstract
Learning concurrency paradigms is necessary but it is not sufficient since the choice of run-time semantics may introduce subtle programming errors. It is the aim of this paper to exemplify the importance of process queuing and awaking policies resulting from possible choices of the monitor concept implementation.The first part of the paper compares the behaviour of concurrent processes sharing a unique waiting queue for condition synchronization when implemented in Java or in Ada. A particular solution of the dining philosophers paradigm will be used to show how the difference in the monitor semantics may lead or not to deadlock. This comparison provides insight for deriving a correct Java implementation. The second part of the paper shows how the implementation can be refined when using Ada entry families and requeue with requeue once restriction. The result is elegant, safe and fair, and deterministic. This paper ends with quantitative comparisons of concurrency complexity and of concurrency effectiveness.We conclude that Java and C# multithreading need defensive concurrent programming while Ada allows more latitude for developing correct concurrent programs.
- {ACCOV 2005} http://deptinfo.cnam.fr/Enseignement/CycleSpecialisation/ACCOV/Google Scholar
- {Ada 1999} Ada 95 Reference Manual, International Standard ANSI/ISO/IEC-8652: 1995, January 1999.Google Scholar
- {Barkaoui 1997} K. Barkaoui, C. Kaiser and J. F. Pradat-Peyre. Petri nets based proofs of Ada95 solution for preference control. Joint APSEC97/ICSC97 Conference. Hong-Kong December 1997, 15 pages. IEEE CS Press 1997. Google ScholarDigital Library
- {Bétourné 1971} C. Bétourné, J. Ferrié, C. Kaiser, S. Krakowiak and J. Mossière. System Design Using Parallel Processes. IFIP congress 1971. pp. 345--352. North Holland. 1971.Google Scholar
- {Brosgol 1996} B. Brosgol. The dining philosophers in Ada95. In Reliable Software Technologies-Ada-Europe'96, LNCS 1088, pp. 247--261. Springer-Verlag, 1996. Google ScholarDigital Library
- {Buhr 1995} P. Buhr, M. Fortier, M. Coffin. Monitor Classification, ACM Computing Survey, 27, 1, pp. 63--107. 1995. Google ScholarDigital Library
- {Burns 1995} A. Burns and A. Wellings. Concurrency in Ada, Chapter 6.11, pp. 134--137. Cambridge University Press, 1995. Google ScholarDigital Library
- {Burns 2004} A. Burns, B. Dobbing and T. Vardanega. Guide for the use of the Ada Ravenscar Profile in high integrity systems. ACM SIGAda Ada Letters, 24, 2. pp. 1--74, June 2004. Google ScholarDigital Library
- {Dijkstra 1968} E. W. Dijkstra. The Structure of the "THE" Multiprogramming System. Communications of the ACM, 11, 5. pp. 341--346, May 1968. Google ScholarDigital Library
- {Dijkstra 1971} E. W. Dijkstra. Hierarchical ordering of sequential processes. Acta Informatica, number 1, pp. 115--138, 1971. (also available as EWD310 at http://www.cs.utexas.edu/users/EWD/)Google Scholar
- {Evangelista 2003} S. Evangelista, C. Kaiser, J. F. Pradat-Peyre, P. Rousseau. Quasar: a new tool for analyzing concurrent programs. International Conference on Reliable Software Technologies, Ada-Europe'03, LNCS vol. 2655, pp. 166--181, Springer-Verlag 2003. Toulouse, France, June 2003.Google Scholar
- {Hoare 1974} C. Hoare. Monitors: An operating system structuring concept. Communications of the ACM. 17, 10. pp. 549--557. October 1974. Google ScholarDigital Library
- {Intermetrics 1995} Intermetrics Inc. Ada 95 Rationale, The Core Language, 9 Tasking, 9.1 Protected Types, page 9--5, Cambridge, Mass., 1995.Google Scholar
- {Kaiser 1997} C. Kaiser and J. F. Pradat-Peyre. Comparing the reliability provided by tasks or protected objects for implementing a resource allocation service: a case study. Tri-Ada'97 Conference, Saint-Louis, USA. pp. 51--65. ACM publication, 1997. Google ScholarDigital Library
- {Knuth 1969} D. Knuth. The Art of Computer Programming, Volume 1. Fundamental Algorithms. 634 pages. Addison-Wesley 1969. Google ScholarDigital Library
- {Lea 1998} D. Lea. Patterns and the democratization of concurrent programming, IIE Concurrency, Parallel, Distributed & Mobile Computing, 6, 4, pp. 11--13, 1998. Google ScholarDigital Library
- {Quassar 2006}. http://quasar.cnam.fr/Google Scholar
Index Terms
- Comparing Java, C# and Ada monitors queuing policies: a case study and its Ada refinement
Recommendations
Lightweight monitors for the Java virtual machine
Research ArticlesJava supports the monitor construct for language-level synchronization in the context of multi-threading. This paper introduces the lightweight monitor, an efficient user-level monitor implementation. The lightweight monitor is useful for single-...
Implementing transactions using Ada exceptions: which features are missing?
Exception handling for a 21st century programming language proceedingsTransactional Drago programming language is an Ada extension that provides transaction processing capabilities. Exceptions have been integrated with transactions in Transactional Drago; exceptions are used to notify transaction aborts and any unhandled ...
Starvation-Free Monitors
Theoretical Aspects of Computing – ICTAC 2019AbstractMonitors are a synchronization construct which allows to keep a thread waiting until a specific resource for that thread is available. One potential problem with these constructs is starvation; a situation where a thread, competing for a resource, ...
Comments