unit 2 operating system
unit 2 operating system
Process in memory
When a program is loaded into the memory and it becomes a process, it can be
divided into four sections ─ stack, heap, text and data. The following image
shows a simplified layout of a process inside main memory −
When a process executes, it passes through different states. These stages may
differ in different operating systems, and the names of these states are also not
standardized.
The process address space is the set of logical addresses that a process
references in its code. For example, when 32-bit addressing is in use,
addresses can range from 0 to 0x7fffffff; that is, 2^31 possible numbers,
for a total theoretical size of 2 gigabytes.
The operating system takes care of mapping the logical addresses to physical
addresses at the time of memory allocation to the program. There are three
types of addresses used in a program before and after memory is allocated :
Symbolic addresses
The addresses used in a source code. The variable names, constants, and
instruction labels are the basic elements of the symbolic address space.
Relative addresses
Physical addresses
The loader generates these addresses at the time when a program is loaded
into main memory.
The set of all logical addresses generated by a program is referred to as
a logical address space. The set of all physical addresses corresponding to
these logical addresses is referred to as a physical address space.