Page 1 of 1

A privileged userland program

Posted: Mon Aug 10, 2009 9:18 am
by Jezze
Hi,

Im doing fine progress on my OS but now I started thinking...

Would it be possible to have a program in user space - a daemon of some sort - that has privileges that would allow it to handle some of the things that normally must run in kernel space?

I was thinking of letting user space programs implement their own scheduling algorithms and for them to work they have to contact the daemon that is the only program that has the privileges to actually trigger certain interrupts.

How would you go about doing this?

Re: A privileged userland program

Posted: Mon Aug 10, 2009 9:52 am
by Ferrarius
On intel processors:

If you put it say in ring 1 or 2 and make sure applications in that ring can do the specific functions you want it to be able to do you can run "userland" applications with certain elevated privileges.

Re: A privileged userland program

Posted: Mon Aug 10, 2009 11:46 am
by NickJohnson
There are a couple of ways you could do that.

First, you could have that process run in ring 1/2. That allows you to actually mask certain interrupts so only that process can use them at all. Problems with this are portability (specifically to x86_64), and the fact that you need more stuff in your TSS.

Second, you could allow all processes to do interrupts, but have some code in the handler that rejects requests from unprivileged processes by PID. This would probably be easiest, but would still take time in the context switch even though it didn't need to.

How exactly are you trying to let processes create their own scheduling algorithms?