1 / 33

CAPP: Change-Aware Preemption Prioritization

CAPP: Change-Aware Preemption Prioritization. Vilas Jagannath , Qingzhou Luo , Darko Marinov Sep 6 th 2011. Motivation. Parallel code required for performance Dominant paradigm is shared-memory, multithreaded code Difficult to develop (correct) multithreaded code

omar
Télécharger la présentation

CAPP: Change-Aware Preemption Prioritization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CAPP: Change-Aware Preemption Prioritization Vilas Jagannath, QingzhouLuo, DarkoMarinov Sep 6th 2011

  2. Motivation • Parallel code required for performance • Dominant paradigm is shared-memory, multithreaded code • Difficult to develop (correct) multithreaded code • Different behavior under different schedules • Afflicted by bugs like data races, deadlocks, atomicity violations… • Difficult to test multithreaded code • Exploration required, time consuming • Current exploration techniques focus on one code version • Code evolves, need efficient regression testing • CAPP: Change-Aware Preemption Prioritization

  3. Apache Mina Test for filterWrite() @Test publicvoidtestFilterWriteThreadSafety() throwsInterruptedException{ … FilterWriteThreadfwThread1 = newFilterWriteThread(); FilterWriteThreadfwThread2 = newFilterWriteThread(); fwThread1.start(); fwThread2.start(); fwThread1.join(); fwThread2.join(); assertEquals(0, fwThread1.result); assertEquals(0, fwThread2.result); } classFilterWriteThreadextendsThread{ intresult= 0; ProtocolCodecFilter pc; … publicvoid run() { try{ pc.filterWrite(nextFilter, session, writeRequest); … } catch(Exception e) { e.printStackTrace(); result = 1; } } }

  4. Exploration S0 (S0, T1) (S0, T2) T2 T1 T2 T1 T1 Transition T1 T2 S.. S.. S3 S.. S2 S1 S.. Preemption Schedule

  5. Multithreaded Testing Code Test Test execution explores many schedules

  6. Exploration Order Eg. DFS: Stack BFS: Queue … Work Pool T1 T1 S1 S2 S0 (S0, T2) (S0, T1) (S1, T2) (S1, T1)

  7. Exploration Prioritization T2 T2 T1 T1 Next Work Pool Current Work Pool S.. (S.., T1) S.. S2 ….. ….. S1 Eg. CHESS Gambit Active Testing ConTest AVIO CTrigger … S0 (S0, T1) (S0, T2) (S1, T1) (S1, T2) (S.., T2)

  8. Regression Multithreaded Testing Code` Code Test

  9. Change-Unaware Prioritization Code` Code Test

  10. Change-Unaware Prioritization Code` Code Test

  11. CAPP:Change-Aware Preemption Prioritization Code` Code Test Use evolution information to prioritize exploration of schedules that perform preemptions at change impacted code. CAPP is a general framework. We instantiate with 14 heuristics.

  12. Apache Mina r912148 to r912149 publicvoidfilterWrite(NextFilternextFilter, IoSessionsession, WriteRequestwriteRequest) throwsException{ … flushWithoutFuture(); … } publicvoidflushWithoutFuture(){ Queue<Object> bufferQueue = getMessageQueue(); for(;;) { Object encodedMessage = bufferQueue.poll(); encodedMessage== null){ break; } if(// Flush only when the buffer has remaining. if(!(encodedMessageinstanceofIoBuffer) || ((IoBuffer) encodedMessage).hasRemaining()) { … } } } publicvoidfilterWrite(NextFilternextFilter, IoSession session, WriteRequestwriteRequest) throwsException{ … Queue<Object> bufferQueue = getMessageQueue(); while(!bufferQueue.isEmpty()){ Object encodedMessage = bufferQueue.poll(); // Flush only when the buffer has remaining. if(!(encodedMessageinstanceofIoBuffer) || ((IoBuffer) encodedMessage).hasRemaining()) { … } } … • DIRMINA-803 • 58 schedules to detect failure using CHESS • 5 schedules using one of the CAPP heuristics

  13. CAPP Parts

  14. Impacted Code Points (ICP) Collection Code Code` • Inspect structure diff to collect impacted: • Classes, Methods, Lines, Fields • Focus on changes to thread communication: • Expand synchronized blocks, methods • Fields accessed by changed lines • Fields accessed in methods called by changed lines

  15. Change-Aware Exploration Prioritization Next Work Pool Current Work Pool T2 T1 S1 S2 S0 (S0, T1) (S0, T2) Use ICPs to partition (S1, T1) (S1, T2) Use ICPs to partition

  16. Family of Heuristics • Defined by ICP Match Mode and Prioritization Mode • ICP Match Mode:Is transition impacted by changes? • Class (on Stack), Method (on Stack), Line (on Stack), Field • Prioritization Mode: Which work pool to add transitions to? • All, Some • 14 heuristics • CA (Class All) • … • MOS (Method on Stack Some)… • …

  17. ICP Match Mode • ICP Match Mode:Is transition impacted by changes? • Class (on Stack), Method (on Stack), Line (on Stack), Field ICPs: {………, class A,………….....} T1: Executing class A, method m, line 55 Class T2: Executing class B, method k, line 32 S.. (S.., T1) (S.., T2) (S.., T1)(S.., T2) (S.., T1) (S.., T2)

  18. Prioritization Mode • Prioritization Mode: Which work pool to add transitions to? • All: Only prioritize preemptions among impacted transitions • Some: Prioritize preemptions among impacted and not-impacted Next Work Pool Current Work Pool S.. (S.., T1) (S.., T2) (S.., T3) 18

  19. Prioritization Mode • Prioritization Mode: Which work pool to add transitions to? • All: Only prioritize preemptions among impacted transitions • Some: Prioritize preemptions among impacted and not-impacted Next Work Pool Current Work Pool S.. All (S.., T1) (S.., T2) (S.., T3) 19

  20. Prioritization Mode • Prioritization Mode: Which work pool to add transitions to? • All: Only prioritize preemptions among impacted transitions • Some: Prioritize preemptions among impacted and not-impacted Next Work Pool Current Work Pool S.. All (S.., T1) (S.., T2) (S.., T3) 20

  21. Prioritization Mode • Prioritization Mode: Which work pool to add transitions to? • All: Only prioritize preemptions among impacted transitions • Some: Prioritize preemptions among impacted and not-impacted Next Work Pool Current Work Pool S.. Some (S.., T1) (S.., T2) (S.., T3) 21

  22. Prioritization Mode • Prioritization Mode: Which work pool to add transitions to? • All: Only prioritize preemptions among impacted transitions • Some: Prioritize preemptions among impacted and not-impacted Next Work Pool Current Work Pool T1 S.. Some (S.., T1) (S.., T2) (S.., T3) 22

  23. Implementations • Two implementations • Java PathFinder (JPF) • Stateful exploration using checkpoints • Depth first, unbounded • CAPP implemented using a custom SimplePrioritySearch • ReEx • Stateless exploration using re-execution • CHESS (iterative context bound 2) • CAPP implemented using a custom SchedulingStrategy

  24. Evaluation Subjects • 15 multithreaded programs: • Ranging from 52-54,000 loc, with 2-607 classes, running 2-9 threads • Evolution from non-buggy version to buggy version • 7 deadlock faults, 8 data race and atomicity violation faults

  25. Experiments • Independent variables: • 14 heuristics • Statefulvs. Stateless exploration • Default exploration order vs. 50 Random exploration orders • 19,890 explorations, around a month of computing time • Measured savings in exploration cost compared to change-unaware exploration: • Transitions for JPF implementation • Schedules for ReEx implementation

  26. Default Non-Randomized Exploration 0.8x 2.7x 5.3x

  27. CAPP • Current multithreaded testing techniques focus on one code version • Code evolves, need techniques that leverage evolution info • CAPP uses evolution info to prioritize exploration: • Up to 5.3x average reduction in exploration cost • Ongoing work: • Regression Schedule Selection [ICST 10, STVR in revision] • Schedule Expression [ESEC/FSE 11] • Multithreaded Tests Generation

  28. Possible Project Ideas • Better impact analysis • Combine selection and prioritization (RMC) • Prioritize across tests • Multiple faults • Improve ReEx, revisit stateless randomized search (PRSS) • Combine IMUnit with CAPP • How to find/generate/simplify buggy IMUnit schedules? • How to decide whether some IMUnit schedules is valid or not after code evolves (a.k.a., identify bad concurrency bug fixes)?

  29. UPCRC • Universal Parallel Computing Research Center • Funded by Intel and Microsoft • Goal: improve parallelism for client computation • Two centers: Berkeley and Illinois • UPCRC Illinois • About 20 faculty + 40 grad students • Research on entire computation stack: architecture, runtime systems, compilers, programming languages, design patterns, applications… and testing

  30. Results Summary • Does CAPP help? • Up to 5.3x reduction on average • Only one heuristic (out of 28) increased cost (0.8x) • How do heuristics compare? • Field ICP Match Mode heuristics perform best • ALL Prioritization Mode heuristics perform best • Stateful vs. Stateless? • Greater benefit for stateless exploration • Default vs. Random? • Conclusions from random results similar to default results • Except ICP Match Mode • Detailed results in the paper

  31. Multicore World Shared Memory Multithreaded Performance!

  32. Correct Difficult to Develop Multithreaded Code • Scheduling non-determinism • Data races • Deadlocks • Atomicity violations • … Shared Memory Multithreaded

  33. Difficult to Test Multithreaded Code • Exploration required • Time consuming • Current techniques focus on one code version • Code evolves • Need efficient regression testing Code Test

More Related