Page 4 of 4
Re: An OS without context switching
Posted: Sat Nov 05, 2011 11:42 am
by nulik
berkus wrote:Come on, dz didn't publish anything working yet. Phantom is just some experimental "vaporware".
I thought that too, but apparently there is a code and it is running, see screen shot:
http://phantomuserland.googlecode.com/f ... 10_SMP.png
And I think this is the kernel:
http://code.google.com/p/phantomuserlan ... p&can=2&q=
(i didn't test it)
Re: An OS without context switching
Posted: Sat Nov 05, 2011 4:02 pm
by gerryg400
Looking at the screenshot I see 6 threads in the _run_ state. 3 of those threads are marked as CPU 2. In fact there appear to be 9 threads in various states on CPU 2. That implies context switching. I call BS on the implementation. Or did I misunderstand ?
Re: An OS without context switching
Posted: Sat Nov 05, 2011 4:04 pm
by cxzuk
Phantom runs threads, so why wouldnt it have a context switch?
Re: An OS without context switching
Posted: Sat Nov 05, 2011 4:10 pm
by gerryg400
Because the FAQ says there are no context switches.
But the wiki page on KernelThreads says wrote:Phantom kernel is preemptively multithreaded. Threads sync API (see KernelSync) is more or less the same as in pthreads, but not exactly.
Re: An OS without context switching
Posted: Sat Nov 05, 2011 4:28 pm
by cxzuk
I can only assume it means the kernel doesn't cause a context switch.. but nulik refers to the OS not causing context switches?
KernelSync discusses disabling interrupts to stop context switchs o_O
Re: An OS without context switching
Posted: Sat Nov 05, 2011 6:48 pm
by nulik
cxzuk wrote:I can only assume it means the kernel doesn't cause a context switch.. but nulik refers to the OS not causing context switches?
KernelSync discusses disabling interrupts to stop context switchs o_O
would it be "semi-preemptive" then ? ehm, don't know, just kidding. kernel sources aren't published.
From what I understand from PhantomArchitecture page on the wiki is that the kernel has the virtual machine inside, so it is the virtual machine that interprets all the methods (bytecode) of the objects, i.e a single application running on one core, sort of applies as being no context switched from a unix point of view, but there are lots of threads inside virtual machine, and each thread of course is context switched....
This is what I understood, but I think on the first benchmarking (measured as amount of webserver requests per second from another machine, for example) it will show poor performance, because it is interpreted.
Re: An OS without context switching
Posted: Sun Nov 06, 2011 6:09 am
by cxzuk
nulik wrote:cxzuk wrote:I can only assume it means the kernel doesn't cause a context switch.. but nulik refers to the OS not causing context switches?
KernelSync discusses disabling interrupts to stop context switchs o_O
would it be "semi-preemptive" then ? ehm, don't know, just kidding. kernel sources aren't published.
From what I understand from PhantomArchitecture page on the wiki is that the kernel has the virtual machine inside, so it is the virtual machine that interprets all the methods (bytecode) of the objects, i.e a single application running on one core, sort of applies as being no context switched from a unix point of view, but there are lots of threads inside virtual machine, and each thread of course is context switched....
This is what I understood, but I think on the first benchmarking (measured as amount of webserver requests per second from another machine, for example) it will show poor performance, because it is interpreted.
I think its safe to say there is no way to get around a context switch. They are a critical part of the computer.
Re: An OS without context switching
Posted: Sun Nov 06, 2011 7:18 am
by Combuster
cxzuk wrote:I think its safe to say there is no way to get around a context switch. They are a critical part of the computer.
That's not true. The problem is that eliminating
context switches (as opposed to bluffing your way out by giving it a different name) means a single program single tasking system. For a lot of embedded applications that's quite sufficient, but for an OS of any meaning it is simply an requirement - after all, even DOS has context switches. It's fast because there are always exactly two switches per task, which happens to be the academic minimum.
Re: An OS without context switching
Posted: Sun Nov 06, 2011 10:22 am
by nulik
Combuster wrote: The problem is that eliminating context switches means a single program single tasking system
as I understand, context switch is INTERRUPTION of a running process to give time to another process. But you can run many tasks of the same program until the program can't continue because of dependencies with other programs. The program will have to leave the CPU. This will be a MULTI tasking system on ONE core.
So, it IS possible to have an OS without context switching.
The problem is to organize the software to execute in a cooperative way, probably the programs must be behaving more like libraries than as independent applications. Unix was developed 50 years ago, and computers were single CPU, so you had to do context switching. Today we have multicore systems that can easily distribute tasks on different cores being free to run the time slice they need, but the preemptive paradigm keeps dragging developers into the old style.
I do not have a ready solution yet using cooperative multiasking, but this is the idea and I am working on it.
Re: An OS without context switching
Posted: Sun Nov 06, 2011 11:06 am
by jnc100
From what I gather, Phantom does away with the idea of a process (i.e. a collection of threads within a single address space) and has all programs which are loaded create any number of threads within a single global address space (with memory protection provided by software). Switching between threads still exists (presumably in the standard timer interrupt-driven pre-emptive way) but these only require changing of the cpu registers, rather than the address space as well (cr3 in intel parlance), thus reducing tlb misses. This is similar to the way most current managed code os's work on 64 bit architectures.
Regards,
John.