POSIX Processes, Name Spaces and Virtual Memory

To be conformant with the POSIX®.1 standard, processes must be kept separate, and this is achieved through the use of memory protection and name spaces.

POSIX assumes that each process in a system resides in a different name space and has its own symbols tables. The Memory Management Unit (MMU) is used to physically isolate processes from each another so that they cannot trample on each other’s memory.

Also commonly referred to as “multiprocessing,” a process as defined by POSIX.1 will have its own name space. Two symbols defined globally will not conflict if they are located in two different processes, since they are in two different links.

Three processes mapped by the MMU into separate physical memory pages. Each process is virtually isolated from other processes and it is therefore impossible for one process to write over another process’ address space (unless the programmer intentionally performs address mappings).
mmu00a
  • An executing instance of a program is called a process.
  • A process is created when a parent process invokes the system call fork().
  • A process may choose to execute a new program with the system call execve(). The program is read from its file and loaded into memory.
  • A process owns one or more threads, which execute the program code. The first thread is created by execve(), and begins executing in the function called main().
  • The program may be coded with calls to pthread_create(), which create additional threads. Each thread is a flow of control within the process.

Processes and Virtual Memory

  • Each process is assigned its own private memory in RAM. These memory locations may be anywhere in
    RAM.
  • The addresses used within programs are virtual addresses, which are translated at run time to indicate the real memory locations.
  • The translations are private to a process, so that only the process that owns the memory locations can access them. This insures that each process can only see and change its own memory, and cannot damage the memory owned by another process.

The set of virtual addresses that a process can access are called the process’s virtual address space. A process virtual address space is composed of segments:

  • The text segment contains the program instructions.
  • The data segment contains global data and dynamically allocated data.
  • The stack segment contains the stacks owned by each thread.
  • Additional segments that are defined later.

The MMU translates the virtual addresses into physical addresses. If a process attempts to address a page that is not currently mapped to it, the MMU generates an exception. The exception sends a signal to the offending thread in which the default action is to terminate the process. Alteratively, the thread may catch the signal for user-defined actions, if desired.

For further information on MMUs, please read our technical white paper, “Using the Microprocessor MMU for Software Protection in Real-Time Systems.” For information about partition operating systems, visit our white paper, “Partitioning Operating Systems Versus Process-based Operating Systems.”