Python OS

Richard Blackwood richardblackwood at cloudthunder.com
Mon Nov 8 11:57:49 EST 2004


Jeremy Jones wrote:

> Richard Blackwood wrote:
>
>> Is it possible to prototype an operating system in Python?  If so, 
>> what would such a task entail? (i.e. How would one write a 
>> boot-loader in Python?)
>>
>> - Richard B.
>
>
> Richard,
>
> I thought this was a great question that provoked a lot of discussion, 
> but unfortunately, 1) you took the brunt of unnecessary harshness due 
> to folks mostly jumping to incorrect conclusions about what you were 
> asking and what you were stating, 2) some of the folks who were 
> involved were folks I (typically) respect [same here], 3) no positive 
> resolution was posited [Indeed], and 4) the final answer seemed to be, 
> even if you could do it (in a totally virtual environment), it 
> wouldn't be of any benefit [I thoroughly disagree with the "any" part 
> particularly] for learning how an OS works.

What I do not quite understand is the overall assertion that low-level 
aspects of OS design can not be simulated.  Interrupts were much 
discussed, but I ask: can one not simulate interrupts?  It seems absurd 
to me that this would be impossible.  If in the process of creating an 
OS, you have to deal low-level aspects XYZ, it seems feasible that those 
aspects may be simulated.  Almost anything (objects, relationships 
between objects, events embodying shifts in such relationships, etc.) 
can be simulated via code.  If the question is whether the simulation 
will be complete and true to the _real_ thing, that is entirely up to 
one's choice of what aspects to incorporate into the simulation, which 
is dependent on one's knowledge of the original construct.  So I protest 
the assertion that it would not be of _any_ benefit for learning how an 
OS works, it is merely a matter of how well the simulation is 
constructed, a process which in itself brings one to understand more 
thoroughly not only OS components, but the underlying hardware.  It is 
sort of like writing an assembler before learning an assembly language: 
through the process one learns a great deal of how assemblers and 
hardware functions, and may know a great deal more than if one delved 
into MASM programming at first.  Nevertheless, I would not _recommend_ 
anyone to do this, but precisely my point, I did not ask anyone on this 
medium what the best method for learning how to write an OS is, nor was 
that the goal.  My aim was to do exactly as I posted, to prototype an OS 
in Python--- meaning that I have an OS written in Python that I can play 
around with in respect to design, functionality, and so forth; with 
perhaps the further aim of some point utilizing that prototype as a 
_sketch_ of what a real OS should be.  I care little if the prototype 
direct interfaces with hardware or with virtual hardware, as long as my 
prototype may take into account all critical (and non-critical) aspects 
of an OS architecture, _in Python_.

>
> I think building a virtual environment would be a great way of 
> learning more about how an OS works.  

Indeed.

> It may not give you much experience dealing with the real, very 
> low-level intricacies of what it takes to write a real OS, but I think 
> it would be a valuable learning experience, nonetheless.  

I never asked anyone here what the value of this experience would be and 
it seems strange to me that that was the sticking point for my 
respondents.  But I do agree with you, near entirely.

> And in addition, I think it could also teach how computer hardware 
> works as well.  

Yes.

> I'm considering posting a question to c.l.p about, would it be 
> possible to write a hardware emulator in Python, something along the 
> lines of the hardware of the Commodore 64 (remember those?).

Indeed, I remember when they came out with the prototype in early '82.

>   I'm not saying the C-64 itself, only a simple 8-bit (I think it was 
> 8 bit) processor or something comparable.  After writing such a beast, 
> what would it take to write an OS that sat on top of this virtual 
> piece of hardware?  I think such a project would be fascinating...if 
> only I had the time to work on it....  Maybe I won't post to the group 
> about it....don't have my flame-retardant suit on today ;-)

Probably wise!

>
> Anyway, great question and my apologies for the group.  They're 
> usually not like that.  Actually, someone pointed out that lately 
> they've been becoming like that.  I hope that changes soon.
>
>
> Jeremy

Thanks Jeremy, much appreciated.  My first post to this list was flamed 
(perhaps rightfully) so I am fast becoming used to it.



More information about the Python-list mailing list