Processes and Address Spaces

Click here to change the theme.

Programs (exe files) execute as a process. Each process has it's own address space. One way to help explain what a process is would be to say that the Task manager has a "Processes" tab that shows the processes in the system. The concept of a process is relatively easy to understand but a process's address space is often not understood as easily.

For a process, the address spaces of other processes are like an alternate universe in science fiction stories. In most science fiction stories, there are ways to get from one universe to another but it is usually difficult to do so. It is easy to understand this difficulty and the analogy is quite relevant to understanding the difficulty of accessing memory among processes. In science fiction, an identity in one universe is probably not the same as it is in another. An identity might not exist in another universe. You must assume that processes and their address spaces are much the same. Assume that any pointer for an address space points to totally different data (identities) in another address space (universe).

There are various mechanisms for processes to communicate. Most are called "Interprocess Communications" (IPC) functions. The easiest to use is the WM_COPYDATA message. The MFC classes CSemaphore, CMutex and CEvent can be used for IPC but they are relatively advanced. They are called "Synchronization Classes" by MFC but they can be used to synchronize events between and among processes. The CSharedFile MFC class provides the most common IPC mechanism but it is so advanced that I have not been able to use it (yet). Internally, CSharedFile uses the same Windows functions that Windows uses for the WM_COPYDATA message.