Page 3 of 4

Re: An OS without context switching

Posted: Wed Nov 02, 2011 1:04 pm
by Casm
nulik wrote:One approach would be to force the programmer to write small code snippets that would run for a short period of time and distribute the snippets evenly accross multiple cores. Lets say the programmers accepted this approach and started to write small code functions. But some code might present bugs, and could enter into infinite loop.
You might be able to do that in a hobby operating system, but I wouldn't try it commercially. Companies which try to tell their customers what they want, or even what they can have, tend not to last very long, because their putative customers keep their money in their pockets.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 2:40 pm
by nulik
Casm wrote:
nulik wrote:One approach would be to force the programmer to write small code snippets that would run for a short period of time and distribute the snippets evenly accross multiple cores. Lets say the programmers accepted this approach and started to write small code functions. But some code might present bugs, and could enter into infinite loop.
You might be able to do that in a hobby operating system, but I wouldn't try it commercially. Companies which try to tell their customers what they want, or even what they can have, tend not to last very long, because their putative customers keep their money in their pockets.
No I am not going to do this. I have already read lots of papers on OSes and this approach is bad. With this approach I will have to pass messages between processes and that will end up a slow OS like happened to Mach, which is micro kernel based. Monolithic kernel will win because with a syscall and no context switch it is going to do the job faster while the snippets will be flushing the TLB.
But I have a new idea to make an OS with:
  • No syscall overhead
  • No context switching
  • No TLB misses
I am just checking the manuals if the hardware will support my protection scheme.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 4:22 pm
by cxzuk
nulik wrote:
Casm wrote:
nulik wrote:One approach would be to force the programmer to write small code snippets that would run for a short period of time and distribute the snippets evenly accross multiple cores. Lets say the programmers accepted this approach and started to write small code functions. But some code might present bugs, and could enter into infinite loop.
You might be able to do that in a hobby operating system, but I wouldn't try it commercially. Companies which try to tell their customers what they want, or even what they can have, tend not to last very long, because their putative customers keep their money in their pockets.
No I am not going to do this. I have already read lots of papers on OSes and this approach is bad. With this approach I will have to pass messages between processes and that will end up a slow OS like happened to Mach, which is micro kernel based. Monolithic kernel will win because with a syscall and no context switch it is going to do the job faster while the snippets will be flushing the TLB.
But I have a new idea to make an OS with:
  • No syscall overhead
  • No context switching
  • No TLB misses
I am just checking the manuals if the hardware will support my protection scheme.
I dont understand your goal?

If you have no context switch, it means you can only ever have one thread running.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 4:42 pm
by nulik
cxzuk wrote:
I dont understand your goal?

If you have no context switch, it means you can only ever have one thread running.
On the core it is running currently yes, but no thread runs forever. When a thread depends on other processes it can stop execution, new thread can be run on this core. Today's systems have 4 cores, you can run 4 threads in parallel, share the data using shared memory. A better workload organization can easily put an end to context switching, specially on Bulldozer cpus with 8 cores, you will have to redesign all the software though.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 4:49 pm
by cxzuk
nulik wrote:
cxzuk wrote:
I dont understand your goal?

If you have no context switch, it means you can only ever have one thread running.
On the core it is running currently yes, but no thread runs forever. When a thread depends on other processes it can stop execution, new thread can be run on this core. Today's systems have 4 cores, you can run 4 threads in parallel, share the data using shared memory. A better workload organization can easily put an end to context switching, specially on Bulldozer cpus with 8 cores, you will have to redesign all the software though.
But once the thread ends, it has to do a context switch.

"When a thread depends on other processes it can stop execution, new thread can be run on this core." - Your talking about co-operative multitasking.

So from that, I think what you mean is no pre-emptive context switches.

