How is the logical address space generated by the CPU?

  • Thread starter Peon666
  • Start date
  • Tags
    cpu Space
In summary: Now, this is where the "relocation" part comes in. The relocation register can be used to move a process or thread from one set of physical memory to another. In fact, the relocation register is a special register that is set up specifically to handle this task. Normally, if the MMU doesn't have the needed information to find the process or thread on the new memory location, then it will use the relocation register to find the process or thread and then will use the result of the relocation operation to set the process or thread's physical address on the new memory location.
  • #1
Peon666
108
0
I do understand that logical address space/memory is generated by the CPU for the program and physical memory is the one on-to which the logical address space is mapped and which is on the physical memory. Plus, physical memory is not directly accessible to the user.

Now, my question is (I don't know whether this makes sense or not):

1- How is the logical address space generated by the CPU? And is this randomly generated?

2- Why do we need a "relocation register" to map it on the physical memory? Why can't it be directly mapped on the physical memory?

Thanks.
 
Computer science news on Phys.org
  • #2
First, we must note that the concept of a logical address space bound to some physical address space is of central role in order to have proper memory management.

Peon666 said:
1- How is the logical address space generated by the CPU? And is this randomly generated?

A pair of base and limit registers are used to define the logical address space. We must note here that main memory and registers are the only storage that can be accessed by CPU directly. Also, we talk about the logical address space per program or better stated, per user process.

Now, the set of all logical addresses used by a program defines its logical address space, and the set of all corresponding physical addresses defines its physical address space.
Addresses which are bound at compile time or load time have identical logical and physical addresses.
Addresses created at execution time have different logical and physical addresses. In this case, the logical address is also known as virtual address.

Peon666 said:
2- Why do we need a "relocation register" to map it on the physical memory? Why can't it be directly mapped on the physical memory?

The run time mapping of logical to physical addresses is handled by the MMU (Memory Management Unit), which is the hardware that supports the mapping of virtual memory addresses to physical memory addresses. In modern microcomputers it is built into the CPU chip. For run time mapping, the base register is named relocation register. In the usual dynamic relocation scheme that we talk about here - which is used in order to avoid collisions among multiple processes running simultaneously, relocation register value is added to every memory request at the hardware level. So, MMU adds the value of the relocation register to a logical address in order to form a physical address.
 
  • Like
Likes Greg Bernhardt

1. How does the CPU generate a logical address space?

The CPU generates a logical address space by using a memory management unit (MMU). The MMU translates the logical addresses generated by the CPU into physical addresses that correspond to locations in the computer's memory.

2. What is the purpose of a logical address space?

The purpose of a logical address space is to provide a virtual representation of the computer's memory for the CPU to access. This allows for efficient and secure use of memory, as well as the ability to run multiple processes simultaneously.

3. How is the size of the logical address space determined?

The size of the logical address space is determined by the number of bits used by the CPU to generate addresses. For example, a 32-bit CPU can generate 2^32 or 4GB of logical addresses, while a 64-bit CPU can generate 2^64 or 16 exabytes of logical addresses.

4. Can the logical address space change during a program's execution?

Yes, the logical address space can change during a program's execution. This is because the MMU can dynamically allocate and deallocate memory as needed, and the CPU can generate new logical addresses as it executes instructions.

5. How does Virtual Memory affect the logical address space?

Virtual Memory is a technique used by the operating system to extend the logical address space beyond the physical memory available. It does this by temporarily storing data in secondary storage, such as a hard disk, and then retrieving it when needed. This allows for programs to use more memory than is physically available, increasing the overall efficiency of the system.

Similar threads

  • Computing and Technology
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
Replies
3
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Computing and Technology
Replies
14
Views
3K
  • Computing and Technology
Replies
5
Views
6K
  • Quantum Interpretations and Foundations
Replies
9
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Replies
10
Views
2K
Back
Top