How TotalView Creates Groups
TotalView places processes and threads in groups as your program creates them, except for the lockstep groups that are created or changed whenever a process or thread hits an action point or is stopped for any reason. There are many ways to build this type of organization. The following steps indicate how TotalView might do this.
Step 1
TotalView and your program are launched, and your program begins executing.
Figure 206, Step 1: A Program Starts
*Control group: The program is loaded and creates a group.
*Share group: The program begins executing and creates a group.
*Workers group: The thread in the main() routine is the workers group.
*Lockstep group: There is no lockstep group because the thread is running. (Lockstep groups contain only stopped threads.)
Step 2
The program creates a thread.
Figure 207, Step 2: A Thread is Started
*Control group: The control group is unchanged.
*Share group: The share group is unchanged.
*Workers group: TotalView adds the thread to the existing group.
*Lockstep group: There are no lockstep groups because the threads are running.
Step 3
The first process uses the exec() function to create a second process, Figure 208.
Figure 208, Step 3: Creating a Process using exec()
*Control group: The group is unchanged.
*Share group: TotalView creates a second share group with the process created by the exec() function as a member. TotalView removes this process from the first share group.
*Workers group: Both threads are in the workers group.
*Lockstep group: There are no lockstep groups because the threads are running.
Step 4
The first process hits a breakpoint.
*Control group: The group is unchanged.
*Share group: The groups are unchanged.
*Workers group: The group is unchanged.
*Lockstep group: TotalView creates a lockstep group whose member is the thread of the current process. (In this example, each thread is its own lockstep group.)
Step 5
The program is continued and TotalView starts a second version of your program from the shell. You attach to it within TotalView and put it in the same control group as your first process.
Figure 209, Step 5: Creating a Second Version
*Control group: TotalView adds a third process.
*Share group: TotalView adds this third process to the first share group.
*Workers group: TotalView adds the thread in the third process to the group.
*Lockstep group: There are no lockstep groups because the threads are running.
Step 6
Your program creates a process on another computer.
Figure 210, Step 6: Creating a Remote Process
*Control group: TotalView extends the control group so that it contains the fourth process, which is running on the second computer.
*Share group: The first share group now contains this newly created process, even though it is running on the second computer.
*Workers group: TotalView adds the thread within this fourth process to the workers group.
*Lockstep group: There are no lockstep groups because the threads are running.
Step 7
A process within the control group creates a thread. This adds a second thread to one of the processes.
Figure 211, Step 7: Creating a Thread
*Control group: The group is unchanged.
*Share group: The group is unchanged.
*Workers group: TotalView adds a fifth thread to this group.
*Lockstep group: There are no lockstep groups because the threads are running.
Step 8
A breakpoint is set on a line in a process executing in the first share group. By default, TotalView shares the breakpoint. The program executes until all three processes are at the breakpoint.
Figure 212, Step 8: Hitting a Breakpoint
*Control group: The group is unchanged.
*Share group: The groups are unchanged.
*Workers group: The group is unchanged.
*Lockstep groups: TotalView creates a lockstep group whose members are the four threads in the first share group.
Step 9
You tell TotalView to step the lockstep group.
Figure 213, Step 9: Stepping the Lockstep Group
*Control group: The group is unchanged.
*Share group: The groups are unchanged.
*Workers group: The group is unchanged.
*Lockstep group: The lockstep groups are unchanged. (There are other lockstep groups as explained in Chapter 26, Group, Process, and Thread Control .)
What Comes Next
This example could continue to create a more complicated system of processes and threads. However, adding more processes and threads would not change the described behavior.