If so, check out BareMetal (http://www.returninfinity.com/baremetal.html) as its aims are the same, code is very clean and done well.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 5:04 pm
by gerryg400
nulik wrote:
cxzuk wrote:
I dont understand your goal?

If you have no context switch, it means you can only ever have one thread running.
On the core it is running currently yes, but no thread runs forever. When a thread depends on other processes it can stop execution, new thread can be run on this core. Today's systems have 4 cores, you can run 4 threads in parallel, share the data using shared memory. A better workload organization can easily put an end to context switching, specially on Bulldozer cpus with 8 cores, you will have to redesign all the software though.
I see no issue with that but this can be achieved with a Posix confirming microkernel like QNX Neutrino. You only need processor affinity, hard realtime scheduling and the ability to disable pre-emption on a thread-by-thread basis (using SCHED_FIFO) and you have it. Neutrino does all these things and additionally has things that really matter like adaptive, sporadic and partitioned scheduling.

[Edit] Just to be sure that I'm not seen as a QNX fanboy, I acknowledge that QNX is not perfect. I'm saying that Posix might already provide what you're looking for.

Re: An OS without context switching

Posted: Wed Nov 02, 2011 8:28 pm
by nulik
gerryg400 wrote: this can be achieved with a Posix confirming microkernel like QNX Neutrino.
Neutrino is almost perfect, the only problem is the proprietary license.
Besides BareMetal OS I have not found any cooperative multitasking OSes, so I probably will start my own project.

Re: An OS without context switching

Posted: Thu Nov 03, 2011 12:54 am
by rdos
IMO, just providing cooperative multitasking features is of little interest. What is interesting is to provide hard realtime functions in a preemptive-multitasking OS, which is quite different. I think this can be done by allocating a core to a realtime-task (or tasks) that use cooperative multitasking. The hard thing is to let the realtime tasks use and communicate with ordinary OS functions. Just disabling preemption will not guarantee that a realtime task gets to run when it needs to. It takes much more than that.

Re: An OS without context switching

Posted: Thu Nov 03, 2011 11:52 am
by bontanu
nulik wrote:
gerryg400 wrote: this can be achieved with a Posix confirming microkernel like QNX Neutrino.
Neutrino is almost perfect, the only problem is the proprietary license.
Besides BareMetal OS I have not found any cooperative multitasking OSes, so I probably will start my own project.
I guess that you did not search too well ;)

SolarOS is cooperative (an it has been from the start) and it is also realtime and it has an advanced API and GUI ;)

Even it there are no public releases lately be assured that it is still developed by me ;)

http://www.oby.ro/

Re: An OS without context switching

Posted: Thu Nov 03, 2011 2:02 pm
by nulik
bontanu wrote: SolarOS is cooperative (an it has been from the start) and it is also realtime and it has an advanced API and GUI ;)

http://www.oby.ro/
awesome!
I downloaded sol_os_2009_07_22_v0_104_05.zip but where are the sources ? can't find them. also qemu complained about floppy and aborted the boot process.

Re: An OS without context switching

Posted: Thu Nov 03, 2011 3:33 pm
by Brynet-Inc
I don't think he releases source anymore, but you never know, he's gone back and forth often enough.

I remember trolling on his forum a few years ago. Fun times.

Re: An OS without context switching

Posted: Thu Nov 03, 2011 5:28 pm
by nulik
Brynet-Inc wrote:I don't think he releases source anymore, but you never know, he's gone back and forth often enough.

I remember trolling on his forum a few years ago. Fun times.
don't worry, if finish my (cooperative) OS it will be GPL

Re: An OS without context switching

Posted: Thu Nov 03, 2011 5:50 pm
by Brynet-Inc
nulik wrote:don't worry, if finish my (cooperative) OS it will be GPL
I'm worried.

Re: An OS without context switching

Posted: Fri Nov 04, 2011 10:22 am
by sandras
nulik wrote:don't worry, if finish my (cooperative) OS it will be GPL
I'm worried.

Not to start a license flame war, I would choose something that is short and to the point - I still haven't read all of any of the GNU licenses and I probably never will, because they are so long, complex and mind numbingly boring, I only sort of know what they say from other sources. Whether I agree with them is another story.

Re: An OS without context switching

Posted: Sat Nov 05, 2011 8:35 am
by nulik
Found another OS that is supposedly without context switching:
http://tech.slashdot.org/story/09/02/06 ... century-os
Code: http://code.google.com/p/phantomuserland/
I personally don't like object oriented stuff (because it is slow) , so I doubt this OS will be faster than Linux, because if the kernel does range checking in code and there is a lot of messages between objects, this OS will be the slowest ever. The best way is to rely on page fault checking mechanism which is done in hardware.