OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 11:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: User Mode Swapping?
PostPosted: Tue Jul 14, 2015 10:45 am 
Offline
Member
Member

Joined: Wed Dec 24, 2014 8:06 am
Posts: 29
Location: Germany
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 :-)


Top
 Profile  
 
 Post subject: Re: User Mode Swapping?
PostPosted: Tue Jul 14, 2015 11:21 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
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 ]


Top
 Profile  
 
 Post subject: Re: User Mode Swapping?
PostPosted: Tue Jul 14, 2015 1:04 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
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


Top
 Profile  
 
 Post subject: Re: User Mode Swapping?
PostPosted: Tue Jul 14, 2015 3:29 pm 
Offline
Member
Member

Joined: Thu Mar 25, 2010 11:26 pm
Posts: 1801
Location: Melbourne, Australia
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 ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: KN9296 and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group