Presentation is loading. Please wait.

Presentation is loading. Please wait.

3.8 static vs dynamic thread management

Similar presentations


Presentation on theme: "3.8 static vs dynamic thread management"— Presentation transcript:

1 3.8 static vs dynamic thread management
QT provides a pool of threads, applications gain performance by reusing threads When a thread is needed, an idle thread is selected from the pool This is more efficient even though thread creation is orders of magnitude faster than process creation, thread creation still takes time. Example listing 3.25

2 Creating and Managing a pool of threads
REQUIREMENTS Be able to describe computational tasks Communicate computational tasks Identify threads that are executing a task Signal the termination of a task’s execution

3 3.9Debugging Multithreaded Applications
GDB and DDD (data display debugger, a front end to GDB or DBX) Compile with –g Often time sensitive affected by the debugger

4 Steps to ensure bug free applications
Don’t introduce bugs Write bug free code Use a good design Use previously written programs adapted to specific application Create a log of programs execution Allow the threads to be variable Debugging 1 thread is easier than 10, 2 or 3 also easier

5 Printf or Cout Typically not sufficient
Output is intermixed via the threads Can write to a file myprog 2> trace.log Use a high resolution timer to time stamp messages #define DEBUG #ifdef DEBUG ……… #endif

6 More debugging hints Disable compiler optimizations
An optimization can (rarely) introduce bugs

7 Many example programs Qthreads Openmp MPI GPU


Download ppt "3.8 static vs dynamic thread management"

Similar presentations


Ads by Google