Unlocking Data Race Freedom in Task Parallel Programs

proving data race freedom in task parallel n.w
1 / 67
Embed
Share

Explore how proving data race freedom in task parallel programs is achievable using a weaker partial order methodology. Delve into the challenges of handling data races, executing various histories, considering many schedules for proof, and ensuring soundness across executions. Witness how the sequences of events play a crucial role in determining values and identifying data race instances.

  • Data Race
  • Task Parallel Programs
  • Partial Order
  • Parallel Program Verification
  • Execution Histories

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Proving Data Race Freedom in Task Parallel Programs Using a Weaker Partial Order Benjamin Ogles, Peter Aldous, and Eric Mercer Brigham Young University

  2. Data Race Two unordered accesses to the same location with at least one being a write Input Sequentially consistent memory model Single lock for critical all sections

  3. Many Schedules To Consider for Proof Parallel Program Input All Histories Generator Massive Set of Possible Histories Infeasible to check every history

  4. Happens-before Soundly Partitions Histories All Histories 1 4 3 2 5 6 7 9 8 Check representative from each partition for proof

  5. Prove Does-not-Commute Soundly Weakens Happens-before All Histories 2 1 3 4 5 Check many fewer representatives for proof

  6. Execution Histories T0 Acq l T0 Read x T0 Rel l T1 Acq l T1 Write x T1 Rel l T0 Write y

  7. Execution Histories T0 Acq l T0 Read x T0 Rel l T1 Acq l T1 Write x T1 Rel l T0 Write y T1 Acq l T1 Write x T1 Rel l T0 Acq l T0 Read x T0 Rel l T0 Write y

  8. Execution Histories T0 T1 T0 T1 Acq l Write x Rel l Acq l Read x Rel l Acq l Read x Rel l Write y Acq l Write x Rel l Write y

  9. History Determines Value Read T0 T1 T0 T1 Acq l Write x Rel l Acq l Read x Rel l Acq l Read x Rel l Write y Acq l Write x Rel l Write y Must consider each interesting history

  10. Data Race Witness T0 Acq l Write y Rel l Read x T1 Write x Acq l Read y Rel l

  11. Witness Trace T0 Acq l Write y Rel l Read x T1 Write x Acq l Read y Rel l

  12. Witness Trace is Not Always the History Observed T0 Acq l Write y Rel l T1 Write x Acq l Read y Rel l Read x

  13. Infer Witness from Non-witness T0 T1 T0 T1 Acq l Write y Rel l Write x Acq l Read y Rel l Read x

  14. Infer Witness from Non-witness T0 T1 T0 Acq l Write y Rel l T1 Acq l Write y Rel l Write x Acq l Read y Rel l Write x Read x Acq l Read y Rel l Read x

  15. Must Preserve Thread Order T0 T1 T0 Acq l Write y Rel l T1 Acq l Write y Rel l Write x Acq l Read y Rel l Write x Read x Acq l Read y Rel l Read x

  16. Reads See Same Writes T0 T1 T0 Acq l Write y Rel l T1 Acq l Write y Rel l Write x Acq l Read y Rel l Write x Read x Acq l Read y Rel l Read x

  17. Happens-Before (Lamport 1978) T0 Acq l Write y Rel l T1 Write x Acq l Read y Rel l Read x

  18. Naturally Preserves the Properties T0 Acq l Write y Rel l T1 Write x Read x Acq l Read y Rel l

  19. Feasible Histories

  20. Observe a History Feasible Histories

  21. Infer Other Histories from Partial Order Feasible Histories

  22. Weaken Partial Order To Infer More Feasible Histories But may infer infeasible histories that data race

  23. Sound Weakened Partial Orders Feasible Histories Data-race in infeasible implies real exists with same race

  24. Happens-before Sound to First Race T0 ... Acq l Write y Rel l T1 ... Read x Write x Acq l Read y Rel l ... ...

  25. Anything After Witness is Unsound T0 ... Acq l Write y Rel l Write x T1 ... Read x Acq l Read y Rel l ... ...

  26. Weaken To Make Bigger Partitions Feasible Histories And only worry about first data race

  27. Does-not-Commute (Roemer 2019) T0 Acq l Write x Rel l Write z Acq l Write y Rel l T1 Acq l Write x Rel l Read z Only order Rel with conflicting event in critical sections

  28. Infers Witness from Original History T0 Acq l Write x Rel l T1 Acq l Write x Rel l Write z Read z Acq l Write y Rel l

  29. Happens Before Cannot Infer Witness T0 Acq l Write x Rel l Write z Acq l Write y Rel l T1 Acq l Write x Rel l Read z

  30. But Does-not-Commute Also Infers Infeasible Histories T0 Acq l Write x Rel l Write z Acq l Write y T1 Acq l Write x Rel l Rel l Read z Not an issue if inferred data race is real

  31. Mechanize Proof in Coq A feasible trace exists to witness the first data-race inferred by the does-not- commute partial order from an observed history The inferred non-feasible histories are the rub

  32. Causal Events T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y Anything does-not-commute ordered before race events

  33. Witness Order Strengthens Does- not-commute on Causal Events T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y Anything does-not-commute ordered before race events

  34. Witness Order Strengthens Does- not-commute on Causal Events T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y Plus Rel to Acq event orders from observed history

  35. Witness Order Strengthens Does- not-commute on Causal Events T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y And any Acq with no matching release after all other Rels

  36. Witness Order is Anti-symmetric T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y Thus can be extended to a total order witness trace

  37. Lemma Relies on Single Lock Property and Causal Events to Avoid Cycles T0 T1 Acq l Read x Rel l Acq l Write x Read y Rel l Acq l Read z Rel l Write y Only one unmatched Acq may exist but matched Rel not causal so no cycle

  38. Extend Witness Order to Total Order T0 T1 Acq l Read x Rel l Acq l Read z Rel l Acq l Write x It antisymmetric after all

  39. Add in the data race T0 T1 Acq l Read x Rel l Acq l Read z Rel l Acq l Write x Read y Write y

  40. Guaranteed to be Enabled T0 T1 Acq l Read x Rel l Acq l Read z Rel l Acq l Write x Read y Write y Because it includes all causal events

  41. Guaranteed to be Enabled T0 T1 Acq l Read x Rel l Acq l Read z Rel l Acq l Write x Read y Write y And keeps thread order, locking, writes-to-reads, and first race

  42. Result The Does-not-Commute relation is sound for single-lock programs. But is it complete---infers race if one is possible?

  43. Does-not-commute Cannot Infer this data-race T0 T1 Acq l Write x Rel l Acq l Write x Rel l Write x

  44. Even Though it has a Witness Trace T0 T1 Acq l Write x Rel l Acq l Write x Write x Rel l

  45. And Would Have Been Inferred From a Different Observed History T0 T1 Acq l Write x Rel l Write x Acq l Write x Rel l

  46. Weak Does-not-Commute T0 Acq l Write x Rel l T1 Acq l Write x Rel l Write x Doesn t order write-only conflicts

  47. But Now Which Writes Races? T0 Acq l Write x Rel l T1 Acq l Write x Rel l Write x

  48. Strengthen Data Race Definition T0 Acq l Write x Rel l T1 Acq l Write x Rel l Write x Two conflicting events and at least one not in a critical section

  49. Weak-Does-not-Commute Sound with the strengthened definition of data race But we don t know if it is complete

  50. Model Checking T0 T0 T1 Read y T1 Acq l Read x Rel l Acq l Write x Rel l ... ... Dynamic Partial Order Reduction (Flanagan 2005)

Related


More Related Content