User Mode Swapping?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
StartOS
Member
Member
Posts: 29
Joined: Wed Dec 24, 2014 8:06 am
Location: Germany

User Mode Swapping?

Post 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?
All a good OS needs to do is to run Linux inside QEMU :-)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: User Mode Swapping?

Post by Combuster »

How about not swapping those drivers?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: User Mode Swapping?

Post 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...
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: User Mode Swapping?

Post 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.
If a trainstation is where trains stop, what is a workstation ?
Post Reply