0
$\begingroup$

If so, for any OS more than 10gb, how does it run on a computer with limited ram like 4gb? If not, which part of OS is copied to the ram? Or is it dynamically loaded whenever certain part is needed?

$\endgroup$
1

1 Answer 1

3
$\begingroup$

Operating systems are typically made of multiple parts. Typically, one of these parts, the kernel, is loaded into RAM when the OS starts, and never unloaded. Other parts of the OS are loaded when needed and unloaded when not needed.

The exact mechanisms are very dependent on the operating system. OSes that include gigabytes of code typically consist of hundreds or thousands of programs with specific purposes. For example, there might be a program to copy files (no need to load it unless a file is being copied), a program to play sounds (no need to load it unless sound is being played), a program to configure the network firewall (no need to load it except when reconfiguring the firewall), etc. Not only are those programs only loaded to RAM when they're executed, but such large OSes typically only load the parts of the program code that is actually needed. They rely on a the processor's memory management unit to load and unload individual pages from disk to RAM. Smaller operating systems running on platforms without an MMU can use overlays to load and unload parts of a program as needed (usually, with overlays, the program itself takes care of managing its own optional components).

Some embedded operating systems consist of a single executable image which is fully loaded into RAM when the OS starts. This can encompass more than the kernel, depending on the OS architecture: when the OS has different parts running at different privilege levels, the kernel is just the part that runs at the highest privilege level, but the part that's permanently in memory can be more than the kernel. In larger OSes, the part that's permanently in memory can also be less than the kernel; for example, on Linux, most device drivers are part of the kernel but there is a mechanism for loading and unloading them.

$\endgroup$

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.