The main difference between them is that the logical address is a virtual address generated by the CPU, while the other address is the actual location in main memory.
One of the components of a computer is memory. Each memory cell consists of an address to uniquely identify it. There are two types of addresses known as logical addresses and physical addresses. The processor generates a logical address. It is also called a virtual address. The physical address is the actual address in the memory block. It takes longer to access the program from secondary memory. Hence, the program is loaded into main memory at runtime. The CPU-generated logical address is then converted to a physical address to find the corresponding location in main memory.
What is a logical address?
A program is a set of instructions. It is initially stored in secondary memory. The processor takes longer to access the secondary memory. Therefore, the program is placed in main memory at runtime. When instructions are executed, the CPU generates a logical address. This is also called a virtual address.This address is mapped to a physical address for accessing an instruction in main memory. The collection of all logical addresses generated for a program is called a logical address space.
What is a physical address?
A physical address is an address in main memory. All physical addresses owned by a program are called physical address spaces. A logical address is converted to a physical address at run time.
Suppose you have a computer program with 100 instructions. It is loaded into cell 500 of the main memory. The 100th instruction is in location 600. The move register is a special register in the CPU. It stores the base address of the program when loaded into main memory for execution. In this scenario, the move register has a value of 500. The CPU generates logical address 60. Adding this logical address and the value in the move address gives the physical address. This is the actual location in main memory. Therefore, 560 is the corresponding physical address.
A logical address is the address at which an item, such as a memory location, a storage item appears to be from the point of view of the executable program. A physical address is a memory address that allows access to a specific memory location in main memory.
The logical address space is the collection of all logical addresses generated for the program, while the physical address space is the collection of all the physical addresses of the program.
The logical address helps to obtain the physical address. The physical address helps to identify the location in the main memory.
The CPU generates the logical addresses, while the combination of the move register and the logical address provides the physical address.
The difference between logical and physical address is that the logical address is the virtual address generated by the CPU, and the physical address is the actual location in main memory. The processor generates a logical address or virtual address. Adding this logical address and the value from the move register gives the corresponding physical address in main memory.