Threads
The operating system owns the daemon programs discussed in the previous section. These daemons perform a variety of activities, from managing computer resources to providing standard services, such as printing.
If operating systems can have many independently executing components, why can't a program? Obviously, a program can and there are various ways to do this. One programming model splits the work off into somewhat independent tasks within the same process. This is the threads model.
This figure also shows the daemon processes that are executing. (The figures in the rest of this chapter don't show these daemons.)
In this computing model, a program (the main thread) creates threads. If they need to, these newly created threads can also create threads. Each thread executes relatively independently from other threads. You can, of course, program them to share data and to synchronize how they execute.
The debugging issue here is similar to the problem of processes running on different machines. In both, a debugger must intervene with more than one executing entity. It has to understand multiple address spaces and multiple contexts.
Note: There's not a lot of difference between a multithreaded or a multiprocess program when you are using TotalView. The way in which TotalView displays process information is very similar to how it displays thread information.