work stealing scheduler
play

WORK STEALING SCHEDULER 2 6/16/2010 Work Stealing - PowerPoint PPT Presentation

1 6/16/2010 Work Stealing Scheduler WORK STEALING SCHEDULER 2 6/16/2010 Work Stealing Scheduler Announcements Text books Assignment 1 Assignment


  1. 1 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ WORK ¡STEALING ¡ SCHEDULER ¡

  2. 2 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Announcements ¡ • Text ¡books ¡ • Assignment ¡1 ¡ • Assignment ¡0 ¡results ¡ • Upcoming ¡Guest ¡lectures ¡

  3. 3 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Recommended ¡Textbooks ¡ PaQerns ¡for ¡Parallel ¡ The ¡Art ¡of ¡MulLprocessor ¡ ¡ Programming ¡ Programming ¡ Timothy ¡MaQson, ¡et.al. ¡ Maurice ¡Herlihy, ¡Nir ¡Shavit ¡ Parallel ¡Programming ¡with ¡ ¡ MicrosoT ¡.NET ¡ hQp://parallelpaQerns.codeplex.com/ ¡

  4. 4 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Available ¡on ¡Website ¡ • Assignment ¡1 ¡(due ¡two ¡weeks ¡from ¡now) ¡ • Paper ¡for ¡Reading ¡Assignment ¡1 ¡(due ¡next ¡week) ¡

  5. 5 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Assignment ¡0 ¡ • Thanks ¡for ¡submiXng ¡ ¡ • Provided ¡important ¡feedback ¡to ¡us ¡

  6. 6 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Percentage ¡Students ¡Answering ¡Yes ¡ 100 ¡ 80 ¡ 60 ¡ 40 ¡ 20 ¡ 0 ¡

  7. 7 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Number ¡of ¡Yes ¡Answers ¡Per ¡Student ¡ 14 ¡ 12 ¡ 10 ¡ 8 ¡ 6 ¡ 4 ¡ 2 ¡ 0 ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡

  8. 8 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Upcoming ¡Guest ¡Lectures ¡ • Apr ¡12: ¡Todd ¡Mytkowicz ¡ ¡ • How ¡to ¡(and ¡not ¡to) ¡measure ¡performance ¡ • Apr ¡19: ¡Shaz ¡Qadeer ¡ • Correctness ¡SpecificaLons ¡and ¡Data ¡Race ¡DetecLon ¡

  9. 9 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Last ¡Lecture ¡Recap ¡

  10. 10 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Last ¡Lecture ¡Recap ¡ • Parallel ¡computaLon ¡can ¡be ¡represented ¡as ¡a ¡DAG ¡ • Nodes ¡represent ¡sequenLal ¡computaLon ¡ • Edges ¡represent ¡dependencies ¡ SequenLal ¡ ¡Sort ¡ Split ¡ Merge ¡ SequenLal ¡Sort ¡ Time ¡

  11. 11 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Last ¡Lecture ¡Recap ¡ • ¡ ¡

  12. 12 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Last ¡Lecture ¡Recap ¡ • ¡ ¡

  13. 13 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Last ¡Lecture ¡Recap ¡ • ¡ ¡

  14. 14 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ This ¡Lecture ¡ • Design ¡of ¡a ¡greedy ¡scheduler ¡ • Task ¡abstracLon ¡ • TranslaLng ¡high-­‑level ¡abstracLons ¡to ¡tasks ¡

  15. 15 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ This ¡Lecture ¡ • Design ¡of ¡a ¡greedy ¡scheduler ¡ • Task ¡abstracLon ¡ • TranslaLng ¡high-­‑level ¡abstracLons ¡to ¡tasks ¡ .NET ¡ .NET ¡ Program ¡ Scheduler ¡ … ¡ Intel ¡ TBB ¡ TBB ¡ Program ¡

  16. 16 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ (Simple) ¡Tasks ¡ • A ¡node ¡in ¡the ¡DAG ¡ • ExecuLng ¡a ¡task ¡generates ¡dependent ¡subtasks ¡ Sort(4) ¡ Split(8) ¡ Merge(8) ¡ Sort(4) ¡ Split(16) ¡ Merge(16) ¡ Sort(4) ¡ Split(8) ¡ Merge(8) ¡ Sort(4) ¡

  17. 17 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ (Simple) ¡Tasks ¡ • A ¡node ¡in ¡the ¡DAG ¡ • ExecuLng ¡a ¡task ¡generates ¡dependent ¡subtasks ¡ • Note: ¡Task ¡C ¡is ¡generated ¡by ¡A ¡or ¡B, ¡whoever ¡finishes ¡last ¡ A ¡ Sort(4) ¡ C ¡ Split(8) ¡ Merge(8) ¡ Sort(4) ¡ B ¡ Split(16) ¡ Merge(16) ¡ Sort(4) ¡ Split(8) ¡ Merge(8) ¡ Sort(4) ¡

  18. 18 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Design ¡Constraints ¡of ¡the ¡Scheduler ¡ • The ¡DAG ¡is ¡generated ¡dynamically ¡ • Based ¡on ¡inputs ¡and ¡program ¡control ¡flow ¡ • The ¡graph ¡is ¡not ¡known ¡ahead ¡of ¡Lme ¡ • The ¡amount ¡of ¡work ¡done ¡by ¡a ¡task ¡is ¡dynamic ¡ • The ¡weight ¡of ¡each ¡node ¡is ¡not ¡know ¡ahead ¡of ¡Lme ¡ • Number ¡of ¡processors ¡P ¡can ¡change ¡at ¡runLme ¡ • Hardware ¡processors ¡are ¡shared ¡with ¡other ¡processes, ¡kernel ¡

  19. 19 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Design ¡Requirements ¡of ¡the ¡Scheduler ¡

  20. 20 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Design ¡Requirements ¡of ¡the ¡Scheduler ¡ • Should ¡be ¡greedy ¡ • A ¡processor ¡cannot ¡be ¡idle ¡when ¡tasks ¡are ¡pending ¡ • Should ¡limit ¡communicaLon ¡between ¡processors ¡ • Should ¡schedule ¡related ¡tasks ¡in ¡the ¡same ¡processor ¡ • Tasks ¡that ¡are ¡likely ¡to ¡access ¡the ¡same ¡cachelines ¡

  21. 21 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ AQempt ¡0: ¡Centralized ¡Scheduler ¡ • “Manager ¡distributes ¡tasks ¡to ¡others” ¡ • Manager: ¡assigns ¡tasks ¡to ¡workers, ¡ensures ¡no ¡worker ¡ is ¡idle ¡ • Workers: ¡On ¡task ¡compleLon, ¡submit ¡generated ¡tasks ¡ to ¡the ¡manager ¡

  22. 22 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ AQempt ¡1: ¡Centralized ¡Work ¡Queue ¡ • “All ¡processors ¡share ¡a ¡common ¡work ¡queue” ¡ • Every ¡processor ¡dequeues ¡a ¡task ¡from ¡the ¡work ¡queue ¡ • On ¡task ¡compleLon, ¡enqueue ¡the ¡generated ¡tasks ¡to ¡ the ¡work ¡queue ¡

  23. 23 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ AQempt ¡2: ¡Work ¡Sharing ¡ • “Loaded ¡workers ¡share” ¡ • Every ¡processor ¡pushes ¡and ¡pops ¡tasks ¡into ¡a ¡local ¡ work ¡queue ¡ • When ¡the ¡work ¡queue ¡gets ¡large, ¡send ¡tasks ¡to ¡other ¡ processors ¡

  24. 24 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Disadvantages ¡of ¡Work ¡Sharing ¡ • If ¡all ¡processors ¡are ¡busy, ¡ ¡each ¡will ¡spend ¡Lme ¡trying ¡ to ¡offload ¡ • “Perform ¡communicaLon ¡when ¡busy” ¡ • Difficult ¡to ¡know ¡the ¡load ¡on ¡processors ¡ • A ¡processor ¡with ¡two ¡large ¡tasks ¡might ¡take ¡longer ¡than ¡a ¡ processor ¡with ¡five ¡small ¡tasks ¡ • Tasks ¡might ¡get ¡shared ¡mulLple ¡Lmes ¡before ¡being ¡ executed ¡ • Some ¡processors ¡can ¡be ¡idle ¡while ¡others ¡are ¡loaded ¡ • Not ¡greedy ¡

  25. 25 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ AQempt ¡3: ¡Work ¡Stealing ¡ • “Idle ¡workers ¡steal” ¡ • Each ¡processor ¡maintains ¡a ¡local ¡work ¡queue ¡ • Pushes ¡generated ¡tasks ¡into ¡the ¡local ¡queue ¡ • When ¡local ¡queue ¡is ¡empty, ¡steal ¡a ¡task ¡from ¡another ¡ processor ¡

  26. 26 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Nice ¡ProperLes ¡of ¡Work ¡Stealing ¡ • ¡ ¡

  27. 27 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Nice ¡ProperLes ¡of ¡Work ¡Stealing ¡ • ¡ ¡

  28. 28 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Work ¡Stealing ¡Queue ¡Datastructure ¡ • A ¡specialized ¡deque ¡(Double-­‑Ended ¡Queue) ¡with ¡three ¡ operaLons: ¡ • Push ¡: ¡Local ¡processor ¡adds ¡newly ¡created ¡tasks ¡ ¡ • Pop ¡ ¡ ¡: ¡Local ¡processor ¡removes ¡task ¡to ¡execute ¡ • Steal ¡: ¡Remote ¡processors ¡remove ¡tasks ¡ Push ¡

  29. 29 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Work ¡Stealing ¡Queue ¡Datastructure ¡ • A ¡specialized ¡deque ¡(Double-­‑Ended ¡Queue) ¡with ¡three ¡ operaLons: ¡ • Push ¡: ¡Local ¡processor ¡adds ¡newly ¡created ¡tasks ¡ ¡ • Pop ¡ ¡ ¡: ¡Local ¡processor ¡removes ¡task ¡to ¡execute ¡ • Steal ¡: ¡Remote ¡processors ¡remove ¡tasks ¡ Push ¡ Pop? ¡ Pop? ¡ Steal? ¡ Steal? ¡

  30. 30 ¡ 6/16/2010 ¡ Work ¡Stealing ¡Scheduler ¡ Work ¡Stealing ¡Queue ¡Datastructure ¡ • A ¡specialized ¡deque ¡(Double-­‑Ended ¡Queue) ¡with ¡three ¡ operaLons: ¡ • Push ¡: ¡Local ¡processor ¡adds ¡newly ¡created ¡tasks ¡ ¡ • Pop ¡ ¡ ¡: ¡Local ¡processor ¡removes ¡task ¡to ¡execute ¡ • Steal ¡: ¡Remote ¡processors ¡remove ¡tasks ¡ Push ¡ Pop ¡ Steal ¡

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