Python Operating System

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PythonUsr

    #1

    Python Operating System

    Although I know for a fact that an Operating System can be written in
    Python, I need to ask some questions to the more advanced users of
    Python.

    Uuu and Cleese are two operating systems that were / are written in
    Python. Does anyone use them? If so, how do they function / feel? Do
    they have a graphical mode and a command line mode, such as Linux does?

    How hard would it be to write a full blown bootable operating system in
    Python? With a command line and a GUI in all? Would the books you see
    on the shelves at, say, Barnes and Noble, do the trick? Or do you need
    to dig deeper into the language than what is taught in the 1,000 page
    books?

    Thanks in advance, and I am truly sorry if this has been a discussion
    before in this group!

    -- Alex (PythonUsr)

  • Diez B. Roggisch

    #2
    Re: Python Operating System

    PythonUsr schrieb:
    Although I know for a fact that an Operating System can be written in
    Python, I need to ask some questions to the more advanced users of
    Python.
    >
    Uuu and Cleese are two operating systems that were / are written in
    Python. Does anyone use them? If so, how do they function / feel? Do
    they have a graphical mode and a command line mode, such as Linux does?
    >
    How hard would it be to write a full blown bootable operating system in
    Python? With a command line and a GUI in all? Would the books you see
    on the shelves at, say, Barnes and Noble, do the trick? Or do you need
    to dig deeper into the language than what is taught in the 1,000 page
    books?
    There are limits to what Python can do as a language for OS development.
    For example, Python has no notion of pointers and thus makes
    writing interrupt routines impossible, which are the base for nearly all
    lower level OS tasks like IO-drivers, memory virtualization and the like.

    What these projects are more like is a bootable interpreter on a minimal
    OS kernel. At least in my book that doesn't count as an operating
    system, but here definitions might vary. Yet it certainly isn't a
    general purpose OS, as no binary interfaces to OS services are defined
    that would make calls from other languages into the OS possible.

    In other words: IMHO, it is _not_ possible to write an OS in Python, at
    least not if OS is understood the way current OSses work. And even if
    the definition is stretched, there is a more than fair amount of work
    that needs to be done in other languages, most likely C - either because
    Pyhon isn't capable of doing them at all, or just not fast enough to do
    them proper.

    Regarding the books to read: this kind of programming isn't so much
    about the details of python, albeit some of its inner workings like the
    GIL put up quite a few hurdles for the aspiring OS programmer, but of OS
    concepts and designs. Which is a field Andrew Tanenbaum has earned quite
    a few merits, so I guess his book could be a starter:



    Diez

    Comment

    • Richard Jones

      #3
      Re: Python Operating System

      Diez B. Roggisch wrote:
      Python has no notion of pointers
      See:

      Source code: Lib/ctypes ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these ...


      In particular:




      Richard

      Comment

      • Diez B. Roggisch

        #4
        Re: Python Operating System

        Richard Jones schrieb:
        Diez B. Roggisch wrote:
        >Python has no notion of pointers
        >
        See:
        >
        Source code: Lib/ctypes ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these ...

        >
        In particular:
        >
        http://docs.python.org/lib/ctypes-pointers.html
        Certainly cool, yet not too helpful for writing an interrupt handler
        that needs to run lightning fast & without prior GIL acquisition.

        Also PyPy with RPython might someday add much to the low-level
        programming capabilities, but a pure Python OS isn't feasible IMHO right
        now.

        Diez

        Comment

        Working...