communicating process architectures cpa 09
play

Communicating Process Architectures ( CPA09 ) Techniques for writing - PowerPoint PPT Presentation

Faraz TORSHIZI a , Jonathan S. OSTROFF b , Richard F. PAIGE c and Marsha CHECHIK a a University of Toronto, Canada b York University, Canada c University of York, UK http://www.cs.toronto.edu/~faraz Communicating Process Architectures ( CPA09


  1. Faraz TORSHIZI a , Jonathan S. OSTROFF b , Richard F. PAIGE c and Marsha CHECHIK a a University of Toronto, Canada b York University, Canada c University of York, UK http://www.cs.toronto.edu/~faraz Communicating Process Architectures ( CPA’09 )

  2.  Techniques for writing concurrent code are still low-level  semaphores, locks, sync blocks, monitors etc.  hard to test and maintain  There is a large gap between the above mechanisms and the popular object- oriented concepts  The SCOOP model [Meyer97] is an attempt to bridge this gap in OO context  Originally developed for Eiffel language CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 2

  3.  Basic concept of OO computation: routine call x.f(a) Action Object CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 3

  4.  Basic concept of OO computation: routine call x.f(a)  SCOOP adds the notion of a processor (handler)  Processor is an abstract concept used to define behavior Action Object Processor CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 4

  5.  x.f (a) – execute routine f on the object attached to x .  In a sequential context f is synchronous  In a concurrent context, if x denotes an object handled by another processor, f is asynchronous  This semantic difference (synchronous vs. asynchronous) has a syntactic marker: separate CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 5

  6. x : separate X ... x . f ( a ) P2 P1 x o1 o2 CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 6

  7.  Handling: All calls on an object are executed by its associated processor (no object sharing)  Mutual exclusion: At most one method may execute on an object at a time  Separateness:  Calls on non-separate objects are synchronous  Calls on separate objects are asynchronous SCOOP programs are free of data races and atomicity violations by construction CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 7

  8. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 8

  9. Using sequential library in concurrent context CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 9

  10. Using sequential library in concurrent context Automatic locking of arguments CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 10

  11. Using sequential library in concurrent context Automatic locking of arguments Wait condition CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 11

  12. Using sequential library in concurrent context Automatic locking of arguments Wait condition Async calls CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 12

  13.  The SCOOP model is developed as an extension to Eiffel language SCOOP • High-level abstraction for concurrency • Automatic synchronization Eiffel • clean, DbC, full OO • Data race freedom • not popular as it should • Atomicity violation freedom • Fair scheduling • Using sequential libraries in concurrent context  A pattern for SCOOP that makes it feasible to apply the SCOOP concurrency model to other OO languages Java/C# • used by many people • no support for DbC CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 13

  14. Input SCOOP program Consistency checking Core library Translation rules Multi-threaded output CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 14

  15.  To write the SCOOP program we use the meta-data facility of the supporting language  Annotations in Java and attributes in C#  One keyword in Eiffel ( separate ) vs. two annotations in other languages ( separate and await ) CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 15

  16. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 16

  17. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 17

  18. Input SCOOP program Consistency checking Core library Translation rules Multi-threaded output CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 18

  19. public class X { @separate X x1; A a2; A a1; … … } public void r ( @separate X x) { Supplier a1 = x.a2; } … x1 client supplier r (x1); a1 a2 a1.... Client CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 19

  20. public class X { @separate X x1; A a2; A a1; … … } public void r ( @separate X x) { Supplier a1 = x.a2; } … x1 client supplier r (x1); a1 a2 a1.... Client CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 20

  21. public class X { @separate X x1; A a2; A a1; … … } public void r ( @separate X x) { Supplier a1 = x.a2; } … x1 client supplier r (x1); a1 a2 a1.... Datarace on a1 Client CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 21

  22. public class X { @separate X x1; A a2; A a1; … … } public void r ( @separate X x) { Supplier a1 = x.a2; Not allowed -- Compile-time error } … x1 client supplier r (x1); a1 a2 a1.... Datarace on a1 Client CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 22

  23. Input SCOOP program Consistency checking Core library Translation rules Multi-threaded output CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 23

  24.  The core library provides the essentials for modeling SCOOP:  Processors  Separate and non-separate calls  Atomic locking of multiple resources  Wait semantics  Wait-by-necessity  Fair scheduling CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 24

  25. CPA 2009 25

  26.  Processors are instances of the Processor class.  Every processor has a  Local call stack for local calls  Remote call queue for remote calls  Processor repeatedly performs the following: Pops an item off the stack and executes it 1. If the stack is empty, dequeues an item from the remote call 2. queue and pushes it onto the local call stack If both the stack and the queue are empty, waits for new 3. requests to be enqueued CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 26

  27. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 27

  28. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 28

  29. Send request CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 29

  30. Send request (1) Acquire locks (2) Check wait condition CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 30

  31. Send request (1) Acquire locks (2) Check wait condition Send the “go ahead” signal CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 31

  32. Send request (1) Acquire locks (2) Check wait condition Send the “go ahead” signal Enqueue call on proc-B and release the lock Same for call on proc-C CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 32

  33. Send request (1) Acquire locks (2) Check wait condition Send the “go ahead” signal Enqueue call on proc-B and release the lock Same for call on proc-C Continue with local activity CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 33

  34. Input SCOOP program Consistency checking Core library Translation rules Multi-threaded output CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 34

  35. Input: annotated code Output: multi-threaded using core library CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 35

  36. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 36

  37. Violation of consistency rules CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 37

  38. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 38

  39.  Not shown the correctness of translation  develop more examples in JSCOOP  check the bi-similar behavior to programs written in Java  Need for empirical studies  access the efficiency and effectiveness of the tool  Add full support for inheritance and genercity  SCOOP is still prone to deadlocks  Apply model-checking techniques to detect deadlocks at compile-time CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 39

  40.  Design pattern for SCOOP that makes it feasible to apply the SCOOP concurrency model to other OO languages  Annotation processing and consistency checking  Core library  Translation rules  A prototype implementation for Java based on an Eclipse plug-in called JSCOOP  http://code.google.com/p/jscoop CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 40

  41. CPA 2009 Faraz Torshizi, Department of Computer Science, University of Toronto 41

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