freeing programmers from the shackles of sequentiality
play

Freeing Programmers from the Shackles of Sequentiality Thesis - PowerPoint PPT Presentation

Freeing Programmers from the Shackles of Sequentiality Thesis Proposal Talk Sven Stork Committee Jonathan Aldrich (CMU) Paulo Marques (UC) Todd Mowry (CMU) Ernesto Costa (UC) William Scherlis (CMU) Marco Viera (UC) 1 2 2 2 2 2 How


  1. Permission Example public void deposit(unique Account account, immutable Amount amount) {...} public void withdraw(unique Account account, immutable Amount amount) {...} public void transfer(unique Account from, unique Account to, immutable Amount amount) { withdraw(from, amount); deposit(to, amount); unique immutable // to: from: amount: unique } 40

  2. Permission Example public void deposit(unique Account account, immutable Amount amount) {...} public void withdraw(unique Account account, immutable Amount amount) {...} public void transfer(unique Account from, unique Account to, immutable Amount amount) { withdraw(from, amount); deposit(to, amount); // to: from: amount: unique unique immutable } 41

  3. Permission Example public void deposit(unique Account account, immutable Amount amount) {...} public void withdraw(unique Account account, immutable Amount amount) {...} public void transfer(unique Account from, unique Account to, immutable Amount amount) { withdraw(from, amount); deposit(to, amount); // to: from: amount: unique unique immutable } 42

  4. Permission Example public void deposit(unique Account account, immutable Amount amount) {...} public void withdraw(unique Account account, immutable Amount amount) {...} unique public void transfer(unique Account from, unique Account to, unique immutable immutable Amount amount) { immutable withdraw(from, amount); deposit(to, amount); // to: from: amount: amount: } 43

  5. Using Permissions for Parallelization • infer permissions flow based on lexical order • define operations can run in parallel iff intersection of their required permissions does not contain unique permissions 44

  6. Dataflow Example unique unique immutable immutable transfer(unique Account from, unique Account to, immutable Amount amount) from: to: amount: 45

  7. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) unique unique immutable immutable from: to: amount: 46

  8. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) unique unique immutable immutable from: to: amount: withdraw(from, amount) deposit(to, amount) 47

  9. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) unique unique immutable immutable from: to: amount: amount: split withdraw(from, amount) deposit(to, amount) 48

  10. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) unique unique from: to: split immutable immutable amount: amount: withdraw(from, amount) deposit(to, amount) 49

  11. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split unique immutable immutable unique from: amount: amount: to: withdraw(from, amount) deposit(to, amount) 50

  12. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split unique immutable immutable unique from: amount: amount: to: withdraw(from, amount) deposit(to, amount) 51

  13. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split withdraw(from, amount) deposit(to, amount) unique immutable immutable unique from: amount: amount: to: 52

  14. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split withdraw(from, amount) deposit(to, amount) unique immutable immutable unique from: amount: amount: to: join } 53

  15. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split withdraw(from, amount) deposit(to, amount) unique unique from: to: join immutable immutable amount: amount: } 54

  16. Dataflow Example transfer(unique Account from, unique Account to, immutable Amount amount) split withdraw(from, amount) deposit(to, amount) join unique unique immutable immutable from: to: amount: amount: } 55

  17. Dataflow Example unique immutable immutable unique transfer(unique Account from, unique Account to, immutable Amount amount) split withdraw(from, amount) deposit(to, amount) join from: to: amount: amount: } 56

  18. Shared Data Issues • causes non-determinism but sometimes order matters • e.g., object that needs to follow protocol • all accesses to shared objects require synchronization • sometimes shared permissions are unavoidable • e.g., doubly linked list 57

  19. Data Groups • bundle shared objects into data groups • abstract collection of objects • disjoint partitions of heap 58

  20. Data Groups • bundle shared objects into data groups • abstract collection of objects • disjoint partitions of heap 58

  21. Data Groups • bundle shared objects into data groups • abstract collection of objects • disjoint partitions of heap 58

  22. Data Groups • bundle shared objects into data groups • abstract collection of objects • disjoint partitions of heap 58

  23. Data Groups Permissions • similar to access permissions for data groups • manual split/joining by user • user controlled mechanism for granularity 59

  24. Data Groups Permissions • similar to access permissions for data groups • manual split/joining by user • user controlled mechanism for granularity 59

  25. Data Groups Permissions • data groups are embedded in objects • strong encapsulation, ownership • group permissions are derived from receiver permissions 60

  26. Group Permissions Exclusive Permission • aliases = 1 • access= RW exclusive shared shared • “thread local” • no synchronization 61

  27. Group Permissions Shared Permission • aliases = N split • access= none exclusive • “shared data” shared protected shared • requires synchronization 62

  28. Group Permissions atomic Permission • aliases = 1 exclusive • access= RW • “protected ” shared shared • is synchronized atomic protected 63

  29. Group Permissions Shared Permission • aliases = N split • access= none exclusive • “shared data” shared protected shared • requires synchronization 64

  30. Group Permissions Exclusive Permission • aliases = 1 • access= RW exclusive shared shared • “thread local” • no synchronization 65

  31. Data Group Example class DLLItem { O1 O2 O3 public Object data; public DLLItem prev; DLL I1 I2 I3 public DLLItem next; } public class DLL { private DLLItem head; public void add(Object data) { DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 66

  32. Data Group Example class DLLItem { O1 O2 O3 public Object data; public DLLItem prev; DLL I1 I2 l3 public DLLItem next; } public class DLL { private DLLItem head; public void add( Object data) { DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 67

  33. Data Group Example class DLLItem { O1 O2 O3 public Object data; public shared DLLItem prev; DLL I1 l2 l3 public shared DLLItem next; } public class DLL { private shared DLLItem head; public void add( Object data) { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 68

  34. Data Group Example class DLLItem { O1 O2 O3 public unique Object data; public shared DLLItem prev; DLL I1 l2 l3 public shared DLLItem next; } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 69

  35. Data Group Example class DLLItem { O1 O2 O3 public unique Object data; public shared DLLItem prev; DLL I1 l2 l3 public shared DLLItem next; } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 70

  36. Data Group Example class DLLItem { O1 O2 O3 public unique Object data; public shared DLLItem prev; DLL I1 l2 l3 public shared DLLItem next; } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 71

  37. Data Group Example class DLLItem { O1 O2 O3 public unique Object data; public shared DLLItem prev; DLL I1 l2 l3 public shared DLLItem next; } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem li = new DLLItem(); this.head.prev = li; ERROR: li.next = this.head; li.data = data; Access shared this.head = li; } data } 71

  38. Data Group Example class DLLItem { public unique Object data; O1 O2 O3 public shared DLLItem prev; public shared DLLItem next; DLL I1 l2 l3 } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) : unique { atomic { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } } 72

  39. Data Group Example class DLLItem { public unique Object data; O1 O2 O3 public shared DLLItem prev; public shared DLLItem next; DLL I1 l2 l3 } public class DLL { private shared DLLItem head; public void add(unique >> none Object data) : unique { atomic { shared DLLItem li = new DLLItem(); this.head.prev = li; li.next = this.head; li.data = data; Unique receiver this.head = li; } means no aliases } } 72

  40. Data Group Example class DLLItem { public unique Object data; O1 O2 O3 public shared DLLItem prev; public shared DLLItem next; } DLL I1 l2 l3 public class DLL { group nodes; private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem li = new DLLItem (); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 73

  41. Data Group Example class DLLItem<G> { public unique Object data; O1 O2 O3 public shared DLLItem<G> prev; public shared DLLItem<G> next; } DLL I1 l2 l3 public class DLL { group nodes; private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem li = new DLLItem (); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 74

  42. Data Group Example class DLLItem<G> { public unique Object data; O1 O2 O3 public shared DLLItem<G> prev; public shared DLLItem<G> next; } DLL I1 l2 l3 public class DLL { group nodes; private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem<nodes> li = new DLLItem<nodes>(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 75

  43. Data Group Example class DLLItem<G> { public unique Object data; O1 O2 O3 public shared DLLItem<G> prev; public shared DLLItem<G> next; } DLL I1 l2 l3 public class DLL { group nodes; private shared DLLItem head; public void add(unique >> none Object data) : unique { shared DLLItem<nodes> li = new DLLItem<nodes>(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } 75

  44. Data Group Example class DLLItem<G> { public unique Object data; O1 O2 O3 public shared DLLItem<G> prev; public shared DLLItem<G> next; } DLL I1 l2 l3 public class DLL { group nodes; private shared DLLItem head; public void add(unique >> none Object data) : unique { unpack { shared DLLItem<nodes> li = new DLLItem<nodes>(); this.head.prev = li; li.next = this.head; li.data = data; this.head = li; } } } 76

  45. Data Group Example public void add(unique >> none Object data) : unique { unique unique // this: data: unpack { ... li.data = data; } } 77

  46. Data Group Example public void add(unique >> none Object data) : unique { // this: data: unique unique unpack { ... li.data = data; } } 78

  47. Data Group Example public void add(unique >> none Object data) : unique { unpack { // this: this.nodes: data: unique unique exclusive ... li.data = data; } } 79

  48. Data Group Example public void add(unique >> none Object data) : unique { unpack { ... // this: this.nodes: data: unique unique exclusive li.data = data; } } 80

  49. Data Group Example public void add(unique >> none Object data) : unique { unpack { ... data: li.data = data; unique // this: this.nodes: unique exclusive } } 81

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