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 "o": (1) No attempt will be made to access fields not available in the current state of "o", and (2) No method invoked on a receiver (syntactically) different from"this" may cause the invocation of a method on "o". The latter guarantee helps to enforce the former and prevents a family of accidental violations of the intended coordination protocol.

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

DAMIANI, Ferruccio;GIACHINO, Elena;
2008-01-01

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 "o": (1) No attempt will be made to access fields not available in the current state of "o", and (2) No method invoked on a receiver (syntactically) different from"this" may cause the invocation of a method on "o". The latter guarantee helps to enforce the former and prevents a family of accidental violations of the intended coordination protocol.
2008
45
7-8
479
536
http://dl.acm.org/citation.cfm?id=1473174
http://dx.doi.org/10.1007/s00236-008-0079-y
Ferruccio Damiani; Elena Giachino; Paola Giannini; Sophia Drossopoulou
File in questo prodotto:
File Dimensione Formato  
actainformatica2008.pdf

Accesso riservato

Tipo di file: PDF EDITORIALE
Dimensione 4.03 MB
Formato Adobe PDF
4.03 MB Adobe PDF   Visualizza/Apri   Richiedi una copia

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/2318/60123
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 13
  • ???jsp.display-item.citation.isi??? 10
social impact