Next: Synchronization
Up: Shared Memory Programming
Previous: Task Creation
Contents
Communication
Figure 4.9:
Serial process vs. parallel process and two parallel processes communicate using the shared data segment.
|
- In general, the address space on an executing process has three segments called the text, data, and stack (see Fig. 4.9a).
- The text is where the binary code to be executed is stored;
- the data segment is where the program's data are stored;
- the stack is where activation records and dynamic data are stored.
- The data and stack segments expand and contract as the program executes. Therefore, a gap is purposely left in between the data and stack segments.
- Serial processes are assumed to be mutually independent and do not share addresses. The code of each serial process is allowed to access
data in its own data and stack segments only.
- A parallel process is similar to the serial process plus an additional shared data segment. This shared area is allowed
to grow and is placed in the gap between private data and stack segments.
- Communication among parallel processes can be performed by writing to and reading from shared variables in the shared data segments as shown in Fig. 4.9b.
Next: Synchronization
Up: Shared Memory Programming
Previous: Task Creation
Contents
Cem Ozdogan
2006-12-27