eventful sessions eventful sessions types programming and
play

Eventful Sessions: Eventful Sessions: Types, Programming and - PowerPoint PPT Presentation

Eventful Sessions: Eventful Sessions: Types, Programming and Bisimilarity Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida Kohei Honda Type safe Eventful Sessions in Java Type safe Eventful Sessions in Java Combine session


  1. Eventful Sessions: Eventful Sessions: Types, Programming and Bisimilarity Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida Kohei Honda

  2. Type safe Eventful Sessions in Java Type ‐ safe Eventful Sessions in Java • Combine session types and event driven programming • Combine session types and event ‐ driven programming – Extend session types to support event ‐ driven programming yp pp p g g – Facilitate event ‐ driven programming using the benefits of session types Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 2

  3. Outline Outline Extend SJ (Session Java) for session ‐ typed event programming Extend SJ (Session Java) for session typed event programming . • (ECOOP ‘10) Supporting formalisation of the key mechanisms in a minimal process • model; communication safety for eventful session processes. Behavioural theory for asynchronous, eventful processes. • (FMOODS ‘11) ( ) Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 3

  4. Event driven Concurrency Event ‐ driven Concurrency • … vs. multithreaded concurrency www.server.co.uk:8888 Multithreaded Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 4

  5. Event driven Concurrency Event ‐ driven Concurrency • … vs. multithreaded concurrency Multithreaded Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 5

  6. Event driven Concurrency Event ‐ driven Concurrency • … vs. multithreaded concurrency Multithreaded Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 6

  7. Event driven Concurrency Event ‐ driven Concurrency • … vs. multithreaded concurrency Multithreaded Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 8

  8. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 9

  9. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 10

  10. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 11

  11. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 12

  12. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 13

  13. Event driven Concurrency Event ‐ driven Concurrency + scalability Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 14

  14. Event driven Concurrency Event ‐ driven Concurrency + scalability – difficult (read/write/verify) – Fragmented control flow – Low level Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 15

  15. Event driven Concurrency Event ‐ driven Concurrency + scalability – difficult (read/write/verify) – Fragmented control flow – Low level Selector E Event Loop t L Thread Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 16

  16. Event driven Concurrency Event ‐ driven Concurrency + scalability – difficult (read/write/verify) – Fragmented control flow – Low level Selector E Event Loop t L Event ‐ driven Server Event Loop Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 17

  17. Language and Runtime for Events Language and Runtime for Events Language features for event ‐ driven programming… Events can make Sense . M. Krohn, E. Kohler, and M. F. Kaashoek. ( USENIX ATC • 2007.) EventJava: An Extension of Java for Event Correlation . P. Eugster and K. R. • Jayaram. ( ECOOP 2009.) Alternative programming interfaces over event ‐ driven runtimes… Combining Events and Threads for Scalable Network Services . P. Li and S. • Zdancewic. ( PLDI 2007.) Scala Actors: Unifying Thread ‐ based and Event ‐ based Programming . P. Haller • and M. Odersky. ( TCS 2009.) d M Od k ( TCS 2009 ) Capriccio: Scalable Threads for Internet Services . Capriccio R. von Behren, J. • Condit, F. Zhou, G. C. Necula, and E. Brewer. ( SOSP 2003.) Condit, F. Zhou, G. C. Necula, and E. Brewer. ( SOSP 2003.) Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 18

  18. Session Types Session Types Theory… Language Primitives and Type Disciplines for Structured Communication ‐ based • Programming . K. Honda, V. T. Vasconcelos, and M. Kubo. ( ESOP 1998.) Session types for Object ‐ oriented Languages . M. Dezani ‐ Ciancaglini, D. Mostrous, S i t f Obj t i t d L M D i Ci li i D M t • N. Yoshida, and S. Drossopoulou. ( ECOOP 2006 .) Practical language design and implementations… l l d d l Session ‐ based Distributed Programming in Java . R. Hu, N. Yoshida, and K. Honda. • ( ECOOP 2008 ) ( ECOOP 2008.) Modular Session Types for Distributed Object ‐ oriented Programming . S. J. Gay, V. • T. Vasconcelos, A. Ravara, N. Gesbert, and A. Z. Caldeira. ( POPL 2010 .) Language Support for Fast and Reliable Message ‐ based Communication in • Singularity OS . Fähndrich, M. Aiken, C. Hawblitzel, O. Hodson, G. Hunt, J. R. Larus, and S Levi ( EuroSys 2006 ) and S. Levi. ( EuroSys 2006.) Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 19

  19. Type safe Eventful Sessions in Java Type ‐ safe Eventful Sessions in Java begin . !< Background, Contributions > . !< Basic Example > . !< Formalism and Properties > p . !< Implementation, Real ‐ world Example: SMTP > . !< Conclusion > . ?[ ?( Question ) !< Answer > ?( Question ) . !< Answer > ]* . end Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 20

  20. Session typed Programming Session ‐ typed Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> ?( ) ?( ) ! l Session ‐ based communications programming in SJ: • Declaration of communication protocols using session types • Declaration of communication protocols using session types • Implementation of protocols using statically type ‐ checked session operations i ti Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 21

  21. Session typed Programming Session ‐ typed Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> ?( ) ?( ) ! l Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 22

  22. Session typed Programming Session ‐ typed Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> } protocol pServer { l { ?( ) ?( ) ! l } Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 23

  23. Session typed Programming Session ‐ typed Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> } protocol pServer { l { ?( ) ?( ) ! l } ... SJSocket{ pServer } s = ss. accept() ; ... Data d1 = s receive() ; Data d1 = s. receive() ; // ?(Data) // ?(Data) Data d2 = s. receive() ; // ?(Data) Result r = doSomeWork ( d1, d2 ) ; s. send( r ) ; // !<Result> Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 24

  24. Session typed Event Programming Session ‐ typed Event Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> } protocol pServer { l { ?( ) ?( ) ! l } E Event 2 t 2 Event 1 Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 25

  25. Session typed Event Programming Session ‐ typed Event Programming • Handle concurrent sessions of type: ?(Data) . ?(Data) . !<Result> } protocol pServer { l { ?( ) ?( ) ! l } Event 2 E t 2 Event 1 // Session set type // Session set type protocol pSelector { ?(Data) . ?(Data) . !<Result>, // Event 1 ?(Data) . !<Result> // Event 2 } Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 26

  26. Event driven Concurrency Event ‐ driven Concurrency Selector E Event Loop t L Event ‐ driven Server Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 27

  27. Session typed Event Programming Session ‐ typed Event Programming class Example { public static void main (String[] args ) throws SJIOException { public static void main (String[] args ) throws SJIOException { protocol pSelector { ?(Data) . ?(Data) . !<Result>, ?(Data) . !<Result> } } } } } Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 28

  28. Session typed Event Programming Session ‐ typed Event Programming class Example { public static void main (String[] args ) throws SJIO Exception { public static void main (String[] args ) throws SJIO Exception { protocol pSelector { ?(Data) . ?(Data) . !<Result>, ?(Data) . !<Result> } SJSelector{ pSelector } sel = new SJSelector{ pSelector }() ; } } } } Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, Kohei Honda 29

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend