An OS in design.
Re: An OS in design.
Seems I can't avoid having processes able to access kernel calls. Who knows maybe I'll think of something
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
- Combuster
- 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: An OS in design.
You could trap unprivileged applications doing system calls, and instead of executing the call perform synchronous IPC with a governing process
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: An OS in design.
That means going into the kernel, right?You could trap unprivileged applications doing system calls
Re: An OS in design.
Just create a loop between two serial ports with a null modem cable and give the processes some IO privledges..... IPC without kernel interaction! </joke>
All your base are belong to us.
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: An OS in design.
give the processes some IO privledges
And who gave the processes the io privileges? The kernel! This is just like the memory sharing outlined above, only funnier.IPC without kernel interaction!
And also this was supposed to be for low-privilege processes, they can't have io port access.
Re: An OS in design.
So possibly the only thing I need to be implemented in the kernel is IPC?
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: An OS in design.
IPC and scheduling. Otherwise there won't be any processes to do the IPC.
Re: An OS in design.
Scheduling can be handled outside the kernel. Process switching must be done by the kernel of course, for changing page tables and the like.JohnnyTheDon wrote:IPC and scheduling. Otherwise there won't be any processes to do the IPC.
JAL
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: An OS in design.
Why not give the process a shared page that it can use to communicate with the IPC server when the process is spawned?
My OS is Perception.
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: An OS in design.
You could do that, but the IPC server would have to continously keep checking the pages of all processes to see if something happened in there. Does it sound efficient?MessiahAndrw wrote:Why not give the process a shared page that it can use to communicate with the IPC server when the process is spawned?
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: An OS in design.
How about a page every process uses that acts like a queue (with a lock of course so only one process can use it (or a section of it) at a time)? And maybe a bit somewhere that each process is assigned, and when it's set it means there is something waiting on the queue (this bit could also be used to awake sleeping processes).
I'm probably far oversimplifying it (I haven't really thought about it much at all) but it's one possibility of how you could do IPC without system calls. The disadvantage of this is mostly performance related. The queue could be locked right before a context switch and therefore every other process trying to communicate will essentially be stalled for a time slice each (this could be fixed with some research into locking algorithms and having a dynamic number of locks or something). Also, there's no way to have block-and-sending that will instantly task switch while sending the message at the same time (e.g. imagine a game (the only active process) sending an graphics command to the graphics server, the game will sleep while the graphics server awakens and a message is send to the graphics server and switch to the graphics server (if the only process awake) - all in one atomic call), I guess you could get around this with firing the timer several times faster than the time slice (though too rapidly and then a noticeable percentage of your CPU cycles will be spent inside your handler) to check if the process's sleep bit is turned on or queue several messages before deciding to sleep.
This might only be viable if we had an interrupt-less, exception-less (and in all other ways impossible to implement calls) system.
If it's on a real time system then it could be a way to guarantee that a process has exactly the right amount of processing time (no cycles stolen behind the scene because an end programmer doesn't have to make any guess work how long a system call takes (cycles to enter interrupt + interrupt handling code) which they don't have any control over). This is really the only practical advantage I see.
Do I think it's worth it? No. Do I think it's possible? Yes.
I'm probably far oversimplifying it (I haven't really thought about it much at all) but it's one possibility of how you could do IPC without system calls. The disadvantage of this is mostly performance related. The queue could be locked right before a context switch and therefore every other process trying to communicate will essentially be stalled for a time slice each (this could be fixed with some research into locking algorithms and having a dynamic number of locks or something). Also, there's no way to have block-and-sending that will instantly task switch while sending the message at the same time (e.g. imagine a game (the only active process) sending an graphics command to the graphics server, the game will sleep while the graphics server awakens and a message is send to the graphics server and switch to the graphics server (if the only process awake) - all in one atomic call), I guess you could get around this with firing the timer several times faster than the time slice (though too rapidly and then a noticeable percentage of your CPU cycles will be spent inside your handler) to check if the process's sleep bit is turned on or queue several messages before deciding to sleep.
This might only be viable if we had an interrupt-less, exception-less (and in all other ways impossible to implement calls) system.
If it's on a real time system then it could be a way to guarantee that a process has exactly the right amount of processing time (no cycles stolen behind the scene because an end programmer doesn't have to make any guess work how long a system call takes (cycles to enter interrupt + interrupt handling code) which they don't have any control over). This is really the only practical advantage I see.
Do I think it's worth it? No. Do I think it's possible? Yes.
My OS is Perception.
Re: An OS in design.
yeah, still going over everything.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Re: An OS in design.
Errmm... and how would you obtain the lock? *cough*MessiahAndrw wrote:with a lock of course (...) it's one possibility of how you could do IPC without system calls
JAL
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: An OS in design.
If you have shared memory you can implement spinlocks with 'lock bts'. It will chew up most of your processor time, but doing IPC without system calls isn't exactly great for performance to begin with.jal wrote:Errmm... and how would you obtain the lock? *cough*MessiahAndrw wrote:with a lock of course (...) it's one possibility of how you could do IPC without system calls
JAL
Re: An OS in design.
no more without system calls! I'm just going to limit the calls. Anyway, I now have a basic kernel set up, though I'm not getting into the coding until the design is complete.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc