Python Operating System???
b at b.b
Tue Jan 11 09:59:49 CET 2005
> Huh? I'm just baffled why you think writing a scheduler in an OS is
> harder than writing one in an application. You have some means of
> doing a coroutine switch in one situation, and some means of doing a
> hardware context switch in the other. Aside from that the methods are
> about the same.
Because of performance. Task schedulers and device drivers tend to be
timing sensitive. Go look up "task schedular latency". The longer your
scheduler spends trying to figure out which thread to run, the longer the
latency will be.
I mean in the worst case, if you are interpreting everything, what if you
change the task scheduler code? Then an interrupt happens, and oh shit we
have to parse and recompile all the scheduling code. Oh wait now we ran out
of kernel memory -- now we have to run the garbage collector! Let your
interrupt wait, no?
It just seems nonsensical. Maybe not impossible, as I've already said. I
haven't tried it. But go ahead and try it -- I would honestly be interested
in the results, all kidding aside. It shouldn't be too time-consuming to
try, I suppose. Get Python running in the Linux kernel, and then replace
the task scheduling algorithm with some Python code. See how it works. I
suspect you will degrade the performance of an average system significantly
or unacceptably. But who knows, I could be wrong.
Of course, hardware is getting faster as you say. But multitasking
performance is still an active and important area of OS research, and I
doubt that any designer of an OS (that is actually meant to be used) would
spend any cycles to have their task scheduler in Python -- and that will be
probably be true for a very long time. Or maybe I'm wrong -- go bring it up
on comp.os.linux or whatever the relevant newsgroup is. I'd like to hear
what they have to say.
> Why do you think there's anything difficult about doing this stuff in
> Python, given the ability to call low level routines for some hardware
> operations as needed?
More information about the Python-list