In this tutorial, we will certainly be spanning the principle of logical and physical deal with space.

You are watching: How to calculate physical address from logical address

The address that is created by the CPU is generally referred to as the Logical Address. That is usually a virtual address. The logical attend to is basically the address of an indict or data used by any type of program.

The set of all logical addresses that are produced by any kind of program is referred to as Logical deal with Space.

The deal with that is loaded into the memory-address register the the memory is frequently referred to as a Physical address. A physical attend to cannot be accessed by the user directly however the user have the right to calculate the physical resolve with the aid of a Logical address.

The user"s program mainly generates the logical address and the user thinks the the regime is to run in this logical attend to but the program mostly needs physical memory in stimulate to complete its execution.

The set of all physics addresses corresponding to the logical addresses is typically known as Physical attend to Space.

Memory monitoring Unit(MMU) in OS

It is a hardware maker that does the run-time mapping indigenous the virtual address to the physics address. It is located within the central Processing Unit.

Let us know the concept of mapping with the aid of a an easy MMU scheme and that is a base-register scheme.

*

In the above diagram, the base register is termed the Relocation register. The relocation it is registered is a special register in the CPU and also is offered for the mapping of reasonable addresses used by a routine to physics addresses the the system"s key memory.

The value in the relocation it is registered is included to every deal with that is created by the user process at the time when the resolve is sent to the memory.

MMU Example

Suppose the base is at 14000, then an attempt by the user to address location 0 is relocated dynamically come 14000; thus access to place 356 is mapped come 14356.

It is essential to keep in mind that the user program never ever sees the actual physical addresses. The program can produce a guideline to location 356 and also store the in the memory and also then manipulate it after that compare the with other addresses together number 356.

User program always deals with the logical addresses. The Memory Mapping unit largely converts the reasonable addresses right into the physical addresses. The last location that the referenced memory deal with is not determined until the referral is made.

There room two varieties of addresses that we have:

logical addresses(lies in the selection 0 come max).

physical addresses(lies in the variety R+0 come R+max for the base value R)

As we have told you above the user generates just a logical deal with and then thinks the the process runs in places 0 come max. However, this logical addresses must be mapped to physical addresses prior to they space used.

Difference between Logical resolve and physical Address

Let us currently cover the differences between the logical addresses and also Physical addresses in the operating System

S.NoLogical AddressPhysical Address1.2.3.4.5.6.
Users can access the logical address the the Program.User deserve to never accessibility the physical address the the Program
The logical attend to is produced by the CPU.The physical deal with is located in the memory unit.
The user can accessibility the physical resolve with the help of a logical address.A physical deal with can be accessed by a user indirect b ut no directly.

The logical resolve does no exist physical in the memory and thus termed together a virtual address.

On the other hand, the physical deal with is a location in the memory. Therefore it can be accessed physically.
The collection of all logical addresses that are produced by any kind of program is described as Logical resolve Space.The collection of all physical addresses matching to the logical addresses is commonly known as Physical address Space.
This address is created by the CPU.

See more: What Is The Opposite Of Analytical ? Intuitive Vs

It is computed by the Memory monitoring Unit(MMU).