alex cole university of leicester cpa 2012 dundee 26 th
play

Alex Cole University of Leicester CPA 2012, Dundee 26 th - PowerPoint PPT Presentation

Alex Cole University of Leicester CPA 2012, Dundee 26 th 29 th August Alistair A McEwan Geoff Mainland University of Leicester MicrosoF Research


  1. Alex ¡Cole ¡ University ¡of ¡Leicester ¡ CPA ¡2012, ¡Dundee ¡ 26 th ¡– ¡29 th ¡August ¡ Alistair ¡A ¡McEwan ¡ Geoff ¡Mainland ¡ University ¡of ¡Leicester ¡ MicrosoF ¡Research ¡

  2. par ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Process2(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Process3(); ¡ } ¡

  3. #define ¡par ¡\ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡for ¡( ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._ParStart(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._LoopCheck(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._LoopEnd()) ¡ __declspec((thead)) ¡CSPPP ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD; ¡

  4. class ¡CSPPP ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡std::stack<CSPPPScope ¡*> ¡m_scope; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡bool ¡m_loop; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡void ¡_ParStart() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡m_scope.push(new ¡ParScope()); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡m_loop ¡= ¡true; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡}; ¡ } ¡

  5. bool ¡_LoopCheck() ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡m_loop; ¡ } ¡ void ¡_LoopEnd() ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡CSPPPScope ¡* ¡run ¡= ¡m_scope.pop(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡run-­‑>_Run(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡m_loop ¡= ¡false; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡delete ¡run; ¡ } ¡

  6. par ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process2(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process3(); ¡ } ¡

  7. #define ¡proc ¡\ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_ ¡CSPPP_CURRENT_THREAD ¡= ¡new ¡ CSPPP ¡& ¡operator=(_Process ¡* ¡p) ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡m_scope.peek()-­‑>Add(p); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡*this; ¡ } ¡

  8. class ¡ParScope ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡std::list<_Process ¡*> ¡m_children; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡void ¡Add(_Process ¡* ¡p) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡m_children.add(p); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  9. void ¡Run() ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡Not ¡C++ ¡(for). ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡foreach ¡(_Process ¡* ¡c ¡: ¡m_children) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_ ¡CSPPP_CURRENT_THREAD ¡.Schedule(c); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_Yield(); ¡ } ¡

  10. par ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process2(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡seq ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process3(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process4(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  11. #define ¡par ¡\ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡for ¡( ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._SeqStart(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._LoopCheck(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡_CSPPP_CURRENT_THREAD._LoopEnd()) ¡

  12. class ¡SeqScope ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡void ¡Add(_Process ¡* ¡p) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡p-­‑>_Run(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡delete ¡p; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡void ¡Run() ¡{} ¡ } ¡

  13. chan ¡int ¡c1; ¡ par ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process2(c1); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡seq ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process3(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process4(c1); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  14. Chan<int> ¡c1; ¡ par ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process2(c1); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡seq ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process3(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡proc ¡Process4(c1); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  15. int ¡var ¡= ¡*chan; ¡ *chan ¡= ¡42; ¡ class ¡Chan ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ChanAccess ¡& ¡operator* ¡() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡m_access; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  16. class ¡Chan<T> ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ChanAccess<T> ¡& ¡operator* ¡() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡m_access; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  17. class ¡ChanAccess<T> ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡operator ¡T() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡ReadChannel(m_parent); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡}; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ChanAccess<T> ¡& ¡operator=(T ¡& ¡d) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡WriteChannel(m_parent, ¡d); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡*this; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ } ¡

  18. • No ¡working ¡scheduler ¡ • Crashes ¡randomly ¡(possibly ¡data ¡races) ¡ • Alternate ¡exishng ¡backend ¡

  19. ?

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