Page 1 of 1
User Mode Swapping?
Posted: Tue Jul 14, 2015 10:45 am
by StartOS
Microkernels implement device drivers in User Mode, but swapping reqiures hard-disk access.
How do microkernels swap memory to disk if drivers are processes in user-space?
Re: User Mode Swapping?
Posted: Tue Jul 14, 2015 11:21 am
by Combuster
How about not swapping those drivers?
Re: User Mode Swapping?
Posted: Tue Jul 14, 2015 1:04 pm
by SpyderTL
I think he means "how does the page fault handler access the hard drive if the hard drive driver is in user mode?"
And I think the answer is something like "the kernel can call user mode code as often as it wants. Protected mode only prevents user code from calling kernel code, directly."
Application Code -> Page Fault -> Kernel Page Fault Handler -> User Mode Hard Disk Driver -> Hard Disk Controller -> Hard Disk
I don't see any problem with this sequence...
Re: User Mode Swapping?
Posted: Tue Jul 14, 2015 3:29 pm
by gerryg400
In my OS the sequence goes like this
1. Application Code
2. Page Fault
3. Kernel Page Fault Handler
At this point the kernel checks whether it has the page or not. If not it modifies the kernel state of the original app so that it appears that the app sent a message to the VFS asking for a page from the file that it is trying to load. It then adds the app to the message queue of the VFS. From the VFS point of view the message is a 'read' message from a file that was opened when mmap was originally called.
4. VFS.
5. User Mode Hard Disk Driver etc.
6. VFS replies with data
7. App is unblocked and resumes.