Acta Informatica

, Volume 45, Issue 7–8, pp 479–536 | Cite as

A type safe state abstraction for coordination in Java-like languages

  • Ferruccio Damiani
  • Elena Giachino
  • Paola Giannini
  • Sophia Drossopoulou
Original Article

Abstract

The state of a concurrent object, intended as some abstraction over the values of the fields of the object, usually determines its coordination behavior. Therefore, state is always in the programmer’s mind, even though implicitly. We suggest a feature for Java-like languages, which makes the state of a concurrent object explicit and supports the expression of the object’s behavior depending on the state it is currently in. Namely, an object will be in one of the states declared in its class. The state determines the presence of fields and methods. State transition statements explicitly change the state of an object, and thus change the availability of fields and methods. When a thread calls a method which is declared in the object’s class but absent from its current state, it waits, until the state of the object changes to a state which does contain that method. This directly expresses coordination. We claim that this feature makes it easier to understand and develop concurrent programs, and substantiate our claim through the discussion of some popular examples of concurrent programs written using this feature.We develop a type and effect system, which guarantees that, during execution of a method invoked on a concurrent object \({\tt o}\): (1) No attempt will be made to access fields not available in the current state of \({\tt o}\), and (2) No method invoked on a receiver (syntactically) different from \({\tt this}\) may cause the invocation of a method on \({\tt o}\). The latter guarantee helps to enforce the former and prevents a family of accidental violations of the intended coordination protocol.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Agha G.A.: ACTORS: A Model of Concurrency Computation in Distributed Systems. MIT Press, Cambridge (1986)Google Scholar
  2. 2.
    Ben-Ari M.: How to solve the Santa Claus problem. Concurr. Pract. Exper. 10(6), 485–496 (1998)MATHCrossRefGoogle Scholar
  3. 3.
    Benton, N.: Jingle Bells: solving the Santa Claus problem in polyphonic \({{\rm C}_{\sharp}}\). Note (2003). http://research.microsoft.com/~nick/santa.pdf
  4. 4.
    Benton N., Cardelli L., Fournet C.: Modern concurrency abstractions for \({{\rm C}_{\sharp}}\). ACM TOPLAS 26(5), 769–804 (2004)CrossRefGoogle Scholar
  5. 5.
    Birrel, A.D.: An introduction to programming with threads. Tech. Rep. 35, DEC SRC (1989)Google Scholar
  6. 6.
    Burdy L., Cheon Y., Cok D.R., Ernst M.D., Kiniry J.R., Leavens G.T., Leino K.R.M., Poll E.: An overview of JML tools and applications. STTT 7(3), 212–232 (2005)CrossRefGoogle Scholar
  7. 7.
    Cameron, N., Damiani, F., Drossopoulou, S., Giachino, E., Giannini, P.: Solving the Santa Claus problem using state classes. Tech. rep., Dip. di inf., Univ. di Torino (2006). http://www.di.unito.it/~damiani/papers/scp.pdf
  8. 8.
    Clarke, D., Drossopoulou, S.: Ownership, encapsulation and the disjointness of types and effects. In: Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA’02), pp. 292–310. ACM Press, Seattle (2002)Google Scholar
  9. 9.
    Damiani, F., Dezani-Ciancaglini, M., Giannini, P.: On re-classification and multithreading. JOT (http://www.jot.fm) 3(11), 5–30 (2004). Special issue: OOPS track at SAC 2004
  10. 10.
    Damiani, F., Giachino, E., Giannini, P., Cameron, N., Drossopoulou, S.: A state abstraction for coordination in Java-like languages. In: Electronic proceedings of FTfJP’06 (http://www.cs.ru.nl/ftfjp/) (2006)
  11. 11.
    Damiani, F., Giachino, E., Giannini, P., Cazzola, E.: On state classes and their dynamic semantics. In: ICSOFT’06 (http://www.icsoft.org), pp. 5–12. INSTICC press, Setúbal, Portugal (2006)
  12. 12.
    Drossopoulou S., Damiani F., Dezani-Ciancaglini M., Giannini P.: More dynamic object re-classification: Fickleii. TOPLAS 24(2), 153–191 (2002)CrossRefGoogle Scholar
  13. 13.
    Fournet, C., Gonthier, G.: The reflexive chemical abstract machine and the join calculus. In: POPL’96, pp. 372–385. ACM (1996)Google Scholar
  14. 14.
    Igarashi A., Pierce B., Wadler P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)CrossRefGoogle Scholar
  15. 15.
    Itzstein, G.S., Kearney, D.: Join Java: an alternative concurrency semantics for Java. Tech. Rep. ACRC-01-001, Univ. of South Australia (2001)Google Scholar
  16. 16.
    Kafura D.G., Lavender R.G.: Concurrent object-oriented languages and the inheritance anomaly. In: Casavant, T., Tvrdil, P., Plásil, F. (eds) Parallel Computers: Theory and Practice, pp. 221–264. IEEE Press, New York (1996)Google Scholar
  17. 17.
    Keen A.W., Ge T., Maris J.T., Olsson R.A.: JR: Flexible distributed programming in an extended Java. TOPLAS 26(3), 578–608 (2004)CrossRefGoogle Scholar
  18. 18.
    Milicia G., Sassone V.: Jeeg: temporal constraints for the synchronization of concurrent objects. Concurr. Computat. Pract. Exper. 17(5-6), 539–572 (2005)CrossRefGoogle Scholar
  19. 19.
    Milner R., Parrow J., Walker D.: A calculus of mobile processes, parts I and II. Inf. Comput. 100(1), 1–77 (1992)MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Nierstrasz, O.: Regular types for active objects. In: OOPSLA’93, ACM SIGPLAN Notices, vol. 28, pp. 1–15 (1993)Google Scholar
  21. 21.
    Philippsen M.: A survey of concurrent object-oriented languages. Concurr. Computat. Pract. Exper. 12(10), 917–980 (2000)MATHCrossRefGoogle Scholar
  22. 22.
    Ravara, A., Vasconcelos, V.T.: Typing Non-uniform concurrent objects. In: CONCUR’00, LNCS, vol. 1877, pp. 474–488. Springer, Berlin (2000)Google Scholar
  23. 23.
    Rodríguez, E., Dwyer, M.B., Flanagan, C., Hatcliff, J., Leavens, G.T., Robby: Extending JML for modular specification and verification of multi-threaded programs. In: ECOOP, pp. 551–576 (2005)Google Scholar
  24. 24.
    Tomlinson, C., Singh, V.: Inheritance and synchronization with enabled-sets. In: OOPSLA’89, pp. 103–112. ACM (1989)Google Scholar
  25. 25.
    Trono J.A.: A new exercise in concurrency. SIGCSE Bull. 26(3), 8–10 (1994)CrossRefGoogle Scholar
  26. 26.
    Wright A., Felleisen M.: A syntactic approach to type soundness. Inf. Comput. 1(115), 38–94 (1994)CrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag 2008

Authors and Affiliations

  • Ferruccio Damiani
    • 1
  • Elena Giachino
    • 1
    • 2
  • Paola Giannini
    • 3
  • Sophia Drossopoulou
    • 4
  1. 1.Dipartimento di InformaticaUniversità di TorinoTorinoItaly
  2. 2.PPS, Université Paris 7ParisFrance
  3. 3.Dipartimento di InformaticaUniversità del Piemonte OrientaleAlessandriaItaly
  4. 4.Department of ComputingImperial College LondonLondonUK

Personalised recommendations