A address is the location in the memory where the actual code resides in the operating system. We usually stores data in memory in different locations so that we can use it whenever we want to use. There are two types of addresses in operating system to store codes-physical and virtual address.
Virtual or logical address is view to users. The users can’t directly view the physical address. The virtual data is generate in CPU, whereas the physical one is in memory unit. This was the major difference between them.
What is Physical Address?
A physical address is the main location of code. The user can never directly reach the code but can go through virtual address. The user program generates the logical address and thinks it is running in it, 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 use. The Physical Address Space is use for all physical addresses corresponding to the logical addresses in a logical address space.
What is a Virtual Address?
A logical address is an address that is generate by the CPU during program execution. The logical address is a virtual address as it does not exist physically, and therefore, it is also known as a Virtual Address. This address is use as a reference to access the physical memory location by CPU. The term Logical Address Space is use to set all logical addresses generated from a program’s perspective.
Differences
- CPU generates the virtual while memory is responsible for physical address.
- Virtual address does not exist physically while the other one exists.
- Logical is use as reference to access physical, physical can’t access directly.
Memory Management Unit(MMU)
The run-time mapping between the virtual and physical addresses is execute by a hardware device call MMU. The operating system will handle the processes and move the processes between disk and memory in memory management. It keeps track of available and used memory. The Memory Management Unit is a combination of these two register:
- Base Register: It contains the starting physical address of the process.
- Limit Register: It mentions the limit relative to the base address on the region occupied by the process.