Skip to main content
Log in

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

  • Original Article
  • Published:
Acta Informatica Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Agha G.A.: ACTORS: A Model of Concurrency Computation in Distributed Systems. MIT Press, Cambridge (1986)

    Google Scholar 

  2. Ben-Ari M.: How to solve the Santa Claus problem. Concurr. Pract. Exper. 10(6), 485–496 (1998)

    Article  MATH  Google Scholar 

  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. Benton N., Cardelli L., Fournet C.: Modern concurrency abstractions for \({{\rm C}_{\sharp}}\). ACM TOPLAS 26(5), 769–804 (2004)

    Article  Google Scholar 

  5. Birrel, A.D.: An introduction to programming with threads. Tech. Rep. 35, DEC SRC (1989)

  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)

    Article  Google Scholar 

  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. 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)

  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. 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. 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. Drossopoulou S., Damiani F., Dezani-Ciancaglini M., Giannini P.: More dynamic object re-classification: Fickleii. TOPLAS 24(2), 153–191 (2002)

    Article  Google Scholar 

  13. Fournet, C., Gonthier, G.: The reflexive chemical abstract machine and the join calculus. In: POPL’96, pp. 372–385. ACM (1996)

  14. Igarashi A., Pierce B., Wadler P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)

    Article  Google Scholar 

  15. Itzstein, G.S., Kearney, D.: Join Java: an alternative concurrency semantics for Java. Tech. Rep. ACRC-01-001, Univ. of South Australia (2001)

  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. 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)

    Article  Google Scholar 

  18. Milicia G., Sassone V.: Jeeg: temporal constraints for the synchronization of concurrent objects. Concurr. Computat. Pract. Exper. 17(5-6), 539–572 (2005)

    Article  Google Scholar 

  19. Milner R., Parrow J., Walker D.: A calculus of mobile processes, parts I and II. Inf. Comput. 100(1), 1–77 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  20. Nierstrasz, O.: Regular types for active objects. In: OOPSLA’93, ACM SIGPLAN Notices, vol. 28, pp. 1–15 (1993)

  21. Philippsen M.: A survey of concurrent object-oriented languages. Concurr. Computat. Pract. Exper. 12(10), 917–980 (2000)

    Article  MATH  Google Scholar 

  22. Ravara, A., Vasconcelos, V.T.: Typing Non-uniform concurrent objects. In: CONCUR’00, LNCS, vol. 1877, pp. 474–488. Springer, Berlin (2000)

  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)

  24. Tomlinson, C., Singh, V.: Inheritance and synchronization with enabled-sets. In: OOPSLA’89, pp. 103–112. ACM (1989)

  25. Trono J.A.: A new exercise in concurrency. SIGCSE Bull. 26(3), 8–10 (1994)

    Article  Google Scholar 

  26. Wright A., Felleisen M.: A syntactic approach to type soundness. Inf. Comput. 1(115), 38–94 (1994)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ferruccio Damiani.

Additional information

Work partially supported by MIUR PRIN’06 EOS DUE project, and the Information Society Technologies programme of the European Commission, Future and Emerging Technologies under the IST-2005-015905 MOBIUS project. The funding bodies are not responsible for any use that might be made of the results presented here.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Damiani, F., Giachino, E., Giannini, P. et al. A type safe state abstraction for coordination in Java-like languages. Acta Informatica 45, 479–536 (2008). https://doi.org/10.1007/s00236-008-0079-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00236-008-0079-y

Keywords

Navigation