concurrent message service
play

Concurrent Message Service M. Clemencic CERN - LHCb Forum on - PowerPoint PPT Presentation

Concurrent Message Service M. Clemencic CERN - LHCb Forum on Concurrent Programming Models and Frameworks 24-10-2012 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 1 / 11 Outline Introduction 1 Gaudi Concurrent


  1. Concurrent Message Service M. Clemencic CERN - LHCb Forum on Concurrent Programming Models and Frameworks 24-10-2012 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 1 / 11

  2. Outline Introduction 1 Gaudi Concurrent Message Service 2 Considerations and Summary 3 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 2 / 11

  3. Introduction Outline Introduction 1 Gaudi Concurrent Message Service 2 Considerations and Summary 3 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 3 / 11

  4. Introduction The problem Applications need logging tools Gaudi uses the class MessageSvc Logging must be concurrency-friendly concurrent message pushing sequential message handling preserve order avoid bottlenecks M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 4 / 11

  5. Gaudi Concurrent Message Service Outline Introduction 1 Gaudi Concurrent Message Service 2 Considerations and Summary 3 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 5 / 11

  6. Gaudi Concurrent Message Service Requirements Drop-in replacement message reporting is performed by only one method Concurrent input / sequential output central message queue Avoid interference with Algorithms/Modules execution deferred reporting execution in another thread Lock-free implementation use existing concurrency libraries/tools M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 6 / 11

  7. Gaudi Concurrent Message Service Requirements Drop-in replacement message reporting is performed by only one method Concurrent input / sequential output central message queue Avoid interference with Algorithms/Modules execution deferred reporting execution in another thread Lock-free implementation use existing concurrency libraries/tools M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 6 / 11

  8. Gaudi Concurrent Message Service Requirements Drop-in replacement message reporting is performed by only one method Concurrent input / sequential output central message queue Avoid interference with Algorithms/Modules execution deferred reporting execution in another thread Lock-free implementation use existing concurrency libraries/tools M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 6 / 11

  9. Gaudi Concurrent Message Service Requirements Drop-in replacement message reporting is performed by only one method Concurrent input / sequential output central message queue Avoid interference with Algorithms/Modules execution deferred reporting execution in another thread Lock-free implementation use existing concurrency libraries/tools M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 6 / 11

  10. Gaudi Concurrent Message Service Implementation � TBB & C++11 Using Intel R std::atomic tbb::concurrent_queue tbb::task tbb::task::enqueue Generic SerialTaskQueue from TBB pattern Local Serializer M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  11. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  12. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Algorithm’s first message. delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  13. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Algorithm’s second message. delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  14. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Queue is free: schedule new task. delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  15. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Report task started. delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  16. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Queue is busy: just append. delete wait completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  17. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Report task completed: delete wait schedule new task. completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  18. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Report task may start before the delete wait completed previous one returned. destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  19. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() The destructor of SerialTaskQueue delete wait completed is blocking. destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  20. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Report task completed: delete wait stop waiting. completed destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  21. Gaudi Concurrent Message Service Implementation : Algorithm : MessageSvc : SerialTaskQueue : TBB � TBB & C++11 Using Intel R new std::atomic Processing Processing message1 tbb::concurrent_queue add() task::enqueue tbb::task report() tbb::task::enqueue Generic SerialTaskQueue message2 add() from TBB pattern Local Serializer completed task::enqueue report() Delete may complete before the delete wait completed task returns. destroyed M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 7 / 11

  22. Considerations and Summary Outline Introduction 1 Gaudi Concurrent Message Service 2 Considerations and Summary 3 M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 8 / 11

  23. Considerations and Summary Considerations (1/2) SerialTaskQueue is relatively simple and lightweight can be used for other complex tasks Concept available in libdispatch not tried yet enqueue vs. spawn vs. continuation continuation → run immediately in the same thread spawn → run ASAP , better if in the same thread enqueue → run later, when you have time M. Clemencic (CERN - LHCb) Concurrent Message Service 24-10-2012 9 / 11

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