santa claus with mobile with mobile santa claus with
play

Santa Claus with Mobile with Mobile Santa Claus with Mobile - PowerPoint PPT Presentation

Santa Claus with Mobile with Mobile Santa Claus with Mobile Santa Claus Reindeer and Elves Reindeer and Elves Reindeer and Elves Peter Welch ( phw@kent.ac.uk ) Matt Pedersen ( matt@faculty.egr.unlv.edu ) CPA 2008 (09/07/2008)


  1. Santa Claus – – with Mobile with Mobile Santa Claus – with Mobile Santa Claus Reindeer and Elves Reindeer and Elves Reindeer and Elves Peter Welch ( phw@kent.ac.uk ) Matt Pedersen ( matt@faculty.egr.unlv.edu ) CPA 2008 (09/07/2008)

  2. MOBILE processes processes … … MOBILE Santa Claus … … Santa Claus

  3. Mobile Process Process Types Types Mobile Mobile Process Types occam- - π An occam π mobile process, embedded anywhere in a dynamically evolving network, may suspend suspend itself mid- execution, be safely disconnected disconnected from its local environment, moved moved (by channel communication) to a new environment, reconnected reconnected to that new environment and reactivated reactivated . P A Q B R C D S E T

  4. Mobile Process Process Types Types Mobile Mobile Process Types occam- - π An occam π mobile process, embedded anywhere in a dynamically evolving network, may suspend suspend itself mid- execution, be safely disconnected disconnected from its local environment, moved moved (by channel communication) to a new environment, reconnected reconnected to that new environment and reactivated reactivated . P A Q B R C D S E T

  5. Mobile Process Process Types Types Mobile Mobile Process Types occam- - π An occam π mobile process, embedded anywhere in a dynamically evolving network, may suspend suspend itself mid- execution, be safely disconnected disconnected from its local environment, moved moved (by channel communication) to a new environment, reconnected reconnected to that new environment and reactivated reactivated . P A Q B R C D S E T

  6. Mobile Process Process Types Types Mobile Mobile Process Types occam- - π An occam π mobile process, embedded anywhere in a dynamically evolving network, may suspend suspend itself mid- execution, be safely disconnected disconnected from its local environment, moved moved (by channel communication) to a new environment, reconnected reconnected to that new environment and reactivated reactivated . P A Q B R C D S E T

  7. Mobile Process Process Types Types Mobile Mobile Process Types occam- - π An occam π mobile process, embedded anywhere in a dynamically evolving network, may suspend suspend itself mid- execution, be safely disconnected disconnected from its local environment, moved moved (by channel communication) to a new environment, reconnected reconnected to that new environment and reactivated reactivated . Upon reactivation, the process resumes from the same state (i.e. data values and code positions) (i.e. data values and code positions) it held when suspended. Its view of that environment is unchanged, since that is abstracted by its channel since that is abstracted by its channel interface . The environment on the other side of that interface abstraction, however, will usually be different. The mobile process may itself contain any number of any number of levels of dynamically evolving parallel sub-network. levels

  8. Mobile Process Process Types Types Mobile Process Types Mobile Mobile processes are entities encapsulating state and code. They may be active active or passive passive . Initially, they are passive passive . activate passive active passive active (self) suspend move The state of a mobile process can only be felt by interacting with it when active active . When passive passive , its state is locked – even against reading.

  9. Mobile Process Process Types Types Mobile Process Types Mobile When passive passive , they may be activated activated or moved moved . A moved process remains passive passive . An active active process moved cannot be moved moved or activated activated in parallel. activate passive active passive active (self) suspend move When an active active mobile process suspends suspends , it becomes passive – retaining its state and code position. When it passive moves, its state moves with it. When re- activated activated , it sees its previous state and continues from where it left off.

  10. Mobile Process Process Types Types Mobile Process Types Mobile Mobile processes exist in many technologies – such as applets , agents agents and in distributed operating systems. applets occam- - π occam π offers (will offer) support for them with a formal denotational denotational and refinement refinement semantics, safety and very low overheads. Process mobility semantics follows naturally from that for mobile data and mobile channel-ends. We need to introduce a concept of process types types and variables . variables

  11. Mobile Process Process Types Types Mobile Mobile Process Types Process type type declarations give names to PROC PROC header templates. Mobile processes may implement types with synchronisation parameters only (i.e. channels , barriers , buckets , etc.) plus records and fixed-size arrays of the same. For example: PROC TYPE IN.OUT.SUSPEND PROC TYPE IN.OUT.SUSPEND (CHAN INT (CHAN INT in in?, ?, out out!, !, suspend suspend?): ?): The above declares a process type type called IN.OUT.SUSPEND IN.OUT.SUSPEND . Processes implementing this will be given three channels by the (re-)activating host process: two for input ( in ? ) in?, ?, suspend suspend? and one for output ( out ! ), all carrying INT INT traffic. out! Process types types are used in two ways: for the declaration of process variables variables and to define the connection connection interface to a mobile process. interface

  12. Mobile Process Process Example Example Mobile Process Example Mobile in out integrate.suspend integrate.suspend suspend MOBILE PROC MOBILE PROC integrate.suspend integrate.suspend (CHAN INT (CHAN INT in in?, ?, out out!, !, suspend suspend?) ?) IMPLEMENTS IN.OUT.SUSPEND IN.OUT.SUSPEND IMPLEMENTS INITIAL INT total total IS 0: IS 0: -- -- local state local state INITIAL INT WHILE TRUE WHILE TRUE INT x x: : INT PRI ALT PRI ALT suspend suspend ? ? x x SUSPEND -- control returns to activator control returns to activator SUSPEND -- -- control resumes here when next activated control resumes here when next activated -- in ? in ? x x SEQ SEQ total total := := total total + + x x out ! ! total total out : :

  13. Mobile Processes and and Types Types Mobile Processes and Types Mobile Processes A process type type may be implemented by many mobile processes – each offering different behaviours. The mobile process from the last slide, integrate.suspend integrate.suspend , implements the process type, IN.OUT.SUSPEND IN.OUT.SUSPEND , defined earlier. Other processes could implement the same type. A process variable variable has a specific process type. Its value may be undefined undefined or some mobile process some mobile process implementing its type. A process variable may be bound to different mobile processes, offering different behaviours, at different times in its life. When defined defined , it can only be activated according to that type.

  14. Mobile Process Process Example Example Mobile Mobile Process Example process.out process.out A A PROC A PROC A (CHAN (CHAN IN.OUT.SUSPEND IN.OUT.SUSPEND process.out process.out!) !) IN.OUT.SUSPEND p p: : IN.OUT.SUSPEND SEQ SEQ -- p -- p is not yet defined (can is not yet defined (can’ ’t move or activate it) t move or activate it) p := := MOBILE MOBILE integrate.suspend integrate.suspend p -- p p is now defined (can move and activate) is now defined (can move and activate) -- process.out ! ! p p process.out -- p p is now undefined (can is now undefined (can’ ’t move or activate it) t move or activate it) -- : :

  15. Mobile Process Process Example Example Mobile Mobile Process Example in suspend in suspend process.in process.out process.in process.out B B out out PROC B PROC B (CHAN (CHAN IN.OUT.SUSPEND IN.OUT.SUSPEND process.in process.in? ?, , process.out process.out!, !, CHAN INT in in?, ?, out out!, !, suspend suspend?) ?) CHAN INT WHILE TRUE WHILE TRUE IN.OUT.SUSPEND q IN.OUT.SUSPEND q: : SEQ SEQ ... input a process to q q ... input a process to ... plug into local channels and activate q ... plug into local channels and activate q ... when finished, send it on its way ... when finished, send it on its way : :

  16. Mobile Process Process Example Example Mobile Mobile Process Example in suspend in suspend process.in process.out process.in process.out B B out out WHILE TRUE WHILE TRUE IN.OUT.SUSPEND q q: : IN.OUT.SUSPEND SEQ SEQ -- q is not yet defined (can q is not yet defined (can’ ’t move or activate it) t move or activate it) -- process.in ? ? q q process.in -- q is now defined (can move and activate) -- q is now defined (can move and activate) q (in?, out!, suspend?) q (in?, out!, suspend?) -- q is still defined (can move and activate) q is still defined (can move and activate) -- process.out ! ! q q process.out -- q is now undefined (can q is now undefined (can’ ’t move or activate it) t move or activate it) --

  17. Mobile Process Process Example Example Mobile Process Example Mobile in suspend in suspend … … c c d d A B A B out out CHAN IN.OUT.SUSPEND IN.OUT.SUSPEND c c, , d d: : CHAN CHAN INT in in, , out out, , suspend suspend: : CHAN INT ... other channels ... other channels PAR PAR A ( (c c!) !) A B ( B (c c?, ?, d d!, !, in in?, ?, out out!, !, suspend suspend?) ?) ... other processes ... other processes

  18. MOBILE processes processes … … MOBILE Santa Claus … … Santa Claus

Recommend


More recommend