Copy on write with microkernels, put it in user or kernel?

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
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Copy on write with microkernels, put it in user or kernel?

Post by OSwhatever »

With microkernels you get the option to implement copy on write as a kernel functionality but also as a user page fault handler.

I'm a bit muddled what is the best here. There is nothing preventing you from implementing both but I'm leaning towards putting in the kernel. The reason is the user page fault handler might not own or has the source page mapped when the fault occurs. The kernel can however map whatever physical page it wants. Also, kernel copy on write is faster due to you skip one or more context switches.

What do you think, where would you have put your copy on write functionality?
halofreak1990
Member
Member
Posts: 41
Joined: Thu Aug 09, 2012 5:10 am

Re: Copy on write with microkernels, put it in user or kerne

Post by halofreak1990 »

Personally, I'd put it in the kernel. It's easier, and allows less outside manipulation.
<PixelToast> but i cant mouse

Porting is good if you want to port, not if you want maximum quality. -- sortie
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: Copy on write with microkernels, put it in user or kerne

Post by Combuster »

Also, kernel copy on write is faster due to you skip one or more context switches.
Then just implement the copying in the running app to avoid the big overhead that is a task switch. After all, it has the original read-only version to start with. :wink:
"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 ]
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: Copy on write with microkernels, put it in user or kerne

Post by OSwhatever »

Combuster wrote:Then just implement the copying in the running app to avoid the big overhead that is a task switch. After all, it has the original read-only version to start with. :wink:
It is so obvious and makes sense, like I didn't see the forest because of all the trees. Unfortunately, there will be context switch due the design of the kernel but I like the approach none the less and this is probably the best solution so far. Definitely a good contender.

EDIT: There is a slight chicken and egg problem with this solution. The pager needs to be registered before starting the user program and there is no real way to determine where the pager code is located in the executable before it has started.
greyOne
Member
Member
Posts: 58
Joined: Sun Feb 03, 2013 10:38 pm
Location: Canada

Re: Copy on write with microkernels, put it in user or kerne

Post by greyOne »

OSwhatever wrote: EDIT: There is a slight chicken and egg problem with this solution. The pager needs to be registered before starting the user program and there is no real way to determine where the pager code is located in the executable before it has started.
Assuming that this is still relevant, and the way you want to solve this is as above,
Locating specific code in an executable becomes really easy if it's the only code at in a given executable section. :wink:
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: Copy on write with microkernels, put it in user or kerne

Post by OSwhatever »

greyOne wrote:Assuming that this is still relevant, and the way you want to solve this is as above,
Locating specific code in an executable becomes really easy if it's the only code at in a given executable section. :wink:
Yes, it is possible to locate that code in a special elf section. This might also only be done once, in the dynamic linker executable and the executable that is supposed to run does not need this special treatment.
Post Reply