0
$\begingroup$

My book(digital design and computer architecture ARM edition) explains loads and stores like this:

To perform a load or store, the processor must first translate the virtual adress to a physical adress and then access the data at that physical adress. The processor extracts the virtual page number from the virtual adress and adds it to the page table register to find the physical adress of the page table entry. The processor then reads this page table entry from the physical memory to obtain the physical page number. If the entry is valid, it merges this physical page number with the page offset to create the physical adress. Finally, it reads or writes data at this physical adress. Because the page table is store in physical memory, each load or store involves two physical memory access.

From what I understand this means that loads and stores are made on the physical adress? But when we turn of the computer we lose the content in RAM(physical adress), so does the computer always update the content of the virtual adress with the corresponding content in the physical adress?

$\endgroup$
2
  • $\begingroup$ Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text. Don't forget to give proper attribution to your sources! $\endgroup$
    – Nathaniel
    Jan 12, 2023 at 15:58
  • $\begingroup$ @Nathaniel I updated the post. $\endgroup$
    – user394334
    Jan 12, 2023 at 16:11

2 Answers 2

1
$\begingroup$

Maybe the confusion resides between the difference between the MMU and the caches.

The MMU translates virtual to physical addresses, it uses some pagination tables stored somewhere in memory.

Actual data is stored in various memories. It can be DRAM, it can be caches, it can be even some disk (like when computers are turned off with "suspend to disk". Data is copied between different levels of cache and memory.

DRAM is accessed by physical addresses, and caches can be indexed either by virtual or by physical addresses, although nowadays they tend to use physical addresses, to ease coherency management.

$\endgroup$
1
  • $\begingroup$ Thank you, the confusion is what happens when we want to save something that is either in the virtual or the physical adress. Is it only saved at the physical adress, and nothing happens with the virtual adress that is mapped to the physical adress? $\endgroup$
    – user394334
    Jan 12, 2023 at 19:46
0
$\begingroup$

The computer cannot predict that you are about to turn it off, so yes, it updates the content of the virtual address when requested to do so, and this implies a change in content at the corresponding physical address.

(In reality, the changes to physical memory can be postponed when there are caches, but this is yet another story.)

$\endgroup$
6
  • $\begingroup$ Thank you. But it does not do automatically? That is, if we change something in the physical memory the corresponding data in virtual memory that is mapped to this physical mamory is also changed? $\endgroup$
    – user394334
    Jan 12, 2023 at 16:16
  • $\begingroup$ @user394334: of course, the content is unique, it only exists in physical memory. Virtual memory management is just an address translation mechanism. $\endgroup$
    – user16034
    Jan 12, 2023 at 16:18
  • $\begingroup$ Sorry, I did not quite understand that. Was that a yes or a no to my question? $\endgroup$
    – user394334
    Jan 12, 2023 at 16:20
  • $\begingroup$ @user394334: "of course" is a yes, isn't it ? But I infer that you still don't fully understand virtual memory. $\endgroup$
    – user16034
    Jan 12, 2023 at 16:21
  • $\begingroup$ Sorry, I had two questions in the first comment and a yes to one means no to the other and vice versa. That was a bad way for me to write the questions. But am I to understand that it was a "yes" to the first question "But it does not do automatically? "? $\endgroup$
    – user394334
    Jan 12, 2023 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.