Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of logical address?

What is the purpose of logical address? Why should CPU generate logical address? it can directly access relocatable register base address and limit to exe a process. Why should MMU make a mapping between logical and physical address?

like image 596
Iniyan Selvan Avatar asked Apr 21 '15 12:04

Iniyan Selvan


People also ask

What is the importance of physical and logical addresses in computer networks?

A physical address is an address that shows the location of memory while a logical address shows the address of the CPU, i.e. the central processor unit generates the Address. One device can have only one physical address. They are constant, so they cannot be changed. One device can have a variety of logical addresses.

What are the purpose of port address a logical address and a physical address?

Through logical address the system identify a network (source to destination). after identifying the network physical address is used to identify the host on that network. The port address is used to identify the particular application running on the destination machine.

What is logical address with example?

A logical address is an address that is generated 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 used as a reference to access the physical memory location by CPU.

Why does CPU always generate logical address?

Logical and Physical Addresses in an Operating System A logical address is generated by CPU while a program is running. Since a logical address does not physically exists it is also known as a virtual address. This address is used as a reference by the CPU to access the actual physical memory location.


2 Answers

Why?

Because this gives the Operating System a way to securely manage memory.

Why is secure memory management necessary?

Imagine if there was no logical addressing. All processes were given direct access to physical addresses. A multi-process OS runs several different programs simultaneously. Imagine you are editing an important letter in MS Word while listening to music on YouTube on a very recently released browser. The browser is buggy and writes bogus values to a range of physical addresses that were being used by the Word program to store the edits of your letter. All of that information is corrupt!

Highly undesirable situation.

How can the OS prevent this?

Maintain a mapping of physical addresses allocated to each process and make sure one process cannot access the memory allocated to another process!

Clearly, having actual physical addresses exposed to programs is not a good idea. Since memory is then handled totally by the OS, we need an abstraction that we can provide to processes with a simple API that would make it seem that the process was dealing with physical memory, but all allocations would actually be handled by the OS.

Here comes virtual memory!

like image 134
Harshit Dhawan Avatar answered Sep 28 '22 08:09

Harshit Dhawan


In execution time binding, the MMU makes a mapping from logical address to physical address because in this type of binding:

logical address is specifically referred to as virtual address

The address actually has no meaning because it is there to illusion the user that it has a large memory for its processes. The address actually bear meaning when mapping occurs and they get some real addresses which are present in physical memory.

Also I would like to mention that the base register and limit register are loaded by executing privileged instructions and privileged instructions are executed in kernel mode and only operating system has access to kernel mode and therefore CPU cannot directly access the registers.

So first the CPU will generate the logical address then the MMU of Operating system will take over and do the mapping.

like image 23
Sumeet Avatar answered Sep 28 '22 08:09

Sumeet