To store the data and to manage the processes, we need a large-sized memory, and, at the same time, we need to access the data as fast as possible. But if we increase the size of memory, the access time will also increase, and, as we know, the CPU always generates addresses for secondary memory, i.e., logical addresses. But we want to access the main memory, so we need Address translation of logical address into a physical address.
The main memory interacts with both the user processes and the operating system. So we need to use the main memory efficiently. Main memory is divided into non-overlapping memory regions called partitions.
The main memory can be broadly allocated in two ways
1. Contiguous memory allocation can be categorized into two ways:
(i) Different Partition Allocation methods are used in Contiguous memory allocations
2. Non-Contiguous memory allocation can be categorized into many ways:
MMU(Memory Management Unit): The run-time mapping between the Virtual address and Physical Address is done by a hardware device known as MMU.
In memory management, the Operating System will handle the processes and move the processes between disk and memory for execution. It keeps track of available and used memory.
MMU scheme:
CPU------- MMU------Memory
The value in the relocation register is added to every address generated by a user process at the time the address is sent to memory. The user program never sees the real physical addresses. The program can create a pointer to location 346, store it in memory, manipulate it, and compare it with other addresses—all like the number 346.
The user program generates only logical addresses. However, these logical addresses must be mapped to physical addresses before they are used.
Address binding: Address binding is the process of mapping from one address space to another address space. A logical address is an address generated by the CPU during execution, whereas a Physical Address refers to the location in the memory unit(the one that is loaded into memory). The logical address undergoes translation by the MMU or addresses the translation unit in particular. The output of this process is the appropriate physical address or the location of code/data in RAM.
An address binding can be done in three different ways:
In Contiguous memory allocation, mapping from virtual addresses to physical addresses is not a difficult task because if we take a process from secondary memory and copy it to the main memory, the addresses will be stored in a contiguous manner, so if we know the base address of the process, we can find out the next addresses.
The Memory Management Unit is a combination of 2 registers
In Non-Contiguous Memory allocation, processes can be allocated anywhere in available space. The address translation in non-contiguous memory allocation is difficult.
There are several techniques used for address translation in noncontiguous memory allocation like Paging, Multilevel paging, Inverted paging, Segmentation, and Segmented paging. Different data structures and hardware support, like TLB, are required in these techniques.
A logical address is generated by the CPU while a program is running. The logical address is a virtual address as it does not exist physically. Therefore, it is also known as a Virtual Address. This address is used as a reference to access the physical memory location by CPU. The term Logical Address Space is used for the set of all logical addresses generated by a program’s perspective.
The hardware device called Memory-Management Unit is used for logical mapping address to its corresponding physical address.
Physical Address identifies a physical location of required data in memory. The user never directly deals with the physical address but can access its corresponding logical address. The user program generates the logical address and thinks that the program is running in this logical address but the program needs physical memory for its execution; therefore, the logical address must be mapped to the physical address by MMU before they are used. The term Physical Address Space is used for all physical addresses corresponding to the logical addresses in a Logical address space.
10 videos|99 docs|33 tests
|
|
Explore Courses for Computer Science Engineering (CSE) exam
|