More on Threads
All threads aren't the same. The following figure shows a program with three threads.
Threads
|
For the moment, assume that all of these threads are "user threads"; that is, they are threads that perform some activity that you have programmed.
Note: Many computer architectures have something called "user mode," "user space", or something similar. "User threads" means something else. Without trying to be rigorous, the TotalView definition of a "user thread" is simply a unit of execution created by a program.
Other threads can also be executing. For example, the threads that are part of the operating environment are "manager threads". Things would be nice and easy if this was all there was to it. Unfortunately, all threads are not created equal and all threads do not execute equally. In most cases, a program creates manager-like threads. In the following figure, the horizontal threads at the bottom of the figure are user-created manager threads.
User Threads and Service Threads
|
As these user-created manager threads are designed to perform a service for other threads in the program, they can also be called "service threads".
One reason you need to know which of your threads are service threads is that this kind of thread performs different kinds of activities from other user threads. Because their activities are so different, they are usually developed separately and are not involved with the fundamental problems being solved by the program. For example, a service thread that dispatches messages sent from other threads may have bugs, but the bugs are of a different kind and the problems they have can most often be dealt with separately from bugs that would occur in non service user threads.
A second reason is that you do not want to wait for these threads when stepping your program because these threads will never get there.
In contrast, your user threads are the agents performing the actual work, and the interactions among them are where the action is. Being able to distinguish between the two kinds of threads means that you can focus on the threads and processes that are actively participating in an activity, rather than those sitting back and performing more subordinate activities.