Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meant by "CPU generates logical address space"?

As far as I read from the book(correct me I am wrong) after a compiler puts the compiled code in the storage, the CPU creates logical addresses and those logical addresses are mapped to physical memory through MMU(Memory Management Unit).Also I know that CPU directly cannot access anything other than the physical memory.

Then how does CPU produce logical addresses for the process in the first place?

like image 720
DockYard Avatar asked Oct 21 '25 12:10

DockYard


1 Answers

It sounds like you have a bit of confusion about what things do.

The operating system defines the logical address space by setting up page tables that logical pages to physical page frames. The operating system loads hardware registers of the CPU so that it knows about the page tables it has defined.

This use of page tables to define logical address spaces is an integral part of a modern CPU. In some systems, the only use of physical addresses is within page tables.

The compiler generates an object code file that describes the instructions and data used and created.

The linker combines object code into an executable file that defines how the program will be loaded into memory.

The loader reads the instructions in an executable file and sets up the logical addresses space to run the program. The loader calls system routines that set up the page tables the define the logical addresses space.

For example, where the executable has read-only data, the loader will call OS routines to creates read-only pages in the logical address space and map them to the data in the executable file.

like image 52
user3344003 Avatar answered Oct 27 '25 05:10

user3344003



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!