Yes you are right, when we load program, not whole program loaded initially. At first it only loads needed pages(program part).
If you see from compiler & os management perspective virtual memory management is very beneficial.
Bcoz when you compile binary statically, you will get all the addresses needed at compile time.
This is only possible due close design of ABI, compiler & os kernel.
Same goes for dynamic Compilation except absolute addresses(offsets will be generated)
I teach computer science to undergrads and write for The Renegade Coder. I'm most likely taking care of my daughter, watching the Penguins, or reading manga.
Location
Columbus, Ohio
Education
B.S. in CE from CWRU 2016; M.S. in CSE from OSU 2020; PhD in EED from OSU 2024
Just to bounce off Vishal here, I think virtual memory is also useful if you want to "virtualize" a system or process. For instance, you want to run a couple operating systems on the same hardware. Virtual memory would provide a nice layer between those systems and the hardware. In other words, you wouldn't need to statically allocate memory to the two systems. Instead, you'd give the illusion that both system would have access to all the memory through virtual memory.
Yes you are right, when we load program, not whole program loaded initially. At first it only loads needed pages(program part).
If you see from compiler & os management perspective virtual memory management is very beneficial.
Bcoz when you compile binary statically, you will get all the addresses needed at compile time.
This is only possible due close design of ABI, compiler & os kernel.
Same goes for dynamic Compilation except absolute addresses(offsets will be generated)
Just to bounce off Vishal here, I think virtual memory is also useful if you want to "virtualize" a system or process. For instance, you want to run a couple operating systems on the same hardware. Virtual memory would provide a nice layer between those systems and the hardware. In other words, you wouldn't need to statically allocate memory to the two systems. Instead, you'd give the illusion that both system would have access to all the memory through virtual memory.
Yes jeremy...!
Infact, modern days SoC has special hardware for virtual memory management & system virtualizer.
Recently i have worked on one in my office.