concurrent collections
play

CONCURRENT COLLECTIONS 2 5/24/11 Concurrent Collec9ons - PowerPoint PPT Presentation

1 5/24/11 Concurrent Collec9ons CONCURRENT COLLECTIONS 2 5/24/11 Concurrent Collec9ons Acknowledgements Slides and material from Kathleen Knobe (Intel)


  1. 1 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ CONCURRENT ¡COLLECTIONS ¡

  2. 2 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Acknowledgements ¡ • Slides ¡and ¡material ¡from ¡ • Kathleen ¡Knobe ¡(Intel) ¡ • Vivek ¡Sarkar ¡(Rice ¡University) ¡

  3. 3 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ CnC ¡– ¡Concurrent ¡Collec9ons ¡ • Declara9vely ¡specify ¡the ¡computa9on ¡ • And ¡the ¡ordering ¡constraints ¡ • Parallelism ¡is ¡implicit ¡ • Available ¡from ¡Intel ¡at ¡ ¡ • hPp://soRware.intel.com/en-­‑us/ar9cles/intel-­‑concurrent-­‑ collec9ons-­‑for-­‑cc/ ¡

  4. 4 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Two ¡Sources ¡of ¡Dependencies ¡ • Data ¡Dependency ¡(Producer ¡Consumer) ¡ • Consumer ¡of ¡a ¡data ¡cannot ¡execute ¡before ¡producer ¡has ¡ produced ¡the ¡data ¡ • Control ¡Dependency ¡ • Controllee ¡cannot ¡execute ¡unless ¡its ¡execu9on ¡is ¡determined ¡ as ¡necessary ¡by ¡the ¡Controller ¡

  5. 5 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Three ¡Kinds ¡of ¡Collec9ons ¡ • ( ¡Step ¡) ¡– ¡represents ¡computa9on ¡ • [ ¡Item ¡] ¡– ¡represents ¡data ¡ • < ¡Tag ¡> ¡– ¡represents ¡control ¡flow ¡

  6. 6 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Dynamic ¡Instances ¡of ¡Collec9ons ¡ • Mul9ple ¡instances ¡for ¡each ¡Step, ¡Item, ¡Tag ¡collec9ons ¡ at ¡run9me ¡ • Each ¡instance ¡has ¡a ¡unique ¡Tag ¡ • A ¡tag ¡is ¡a ¡tuple ¡of ¡values ¡

  7. 7 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Item ¡Collec9on ¡ • Each ¡(data) ¡item ¡instance ¡is ¡dynamically ¡wriPen ¡once ¡ • Persists ¡in ¡the ¡‘tuple ¡space’ ¡forever ¡ • Garbage ¡collec9on ¡is ¡implicit ¡ • Each ¡step ¡instance ¡can ¡ • Get() ¡mul9ple ¡item ¡instances ¡from ¡mul9ple ¡item ¡collec9ons ¡ • Put() ¡mul9ple ¡item ¡instance ¡into ¡mul9ple ¡item ¡collec9ons ¡ • Each ¡item ¡can ¡be ¡Get() ¡by ¡mul9ple ¡steps ¡instance ¡

  8. 8 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Step ¡Collec9on ¡ • Every ¡step ¡collec9on ¡is ¡“prescribed” ¡by ¡a ¡Tag ¡ collec9on ¡ • An ¡step ¡instance ¡with ¡tag ¡T ¡can ¡execute ¡only ¡if ¡T ¡is ¡present ¡in ¡ the ¡prescribed ¡Tab ¡collec9on ¡ • Each ¡(computa9on) ¡step ¡instance ¡is ¡of ¡the ¡form ¡ • A ¡sequence ¡of ¡Item ¡Get()s ¡ • Determins9c ¡side-­‑effect-­‑free ¡sequen9al ¡computa9on ¡ • A ¡func9on ¡of ¡the ¡tag ¡and ¡data ¡items ¡read ¡ • A ¡sequence ¡of ¡Item ¡Put()s ¡and ¡Tag ¡Put()s ¡

  9. 9 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Tag ¡Collec9on ¡ • Explicitly ¡specifies ¡the ¡control ¡flow ¡between ¡steps ¡ • A ¡tag ¡collec9on ¡might ¡control ¡mul9ple ¡step ¡collec9ons ¡ ¡

  10. 10 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Simple ¡Example ¡ • Break ¡an ¡input ¡string ¡into ¡sequences ¡of ¡repeated ¡ characters ¡ • Filter ¡only ¡strings ¡of ¡odd ¡length ¡

  11. 11 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Execu9on ¡Seman9cs ¡ • A ¡step ¡instance ¡becomes ¡“proscribed” ¡when ¡its ¡tag ¡is ¡available ¡ • A ¡step ¡instance ¡becomes ¡“inputs ¡available” ¡when ¡all ¡its ¡Get()s ¡ can ¡succeed ¡ • A ¡step ¡is ¡enabled ¡when ¡it ¡is ¡“proscribed” ¡and ¡“inputs ¡available” ¡ ¡ • Enabled ¡steps ¡will ¡eventually ¡be ¡executed ¡

  12. 12 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Control ¡Tags ¡Follow ¡Data ¡

  13. 13 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Graph ¡in ¡Textual ¡Form ¡ // control tags <int singletonTag: singleton>; <int spanTags: spanID>; // data items [string input <int>: singleton]; [string span <int>: spanID]; [string results <int>: spanID]; // proscription relation <singletonTag> :: (createSpan); <spanTags> :: (processSpan); // program inputs and outputs env -> [input]; env -> <singletonTag>; [results] -> env; // producer/consumer relations [input: singleton] -> (createSpan: singleton) -> <spanTags: spanID>, [span: spanID]; [span] -> (processSpan) -> [results];

  14. 14 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Coordina9on ¡Separated ¡from ¡Code ¡ int createSpan::execute(const int & t, partStr_context & c ) const { // Get input string string in; c.input.get(t, in); while (! in.empty()) { // construct span // … c.span.put(j, in.substr(j, len)); c.spanTags.put(j); // … } return CnC::CNC_Success; }

  15. 15 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Control ¡Separate ¡From ¡Data ¡ • Face ¡detec9on ¡through ¡a ¡cascading ¡sequence ¡of ¡ classifiers ¡

  16. 16 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Scheduling ¡Decisions ¡ • When ¡to ¡execute ¡enabled ¡steps ¡instances ¡ • Where ¡to ¡execute ¡enabled ¡step ¡instances ¡ • Specula9vely ¡execute ¡steps ¡whose ¡inputs ¡are ¡available ¡ • Based ¡on ¡availability ¡of ¡processor ¡resources ¡

  17. 17 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Differences ¡Between ¡Linda ¡and ¡CnC ¡

  18. 18 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Is ¡CnC ¡Determinis9c? ¡ • For ¡a ¡given ¡input, ¡does ¡CnC ¡generate ¡the ¡same ¡ output? ¡

  19. 19 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Program ¡Termina9on ¡ • A ¡CnC ¡program ¡terminates ¡when ¡ ¡ • No ¡step ¡instance ¡is ¡execu9ng ¡ • All ¡unexecuted ¡steps ¡are ¡not ¡enabled ¡ • Valid ¡program ¡termina9on ¡ • All ¡proscribed ¡steps ¡are ¡executed ¡ • i.e. ¡A ¡proscribed ¡step ¡s9ll ¡wai9ng ¡for ¡an ¡input ¡data ¡  ¡error ¡

  20. 20 ¡ 5/24/11 ¡ Concurrent ¡Collec9ons ¡ Garbage ¡Collec9on ¡ • An ¡item ¡once ¡produced ¡logically ¡stays ¡forever ¡ • Can ¡be ¡garbage ¡collected ¡when ¡no ¡future ¡step ¡instance ¡will ¡ issue ¡a ¡Get() ¡with ¡the ¡same ¡tag ¡ • A ¡difficult ¡analysis ¡problem ¡ • Current ¡implementa9on ¡ • User ¡provides ¡a ¡getCount() ¡method ¡ • Determines ¡the ¡number ¡of ¡steps ¡that ¡will ¡read ¡the ¡item ¡

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