How is paging supposed to work in multiprocessing kernel
Posted: Mon Mar 07, 2022 9:53 am
Hi,
I am reading wiki articles about paging, and I think I understand how translation of adress from linear adress space to physical adress space works.
But, how is it designed to work with multiple processes.
Lets say we are switching from process A to process B, should I clear paging structures and and load them with new mapping for process B? It is doable, but seems like a too much work after each switch, considering there will be lots of switching in a second.
How about switching back to A later? Should I create a copy of old mapping each time I switch from a process? This, again, seems a lot of work after each task switch.
How do you even switch a task? If an interrupt occur while userspace process is doing work, kernel is not mapped, so interrupt handlers cannot be called.
I could keep kernel mapped at all times, but wouldn't it make kernel memory accessable to each process? Wouldn't that negate the whole point of having memory protection?
I am probably missing some very important key points here, otherwise, paging doesn't make much sense to me.
Best Regards,
I am reading wiki articles about paging, and I think I understand how translation of adress from linear adress space to physical adress space works.
But, how is it designed to work with multiple processes.
Lets say we are switching from process A to process B, should I clear paging structures and and load them with new mapping for process B? It is doable, but seems like a too much work after each switch, considering there will be lots of switching in a second.
How about switching back to A later? Should I create a copy of old mapping each time I switch from a process? This, again, seems a lot of work after each task switch.
How do you even switch a task? If an interrupt occur while userspace process is doing work, kernel is not mapped, so interrupt handlers cannot be called.
I could keep kernel mapped at all times, but wouldn't it make kernel memory accessable to each process? Wouldn't that negate the whole point of having memory protection?
I am probably missing some very important key points here, otherwise, paging doesn't make much sense to me.
Best Regards,