K
K
Karina2018-05-05 11:51:15
Operating Systems
Karina, 2018-05-05 11:51:15

How does the OS determine which device to get data from?

Here the processes are running and they need data from the address 0x01 (for example). He looks at the MMU and sees the actual address. And then where? How does it determine if it's in RAM or if it's in swap?
Thanks for the answer.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alexalexes, 2018-05-05
@iKapex

I have not read about the architecture of iron for a long time, but I can explain it on my fingers.
RAM is divided into pages.
Pages are dispatched for aging.
If a memory page has not been accessed for a long time, then it becomes a candidate for swapping.
If the processes do not have enough RAM for some kind of maneuver, then the candidate pages fly into the swap, respectively, they are marked as ousted.
If some process needs to get data from the address, then it is calculated which page this address belongs to.
If the page is evicted, then steps are taken to bring it back into RAM.

C
chromimon, 2018-05-05
@chromimon

This has been implemented in hardware for a long time. Probably 40 years or so.
It just accesses the data.
If there is really no data ( the memory page is marked as flushed to disk ), the processor automatically raises an exception and control is transferred to that part of the OS that is responsible for swapping data from disk to RAM.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question