Data Status Transition in Parallel Programs
In parallel programs following transition takes place:
- It is safe to work with the automatic local variables that are allocated on the stack. In a parallel region each thread of execution gets its own private stack- these variables are automatically private
- Especially hazardous are the static local variables. Since these are allocated on the heap, their address is the same in different threads
- Dynamic variables are mostly created on the heap , therefore shared in parallel program. However, when allocation happens from a parallel region these variables become private
- OpenMP syntax allows declaration of the status of each variable. However, in a call hierarchy the variables would assume their default status as specified above