Process Address Space in Operating System (OS)

Process Address Space in OS

Address space is an important concept in the operating system. It is the volume of memory which is allocated for all the potential addresses associated with a computational unit such as a file, a device, a networked computer system, or a server.

operating system

Some Background

We need memory management in an OS since, we may need to move processes back and forth in and out for primary memory (RAM) and disk memory for process execution.

While memory management will keep track of all the memory locations even the unallocated memory and especially the allocated memory.

It also has additional tasks to –

  • Decide when and which process gets memory
  • Decides how much memory should be allocated to a process
  • Updating the status for whenever a memory gets free and updating its status
Process Address Space In OS

Definition of Process Address Space

Address space may also denote a range of physical or virtual addresses which can be accessed by a processor.

While a Process Address space is set of logical addresses that a process references in its code. For example, for a 32-bit address allowed, the addresses can range from 0 to 0x7fffffff; that is, 2^31 possible numbers

The OS here also has an additional job to map the logical addresses to the actual physical addresses too.

We have generally three different types of addressing systems used –

Type of AddressDescription
Symbolic addressesThere are mostly addresses referenced in a source code. The components can be -variable names, constants, and instruction labels.
Relative addressesWhere we compile anything, the compiler will convert symbolic addresses into some relative address
Physical addressesAfter the compilation when the program is loaded into main memory the loader will generate mapping to physical addresses

Components of a Process Address Space

  • The total amount of shared memory a system can allocate depends on several factors. The overall space may include sections such as stack space, program size required, memory mapped files, shared libraries, as well as memory allocated from the heap.
  • Memory allocation policies and address spaces used by the varied operating systems are complicated. They may also differ from one operating system to another. The figure below gives an overall layout of a generic process address space for a 32-bit operating system. 

More information (May not be relevant for exams)

  • Each section in the given address space is dedicated to performing a specific task and is present to perform an explicit task. The most common areas are the Kernel, program and program data, stack value, heap value, and global data including shared libraries, shared memory, or Dynamic Link Libraries. 

Learn about swapping here. 

  • The magnitude of each section in the address space depends on the type and power of the operating system. These sizes also affect the size of allocated segments of the shared memory. In the case of a 64-bit operating system, most of the computational limits are theoretical and may change depending on the available hardware.
  • Address spaces can be further differentiated as either flat or segmented. In the case of flat address spaces, the addresses are expressed as incremental values which start from zero. In the case of segmented address spaces, the addresses are represented as distinct segments augmented by offsets. Offsets are values that are added to generate secondary addresses.
  • These address spaces can be transformed in some systems from one format to another following a process known as Thunking.
  • Addresses spaces have also been linked with the IP address spaces. It is said that the developers of IPv4 had not initially anticipated the exponential expansion of the internet. For this reason, the IPv4 address spaces were updated with the IPv6 address spaces with higher bandwidth and address storage capacity.