0

If programme loaded into the ram at the phsycal spaces and the cpu reads addresses from ram so what is the purpose of the virtual address spacing. At the end cpu will read everything from ram's phsycal addrssses. I mean does mmu converts ram's phsycal address into virtual address and sends it to the cpu? To be more clear as i know cpu reads programme from ram. But it seems the programme's virtual addresses loaded to cpu somehow and then cpu tries to find the loaded address from ram. Is this right? Thanks in advance.

Yasin Fatullayev
  • 137
  • 1
  • 11
  • 1
    I'm voting to close this question as off-topic because the answer could cover a chapter in a book. I'd suggest you take an OS book and read it. – Tony Tannous Oct 09 '17 at 05:21
  • I already read the book. And this is the question that i came up. – Yasin Fatullayev Oct 09 '17 at 05:25
  • Then a short answer is yes. CPU uses virtual addresses which are translated to the respective physical addresses. Answering "what is the purpose of the virtual address spacing?" will require you reading memory management chapter from a different book if the one you read didn't make it clear. – Tony Tannous Oct 09 '17 at 05:28
  • Thanks for answer. I know that virtual address is for expanding existing ram's capacity. But i also know that everything get loaded to the cpu thru the ram. Then when programme start to execution cpu already knows all the addresses before storing any data to the ram. Did i understand right? If yes doesn't it sound cpu loads all the programme addresses from hard disk before loading programme to the ram? – Yasin Fatullayev Oct 09 '17 at 05:35
  • No. CPU doesn't know and it **doesn't** load all program to main memory (not all pages are present) The program **mappings** are known to the translation unit not to the CPU who doesn't care for virtual/physical memories, as far as the CPU is concerned it is just doing its job. – Tony Tannous Oct 09 '17 at 07:10
  • Then can we say that program's virtual addrsses get loaded into Translation unit first and then translation unit allocate real memory addresses in the ram? – Yasin Fatullayev Oct 09 '17 at 11:07
  • I think i found my answer. It is program counter that generate addresses and then cpu execute it. There is no any programme load or something Instruction pointer increase itself by one each time and this way all our ram read by cpu. Thanks for your replies – Yasin Fatullayev Oct 09 '17 at 14:28

0 Answers0