While studying computer architecture, one often comes around the term address. The term “address” usually refers to the specifics of the place where someone lives or an organization is situated. This definition is somewhat related to the address used in memory management.
It uniquely identifies a location in the physical memory of a computer. The CPU usually generates an address for a program. For example, when we store audio, video, or even a simple document in our computer’s memory, the CPU needs to label the file uniquely.
That is where the term ‘address’ comes into play. The address helps the CPU to uniquely identify a particular location of the memory and can be used as a reference in the future so that the user can access that particular section of the memory.
Mapping of Logical Address and Physical Address
Now moving on, in computer architecture the address is of 2 types: Logical address and Physical address.
The physical address is a label that identifies a particular section of the memory unit. It is actually available on the memory unit.
Whereas, the logical address is used as a reference to the physical address which helps us in accessing the physical address. The logical address is generated by the CPU, unlike the physical address. Before moving on, let us understand the working of logical address and physical address.
Suppose you store a file in the memory. How are the physical and logical addresses calculated? Let us have a brief look.
The operating system(OS) generally uses a base address as a parameter to find addresses. The base address is the initial address of a memory block. The address generated by the CPU for a program is called the logical address. Now, this logical address is added to the base address to form a physical address.
Let us summarize the above points in simple language:
(1). The CPU will generate a particular address for a program which is called the logical address.
(2). The base address is the starting address of a memory block and helps to form the physical address.
(3). The base address is added to the logical address to form the physical address. The MMU (Memory Management Unit) is a hardware device that helps in mapping the logical addresses with the corresponding physical addresses.
Difference between Logical and Physical Address
● The address developed by the CPU is called a logical address, whereas the address generated by adding logical address to the base address is called a physical address.
● Logical address is generated by the CPU whereas the physical address is computed by the MMU.
● The user can easily view the logical address of a particular program whereas the physical address is not accessible to the user.
● Logical Address Space is the set of all logical addresses generated in reference to a program whereas Physical Address Space contains the set of all the physical addresses mapped to the logical address.
Logical vs Physical Address – Comparison Table
Logical Address | Physical Address |
The address developed by the CPU is called a logical address. | The address generated by adding logical address to the base address is called a physical address. |
It is a virtual address. | It is a non-virtual address. |
The set of all logical addresses originating by the CPU in reference to a program is referred to as Logical Address Space. | Set of all physical addresses mapped to the disparaging logical addresses is referred to as Physical Address Space. |
Users can directly access the logical address. | Users cannot directly access physical address. |
Generated by the CPU | Computed by the MMU |
What is Logical Address?
The address generated by the CPU for a program that is running is known as logical address. The logical address is also known as a virtual address because its physical existence is undefined.
This address helps in accessing the physical memory location. When a program is running, the program’s perspective generates a collection of logical addresses which is called Logical Address Space.
The logical address and physical address are associated with each other by a hardware device known as Memory-Management Unit. During compile-time and load time MMU uses address-binding methods to generate the identical logical and physical address. However, during run-time different logical and physical addresses are generated using the address binding methods.
What is Physical Address?
Physical Address identifies a physical location in memory. It is usually computed by the MMU(Memory Management Unit). The main function of MMU is to calculate the physical address for the corresponding logical address. The base address is added to the logical address to compute the physical address.
The physical address is not directly accessible to the user. The user utilizes the logical address to indirectly access the physical address. The set of all physical addresses which are linked to their corresponding logical addresses is referred to as Physical Address Space.
Conclusion
So we can see that logical and physical addresses are linked to each other and are the fundamentals of computer architecture.
Author
Riten Bhagra
VIT, Bhopal