Adress Space

Process Address Space in 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

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 –

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. 
  • 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.