473,770 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python OS

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.
Jul 18 '05 #1
24 3450
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?)

There have been lengthy discussions on this subject in this group - google
is your friend.

Generally spaeking, its not possible - as there is a fair amount of
low-level stuff to be progammed for interrupt routines and the like that
can not be done in python.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2
Diez B. Roggisch 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?)

There have been lengthy discussions on this subject in this group - google
is your friend.

I know, I read them. The conclusion was that indeed, it can and in fact
has been done.
Generally spaeking, its not possible - as there is a fair amount of
low-level stuff to be progammed for interrupt routines and the like that
can not be done in python.

More what I meant was whether I can _prototype_ an OS in Python (i.e.
make a virtual OS).

P.S. If one can program interrupt routines in C, they can do the same
in Python.
Jul 18 '05 #3
> I know, I read them. The conclusion was that indeed, it can and in fact
has been done.
Hm. I'll reread them myself and see if what has been achieved in this field.
But I seriously doubt that someone took a python interpreter and started
writing an OS.

I can imagine having an OS _based_ on python, where the os api is exposed
using python - but still this requires a fair amount of lowlevel stuff that
can't be done in python itself, but must be written in C or even assembler.
More what I meant was whether I can _prototype_ an OS in Python (i.e.
make a virtual OS).
P.S. If one can program interrupt routines in C, they can do the same
in Python.


Show me how you set the interrupt jumptables to your routines in python and
how you write time-critical code which has to be executed in a few hundred
cpu-cycles. And how good that works together with the GIL.
--
Regards,

Diez B. Roggisch
Jul 18 '05 #4
Diez B. Roggisch wrote:
Hm. I'll reread them myself and see if what has been achieved in this field.
But I seriously doubt that someone took a python interpreter and started
writing an OS.


I am aware of at least one attempt. See
http://cleese.sourceforge.net/cgi-bin/moin.cgi and the mailing list
archive. They managed to boot a specially modified VM and run simple
Python programs. Unfortunately the project was abandoned about a year ago.
--
Benji York
be***@benjiyork .com

Jul 18 '05 #5
Benji York wrote:
Diez B. Roggisch wrote:
Hm. I'll reread them myself and see if what has been achieved in this
field. But I seriously doubt that someone took a python interpreter and
started writing an OS.


I am aware of at least one attempt. See
http://cleese.sourceforge.net/cgi-bin/moin.cgi and the mailing list
archive. They managed to boot a specially modified VM and run simple
Python programs. Unfortunately the project was abandoned about a year
ago.


And it backs my assertions:

--------------
Code that is written in either Assembly Language, Boa (see BoaPreprocessor )
or C is often referred to here (and in mailing list discussions) as ABC
Code. (Coincidently, "ABC" is one of the languages that Python was
originally based on)
Different components of Cleese live in different layers:
Layer 1
start-up code, low-level hardware services and any library code required by
Python virtual machine - ABC code

Layer 2
the Python virtual machine - C code

Layer 3
the kernel and modules - Python code

Layer 4
user-level applications - Python code
---------------

http://cleese.sourceforge.net/cgi-bi...seArchitecture

So the lowest layer _is_ written in assembler, C or something else that's
allowing for pythonesque source but generates assembler. That was precisely
my point.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #6
Diez B. Roggisch wrote:
And it backs my assertions:


Definitely. I missed that part.

I wonder if someone were to start a similar project today if they would
be able to use Pyrex (which generates C) to do large parts of the OS.

Perhaps when I retire <wink>.
--
Benji York
be***@benjiyork .com

Jul 18 '05 #7
P.S. If one can program interrupt routines in C, they can do the same
in Python.


Show me how you set the interrupt jumptables to your routines in python and
how you write time-critical code which has to be executed in a few hundred
cpu-cycles. And how good that works together with the GIL.

Here is my logic: If one can do X in C and Python is C-aware (in other
words Python can be exposed to C) then Python can do X via such exposure.
Jul 18 '05 #8
Benji York wrote:
Diez B. Roggisch wrote:
And it backs my assertions:

Definitely. I missed that part.

I wonder if someone were to start a similar project today if they
would be able to use Pyrex (which generates C) to do large parts of
the OS.

Perhaps when I retire <wink>.


An intriguing possibility, I do not see what obstacles exist here but I
am sure they exist. A question: In Pyrex may I perform a malloc?
Jul 18 '05 #9
Richard Blackwood wrote:
P.S. If one can program interrupt routines in C, they can do the same
in Python.


Show me how you set the interrupt jumptables to your routines in
python and
how you write time-critical code which has to be executed in a few
hundred
cpu-cycles. And how good that works together with the GIL.

Here is my logic: If one can do X in C and Python is C-aware (in other
words Python can be exposed to C) then Python can do X via such exposure.


Unfortunately the logic is flawed, even in the case that you
quoted above!

You _cannot_ use Python for a time-critical interrupt, even
when you allow for pure C or assembly code as the bridge
(since Python _cannot_ be used natively for interrupts, of
course), because -- as noted above! -- the interrupt must
execute in a few hundred CPU cycles.

Given that the cost of invoking the Python interpreter on
a bytecode-interrupt routine would be several orders of
magnitude higher, I don't understand why you think it
is possible for it to be as fast.

Of course, if you will allow both assembly/C code here and
there as a bridge, *and* you are willing to accept an operating
system that is arbitrarily slower at certain time-critical
operations (such as responding to mouse activities) than we
are used to now, then certainly Python can be used for such things...

-Peter
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.