Ads block

Banner 728x90px

Virtual Address v/s Physical Address

Memory is a very important component of the computer system. We use of memory to store data at different locations with addresses so that we can use this data again in the future. There are two types of addresses that are used for memory in the operating system- physical address and logical address


Physical Address

A physical address is an actual location in main memory. It allows access to data in the main memory. A physical address is not directly accessible to the user program hence, a logical address needs to be mapped to it to make the address accessible. This mapping is done by the MMU. Memory Management Unit(MMU) is a hardware component responsible for translating a logical address to a physical address.


Virtual Address

A logical address or virtual address is an address that is generated by the CPU during program execution. A logical address doesn't exist physically.

A logical address is a reference to a memeory location independent of the current assignment of data to memory; a translation must be made to a physical address before the memory access can be achieved. A logical address usually ranges from zero to maximum (max). The user program that generates the logical address assumes that the process runs on locations between 0 to the max. 



This logical address(generated by CPU) combines with the base address generated by the MMU to form the physical address.

Thus, a means is needed in hardware of translating relative addresses to physical main memory addresses at the time of execution of the instruction that contains the reference.