Totalview® for HPC User Guide : PART II Debugging Tools and Tasks : Chapter 13 About Groups, Processes, and Threads : How TotalView Creates Groups
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 199 – 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 200 – 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 201.
Figure 201 – 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 202 – 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 203 – 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 204 – 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 205 – 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 206 – 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 22, "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.