Presentation is loading. Please wait.

Presentation is loading. Please wait.

Go4 CHEP 2001 Multithreaded Inter-Task Communication with ROOT -

Similar presentations


Presentation on theme: "Go4 CHEP 2001 Multithreaded Inter-Task Communication with ROOT -"— Presentation transcript:

1 Go4 CHEP 2001 Multithreaded Inter-Task Communication with ROOT -
GSI Online Offline Object Oriented Go4 Multithreaded Inter-Task Communication with ROOT - writing non-blocking GUIs J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel Go4 -

2 Contents Go4: Software layers and architecture Go4 Requirements
Multithreading (threadmanager library) Inter task communication (taskhandler library) Example: GUI task and analysis task GUI implemetation with ROOT-Qt Interface Demo (movie) Summary Go4 -

3 ROOT Framework Go4 Package Layers Go4 Event Analysis Loop (Client)
Go4 GUI (Server) Go4TaskHandler Qt Library Go4ThreadManager Interface TThread ROOT Framework Go4 -

4 On-line Analysis with non blocking GUI
Requirements of Go4 On-line Analysis with non blocking GUI Analysis based on ROOT Analysis runs permanently Analysis updates graphics asynchronously GUI is never blocked GUI controls and steers analysis Go4 -

5 Threadmanager library
Problems to solve Multithreading necessary ROOT classes not inherently thread save  lock object creation and ROOT services  nonblocking GUI and analysis: different tasks Communication between tasks Threadmanager library Taskhandler library Go4 -

6 Go4 Multitasking system
Only one working thread per task (object creation, memory allocation, ROOT system calls) Analysis and GUI in separate tasks (non blocking GUI, continuous analysis) Communication: raw socket transport (dedicated threads with TBuffer fields in TGo4Socket) Object streaming by ROOT (working thread uses TGo4Queue methods) Go4 -

7 Functional overview GUI Data Loop Display Task (Server)
Drawing Thread Logging Thread Useraction queue queue queue Launch Thread Task Handler Command Thread Data Thread Status Thread Connector Thread IP Network Data Loop Command Thread Data Thread Status Thread Task Handler Two tasks with each including threads and communicating via a transport implementation Display: GUI and X timer (for repeated requests, refresh) run in the main root gApplication loop; GUI callbacks send commands to analysis; Objects (e.g. histograms) are received from analysis by update thread; logger thread receives status information. Both threads and GUI share access to same graphics (Canvas, Listbox, Buttons..) Analysis: Event Loop runs as thread, same thread also executes dynamic commands (like histogram requests) and macros; Status thread sends current analysis state; Controlled from Display by Command thread: queues commands to Event Loop; may cancel/restart eventloop thread in case of latchup; controls a timer notify waiting for TCondition, which blocks the main root gApplication loop, since this showed to affect the thread stability (no TThread::Lock in TApplication). When root system loop is needed (thread restart, macro), block timer notify is released; next time it is blocked by condition wait again. => threadsave TApplication.Run in future? queue queue queue Analysis Tasks (Client 1,2,...) Work Thread Watcher Thread Go4 -

8  Go4 GUI Complex GUI Qt graphics library Rapid prototyping
professional, powerful, free, tools (QtDesigner), well documented Use ROOT and Qt together! no changes to ROOT sources Go4 GUI architecture: signal-slot mechanism (both Qt and ROOT) gui singleton: registry + dispatcher (modified mediator pattern) persistent status objects per window Go4 -

9 Go4 GUI: Qt-ROOT interface
QApplication TApplication QROOTApplication TQApplication Qt Eventloop QApplication::Exec() QTimer ROOT Eventloop TSystem::InnerLoop() TTimer TThread QWidget QWidget TSocket other... TQROOTCanvas QWidget TCanvas TRootGuiFactory TQRootGuiFactory TCanvasImp TQCanvasImp Go4 -

10 Go4 GUI: Qt-ROOT interface
Follows the general ROOT GUI ABC no changes in ROOT source necessary Inheritance from ROOT base classes TQRootGuiFactory (TRootGuiFactory) Qt Factory GUI components TQCanvasImp (TCanvasImp) creates a Qt independent main window (QMainWindow) sets TQRootCanvas as a central widget TQApplication (TApplication) ROOT environment set with a Qt GUI factory Inheritance from Qt base class QRootApplication (QApplication) enable Qt evt-loop to drive Qt based GUI applications call ROOT inner loop repeatedly to enable ROOT system events Go4 -

11 Qt Designer screenshot
Go4 -

12 Using Qt designer Go4 -

13 Go4 GUI design GUISingleton registry Display command dispatcher
status mediator commands Display taskhandler server IP data to analysis register (dependency) update Qt GUI Widgets Status Slots Qt GUI Widgets Status Slots Root GUI Widgets Status Slots Qt GUI Widgets Status Slots Go4 -

14 ready to use for any ROOT application
Summary Go4 thread manager package Go4 task handler package Go4 Qt-ROOT interface ready to use for any ROOT application Client task could be analysis framework, slow ctrl,... GUI task can use Qt graphics library Go4 analysis framework and GUI is being under development... Go4 -

15 Go4 demo monitored histograms ROOT canvas Control panel analysis
status Here comes the sun ... local objects remote objects Go4 -

16 Go4 demo Initializing a remote analysis
Control of analysis: run status, list object folders Monitor remote histograms continuously Get and update local object copies Working on local histograms (fit panel, save) ROOT TBrowser works in parallel Go4 Browser plots: superimpose, multiwindow Go4 -

17 Go4 demo Here comes the sun ... Go4 -

18 Go4 demo Here comes the sun ... Go4 -

19 Go4 demo Here comes the sun ... Go4 -

20 Go4 demo Here comes the sun ... Go4 -

21 Go4 demo regular ROOT TBrowser, works together with Qt 04.09.01
Here comes the sun ... Go4 -

22 Go4 demo Here comes the sun ... Go4 -


Download ppt "Go4 CHEP 2001 Multithreaded Inter-Task Communication with ROOT -"

Similar presentations


Ads by Google