Re: Python Operating System
Richard Jones schrieb: Diez B. Roggisch wrote: Python has no notion of pointers See: http://docs.python.org/lib/module-ctypes.html 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
jtauber schreef: see http://cleese.sourceforge.net/ There is not much to see there, most of the wiki is filled with spam... -- JanC Be strict when sending and tolerant when receiving. RFC 1958 - Architectural Principles of the Internet - section 3.9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
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? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose [EMAIL PROTECTED] writes: Well, then of course you know I have to say: An OS does not run inside a browser. There's a sentence I never thought I'd utter in my lifetime. So that is an irrelevant example, since it obviously isn't a task scheduler in the context of this thread. 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. 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? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose wrote: ... I was thinking that there would be a Lisp interpreter in a kernel, which afaik doesn't exist. There's an implementation of scheme that runs as a kernel module in Linux - it's designed to allow people to experiment with exploring kernel data structures at run time, and other fun things. It's a case in point for avoiding saying that something that doesn't necessarily sound sensible doesn't exist - there's a good chance it does :) Michael -- [EMAIL PROTECTED] British Broadcasting Corporation, Research and Development Kingswood Warren, Surrey KT20 6NP This message (and any attachments) may contain personal views which are not the views of the BBC unless specifically stated. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai wrote: Paul Rubin wrote: Roose [EMAIL PROTECTED] writes: Lots of bickering and just plain good sport snipped out What I really wonder about is the possibility of integrating Mono with a kernel and building upward (the shell if you will) using IronPython. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roose [EMAIL PROTECTED] writes: Are you actually going to answer any of my questions? Let's see this JavaScript task scheduler you have written! I wrote it at a company and can't release it. It ran inside a browser. There was nothing terribly amazing about it. Obviously the tasks it scheduled were not kernel tasks. Do you know how Stackless Python (with continuations) used to work? That had task switching, but those were not kernel tasks either. Well, then of course you know I have to say: An OS does not run inside a browser. There's a sentence I never thought I'd utter in my lifetime. So that is an irrelevant example, since it obviously isn't a task scheduler in the context of this thread. Anyway, this argument is going nowhere... I will admit that people have pointed out things here that are interesting like the attempts to embed Python in a kernel. But the point was that the OP was looking for an easier way to write an OS, and thought that might be to do it in Python, and I think I gave some good guidance away from that direction. That is mostly what I care about. These other arguments are academic, and of course I am not trying to stop anyone from trying anything. When I we see real working example, then we will all have a better idea of what the problems are, and how much of it can realistically be implemented in an interpreted language. Frankly I don't think that will come for about 10 years if ever, but hey prove me wrong. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
John Roth wrote: jtauber [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My experiment, Cleese, was making progress before I got distracted by other things. I should probably get back to it at some stage. As my ex-wife was fond of saying, I wish you'd have told me it was impossible before I did it. John Roth Is that why she divorced you? You will notice that tauber says he stopped working on Cleese due to distraction not a lack of progress or a notion of impending doom/impossibility. see http://cleese.sourceforge.net/ James Tauber http://jtauber.com/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose wrote: It's a difference of degree, but an important difference. I haven't looked at Linux or Windows NT source, but my guess is the assembly used is just small functions for accessing special CPU instructions for atomicity, context switching, and the like. I KNOW they don't have huge amounts of assembly simply because they run on different architectures. But are you really going to write a virtual memory system in Python? Are you going to write a file system, and a task scheduler in Python? Are you going to have people write device drivers in Python? Cleese!! I'm not saying it can't be done, but it would be a poor engineering decision, and the rationale thus far seems to be Python is cool, I like OSes, let's write a whole OS in Python. If that's not the case then let me know what your rationale is. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: ... OK, then give me an example of Lisp OS that runs on a PC. I would like to install it on my PC tomorrow. Or maybe my Mac. That was your whole point, originally, that since it could be done in Lisp, why not Python? Huh? That's a non-sequitur, nothing prevents you from running Lisp on your PC or Mac. The same issues issues that apply to OS code, also apply to user code. The Lisp machine hardware wasn't needed only to make the OS run fast. The Lisp machine was developed so that people could deploy large user-level applications written in Lisp, and the hardware was there to support those applications. And given such a good Lisp environment, there was no reason to think of writing the OS in anything other than Lisp. In fact, the reason the Lisp machine died off was because general purpose workstation hardware (and later, PC-class hardware) became fast enough to run Lisp applications without needing special purpose CPU's. That same PC hardware speed is what makes it possible to run user applications in Python. So true, there was indeed a contextual reason for special hardware, and the context has since changed (dramatically). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
I've written file systems in Python, and task schedulers in Javascript, and they were fine for their purposes Uh, not to be rude, but what are you talking about? If I'm not mistaken Javascript is that scripting language that runs inside a browser, an application. How are you going to save and restore CPU state in Javascript, or even call assembly that does it in Javascript? How do you switch into kernel mode in Javascript? We are on completely different pages apparently. Huh? That's a non-sequitur, nothing prevents you from running Lisp on your PC or Mac. The same issues issues that apply to OS code, also apply to user code. The Lisp machine hardware wasn't needed only to make the OS run fast. The Lisp machine was developed so that people could deploy large user-level applications written in Lisp, and the hardware was there to support those applications. And given such a good Lisp environment, there was no reason to think of writing the OS in anything other than Lisp. Upon reading back in the thread I see that you mean compiled Lisp, no? I was thinking that there would be a Lisp interpreter in a kernel, which afaik doesn't exist. In any case, as I said before I don't think it is impossible, just a poor engineering decision and I don't see the rationale behind it. Sure you can do anything for intellectual purposes and you'd probably learn a lot, but the OP is looking for an easier way to write an OS -- and that is not to write it in Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose [EMAIL PROTECTED] writes: I've written file systems in Python, and task schedulers in Javascript, and they were fine for their purposes Uh, not to be rude, but what are you talking about? If I'm not mistaken Javascript is that scripting language that runs inside a browser, Correct. an application. How are you going to save and restore CPU state in Javascript, or even call assembly that does it in Javascript? How do you switch into kernel mode in Javascript? We are on completely different pages apparently. Correct. Upon reading back in the thread I see that you mean compiled Lisp, no? I was thinking that there would be a Lisp interpreter in a kernel, which afaik doesn't exist. Yes, compiled Lisp. There are Python compilers too. In any case, as I said before I don't think it is impossible, just a poor engineering decision and I don't see the rationale behind it. I don't see a convincing case against writing an OS even in interpreted Python, though of course I'd want it to be compiled if possible. What do you think OS's do, that Python wouldn't be suitable for? Your examples of task switching and virtual memory are unconvincing. Those just require setting up some suitable tables and then calling a low-level routine to poke some CPU registers. File systems can be more performance intensive, but again, in those, much of the cpu drain can be relegated to low-level routines and the complexity can be handled in Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: Roose [EMAIL PROTECTED] writes: ... Upon reading back in the thread I see that you mean compiled Lisp, no? I was thinking that there would be a Lisp interpreter in a kernel, which afaik doesn't exist. Yes, compiled Lisp. There are Python compilers too.\ ??? You mean like Pyrex or some such? I wouldn't exactly call these Python compilers, as that kind of obscures some underlying (critical) facts. In any case, as I said before I don't think it is impossible, just a poor engineering decision and I don't see the rationale behind it. I don't see a convincing case against writing an OS even in interpreted Python, though of course I'd want it to be compiled if possible. What do you think OS's do, that Python wouldn't be suitable for? Your examples of task switching and virtual memory are unconvincing. Those just require setting up some suitable tables and then calling a low-level routine to poke some CPU registers. File systems can be more performance intensive, but again, in those, much of the cpu drain can be relegated to low-level routines and the complexity can be handled in Python. Correct. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai [EMAIL PROTECTED] writes: Yes, compiled Lisp. There are Python compilers too.\ ??? You mean like Pyrex or some such? I wouldn't exactly call these Python compilers, as that kind of obscures some underlying (critical) facts. Also psyco. And I think Pypy is currently set up to compile Python into Pyrex and then run the Pyrex results through GCC. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roose [EMAIL PROTECTED] writes: I've written file systems in Python, and task schedulers in Javascript, and they were fine for their purposes Uh, not to be rude, but what are you talking about? If I'm not mistaken Javascript is that scripting language that runs inside a browser, Correct. an application. How are you going to save and restore CPU state in Javascript, or even call assembly that does it in Javascript? How do you switch into kernel mode in Javascript? We are on completely different pages apparently. Correct. Are you actually going to answer any of my questions? Let's see this JavaScript task scheduler you have written! I'm calling bullshit on that, seeing as you declined to say anything useful about it. But I'm open to learn anything. Let's see it. Until then I'm not sure I want to spend a lot of energy arguing with you, because you're either pulling my leg or just profoundly mistaken. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose [EMAIL PROTECTED] writes: Are you actually going to answer any of my questions? Let's see this JavaScript task scheduler you have written! I wrote it at a company and can't release it. It ran inside a browser. There was nothing terribly amazing about it. Obviously the tasks it scheduled were not kernel tasks. Do you know how Stackless Python (with continuations) used to work? That had task switching, but those were not kernel tasks either. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: Arich Chanachai [EMAIL PROTECTED] writes: Yes, compiled Lisp. There are Python compilers too.\ ??? You mean like Pyrex or some such? I wouldn't exactly call these Python compilers, as that kind of obscures some underlying (critical) facts. Also psyco. Directly to machine code how could anyone say this is not compiled Python. I am right with you. On the other hand however, its compilation occurs on-the-fly (JIT) and is no more compiled than Java. There is an argument either way. I have heard of Java OSs in the works and possibly already existing...are these pure Java? And I think Pypy is currently set up to compile Python into Pyrex and then run the Pyrex results through GCC. But of course, who's going to argue that Pyrex produces compiled Python? I expect many would beg to differ, and in fact might like to kiss your toes just for the mere pleasure of contradicting and arguing against any assertion that Pyrex produces compiled Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai [EMAIL PROTECTED] writes: And I think Pypy is currently set up to compile Python into Pyrex and then run the Pyrex results through GCC. But of course, who's going to argue that Pyrex produces compiled Python? Pyrex produces compiled Python in the same sense that asm produces compiled C. PyPy contains a Python compiler which reads Python source and produces Pyrex output. The Pyrex output then gets compiled by the Pyrex compiler and then the C compiler before ending up with machine code. There is nothing terribly bizarre about this kind of compiler. For example, Gnu Common Lisp compiles Lisp code into C, then runs the C code through gcc. For that matter, the Yacc/Bison parser generators do something similiar. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
But I thought Python was an all-purpose language. After all, OS's have been written in Lisp before too. It is a general purpose APPLICATION language. I am surprised that this hasn't been mentioned on this thread. An OS is NOT an application. It is a completely different kind of program. Do you guys understand the difference between user and kernel mode? Do you know what address spaces and hardware interrupts are? Python is not equipped to handle these things. You would end up doing so much in C extensions that it could barely be called Python. I am not trying to be insulting... but unless someone would like to educate me otherwise, the idea of an OS written in Python is almost ludicrous. As I said, I think you might mean an OS SHELL, which would be a reasonable (although maybe unconventional) thing to write in python. Also I am no threading expert, but I would imagine it would be very hard to write a task scheduler in Python given that it has the whole GIL thing. (As I said that isn't my domain of expertise but I'm sure someone here could expound on that.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose [EMAIL PROTECTED] writes: An OS is NOT an application. It is a completely different kind of program. Do you guys understand the difference between user and kernel mode? Do you know what address spaces and hardware interrupts are? Python is not equipped to handle these things. You would end up doing so much in C extensions that it could barely be called Python. You'd need some library functions to let Python access device registers and you'd need some low level code to dispatch interrupts into Python code. I am not trying to be insulting... but unless someone would like to educate me otherwise, the idea of an OS written in Python is almost ludicrous. Is an OS written in Lisp also ludicrous? Because it's been done. When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Also I am no threading expert, but I would imagine it would be very hard to write a task scheduler in Python given that it has the whole GIL thing. (As I said that isn't my domain of expertise but I'm sure someone here could expound on that.) The GIL is not part of the Python language. It's just an artifact of one particular implementation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
So how would I make an OS Shell? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Actually, when Unix was first written that belief was entirely correct, and OSes *did* have to be written in assembler. That is, pure C did not have the capability to handle all that was required. I recall it taking a good decade before it became *common* to find C compilers with, for example, @interrupt support to let the compiler generate code that properly saved all registers and used RTI instead of RTS (or whatever it might have been called one one's particular flavour of CPU). Now, once you added a few tiny interrupt handlers, and some context switching (stack manipulation) routines, pretty much everything else *could* be done in C, but that doesn't invalidate the point. I think it's safe to say that none of pure C, pure Lisp, or pure Python are really capable of being used as the *sole* language to build an operating system. It's also safe to say that this is a largely irrelevant point. It would probably only be of academic interest to try to do something like that. Any practical attempt would not think more than twice of resorting to a little glue in assembler or in the form of canned byte sequences built by hand and stuck into the appropriate places in memory... -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Peter Hansen wrote: Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Actually, when Unix was first written that belief was entirely correct, and OSes *did* have to be written in assembler. *nods* That is, pure C did not have the capability to handle all that was required. I recall it taking a good decade before it became *common* to find C compilers with, for example, @interrupt support to let the compiler generate code that properly saved all registers and used RTI instead of RTS (or whatever it might have been called one one's particular flavour of CPU). If my memory serves me, you are entirely correct. Now, once you added a few tiny interrupt handlers, and some context switching (stack manipulation) routines, pretty much everything else *could* be done in C, but that doesn't invalidate the point. *nods* I think it's safe to say that none of pure C, pure Lisp, or pure Python are really capable of being used as the *sole* language to build an operating system. *nods* It's also safe to say that this is a largely irrelevant point. It would probably only be of academic interest to try to do something like that. Any practical attempt would not think more than twice of resorting to a little glue in assembler or in the form of canned byte sequences built by hand and stuck into the appropriate places in memory... -Peter Indeed indeed. Once must remain focused and ask oneself what he/she is attempting to achieve. In all likelihood, a little asm/c/python glue work won't hurt the objective, especially given that doing otherwise would entail a very _low level_ reworking of Python that would take as much and likely more effort and skill than to resort to asm/c when Python falls incapable. One could do a Python-Lisp OS w/ Lisp used for the Python incapable areas, but you would near entirely loose the benefits of Lisp in that respect--- it would have to be so low-level, could you call it Lisp? (A question someone else here posed in this thread.) - Arich -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Is an OS written in Lisp also ludicrous? Because it's been done. Can you point me to this? I'd like to see how truly Lisp it is. My first guess would be -- not very. And I'd like to install it on my PC. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Well can you describe what kind of things you want to do exactly? My guess is you are not out to develop a new algorithm for virtual memory or task scheduling. There are many parts to an OS shell. An example is the command line, i.e. bash and the like in Unix, and cmd.exe in Windows. In Windows, Windows Explorer could be considered part of the shell, as well as the start menu and all that user-specific stuff. Basically you need to pick your OS, and then find out what the API to program the shell to would be. e.g. in Windows you would do it with the Win32 API. This will let you do things like delete and create files, interact with user structures, the registry, etc. OR, as a first stab -- I would just write a prototype. i.e., don't tie it to a real OS. Just pretend you have your own users, your own file system, your own display space, etc. This will help you get a much better idea of what you want to do. David Brown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So how would I make an OS Shell? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
My experiment, Cleese, was making progress before I got distracted by other things. The approach was a micro-kernel in C made up of the CPython bytecode interpreter with the file-related calls to libc ripped out and some bare-metal port read/writes and memory operations exposed to Python as built-in functions. Everything else could then be written in pure Python. Dave Long was able to write a VGA driver in Python and an implementation of Sokoban that used it. You could then boot your machine to Sokoban :-) I should probably get back to it at some stage. see http://cleese.sourceforge.net/ James Tauber http://jtauber.com/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose [EMAIL PROTECTED] writes: Is an OS written in Lisp also ludicrous? Because it's been done. Can you point me to this? I'd like to see how truly Lisp it is. http://en.wikipedia.org/wiki/Lisp_machine My first guess would be -- not very. And I'd like to install it on my PC. Although written with federal funds at a university, it was never released to the public, but was instead offered for sale from some companies. The conflicts over this led to the birth of the free software movement. Also, it was never intended to run on PC's (which didn't exist at that time). It needed special hardware that was built for the purpose of running Lisp. Lately there are people trying to program PC's to simulate the Lisp hardware and to get the Lisp Machine software released (now that the commercial market for it has long since dried up). However, both of those projects have a ways to go. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
On Sat, 08 Jan 2005 08:28:12 GMT, Roose [EMAIL PROTECTED] wrote: I am not trying to be insulting... but unless someone would like to educate me otherwise, the idea of an OS written in Python is almost ludicrous. As I said, I think you might mean an OS SHELL, which would be a reasonable (although maybe unconventional) thing to write in python. That's a crazy idea I once had - what if a user could run Python as a shell of Linux/other free U**x, and access every single subsystem and piece of data in the object-like manner? Sure, things like pipes and immediate access to files without having to open() them and the whole filesystem hierarchy would have to be added. Quite a lot of plumbing work would have to be done, but once it were done, it would be like an object operating system, everything organized nicely in predictable object hierarchies with dot access. System scripts would no longer be a mess that breaks every now and then depending on slight differences in filesystem hierarchy. Python dictionaries with their ability to quickly bind names to various objects would make it possible to keep such hierarchy stable, even with data moving around on different physical disk partitions and folders. Instead of saying: # cp /etc/postfix/main.cf /mnt/floppy the user could say e.g. . copy system[config][mta] floppy or . copy system.config.mta floppy In an object system like Python it could be reasonable to consider writing a class that would implement at least a subset of generic interface to the equivalent functionalities of various MTAs. Maybe. With traditional filesystems trying smth like that is not really reasonable, because 99% of the time it would work, but 1% of the time it would fail and that 1% would ruin the whole venture, as handling low-level OS complexity for a non-tech user has to be more reliable than that - in two cases when I installed Linux for free for someone the installation was finally deleted by those users because the desktop shortcuts to devices like floppy and CD ultimately failed to work for some reason and using 'mount -t iso9660 ...' was not an option that they would consider learning and using really. Think about all the potential! On top of clean, stable system interface a user could use map, filter and reduce functions on various system objects. Handlers for files with known structure could be written, so dot or list or dictionary access would allow manipulating data inside the files, like file[rownumber]='spam', or spreadsheet_file['A2', 100]. Or you could issue commands like browser.go('somewhere') or desktop.edit('hello.txt'). I was considering writing smth like this myself but it's way over my head re low-level OS and kernel stuff. :-( IMHO Linux problem has long been that in its lower level interface (above kernel and below GUI) is way too much like traditional UNIX. Sure someone with sysadmin experience can use it - but in my experience it's way over the head of the typical user. Trying to teach them about mknod and /dev/* hierarchy is hopeless and too hard for them. -- It's a man's life in a Python Programming Association. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin: Lately there are people trying to program PC's to simulate the Lisp hardware and to get the Lisp Machine software released (now that the commercial market for it has long since dried up). However, both of those projects have a ways to go. There's a video of someone demoing how to use a Lisp Machine at http://lemonodor.com/archives/000103.html Andrew [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Actually, when Unix was first written that belief was entirely correct, and OSes *did* have to be written in assembler. That is, pure C did not have the capability to handle all that was required. I recall it taking a good decade before it became *common* to find C compilers with, for example, @interrupt support to let the compiler generate code that properly saved all registers and used RTI instead of RTS (or whatever it might have been called one one's particular flavour of CPU). Now, once you added a few tiny interrupt handlers, and some context switching (stack manipulation) routines, pretty much everything else *could* be done in C, but that doesn't invalidate the point. I think it's safe to say that none of pure C, pure Lisp, or pure Python are really capable of being used as the *sole* language to build an operating system. It's also safe to say that this is a largely irrelevant point. It would probably only be of academic interest to try to do something like that. Any practical attempt would not think more than twice of resorting to a little glue in assembler or in the form of canned byte sequences built by hand and stuck into the appropriate places in memory... Well, usually there's more than one tool in the chain from source to bootable loader and OS image, even if you are writing in C and assembler, and there's usually more to an OS than the bootable image contains. So ISTM writing an OS in language is pretty loose talk ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Bengt Richter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Actually, when Unix was first written that belief was entirely correct, and OSes *did* have to be written in assembler. That is, pure C did not have the capability to handle all that was required. I recall it taking a good decade before it became *common* to find C compilers with, for example, @interrupt support to let the compiler generate code that properly saved all registers and used RTI instead of RTS (or whatever it might have been called one one's particular flavour of CPU). Now, once you added a few tiny interrupt handlers, and some context switching (stack manipulation) routines, pretty much everything else *could* be done in C, but that doesn't invalidate the point. I think it's safe to say that none of pure C, pure Lisp, or pure Python are really capable of being used as the *sole* language to build an operating system. It's also safe to say that this is a largely irrelevant point. It would probably only be of academic interest to try to do something like that. Any practical attempt would not think more than twice of resorting to a little glue in assembler or in the form of canned byte sequences built by hand and stuck into the appropriate places in memory... Well, usually there's more than one tool in the chain from source to bootable loader and OS image, even if you are writing in C and assembler, and there's usually more to an OS than the bootable image contains. So ISTM writing an OS in language is pretty loose talk ;-) Most people who work in the field know what it means, though. One of the touchstones of language design is whether you can write the compiler and runtime in that language. PyPy is working on that for Python, Squeak Smalltalk is written in Smalltalk and then converted to C for compilation of the runtime. Both of them are completely virtualizable: you can run them (very slowly) under themselves for testing. Given that everything in Python is an object, I see no reason why one couldn't create a set of objects that are appropriate for an operating system kernel and can also be converted cleanly to the operating system subset of C, and write a converter that does it. That's the easy part. The hard part is writing the operating system. Look at the (lack of) progress the GNU HURD project has been making recently. John Roth Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
jtauber [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My experiment, Cleese, was making progress before I got distracted by other things. The approach was a micro-kernel in C made up of the CPython bytecode interpreter with the file-related calls to libc ripped out and some bare-metal port read/writes and memory operations exposed to Python as built-in functions. Everything else could then be written in pure Python. Dave Long was able to write a VGA driver in Python and an implementation of Sokoban that used it. You could then boot your machine to Sokoban :-) I should probably get back to it at some stage. As my ex-wife was fond of saying, I wish you'd have told me it was impossible before I did it. John Roth see http://cleese.sourceforge.net/ James Tauber http://jtauber.com/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
OK I've heard of that. But the original poster didn't ask to make a Python machine and then a Python OS. My point was that you can't do a lot of hardware interface programming in pure Python -- there would be so much non-trivial code in C that it would be hard to call it a Python OS. So this basically proves my point -- that you need different hardware altogether in order to make an OS in a high level language like Lisp or Python. And if that Lisp OS on a PC simulator works... that still wouldn't disprove what I'm saying. What does the PC simulator run on? An OS? or it part of the OS? Either way you've got tons of non-trivial code in C/C++/assembly. Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roose [EMAIL PROTECTED] writes: Is an OS written in Lisp also ludicrous? Because it's been done. Can you point me to this? I'd like to see how truly Lisp it is. http://en.wikipedia.org/wiki/Lisp_machine My first guess would be -- not very. And I'd like to install it on my PC. Although written with federal funds at a university, it was never released to the public, but was instead offered for sale from some companies. The conflicts over this led to the birth of the free software movement. Also, it was never intended to run on PC's (which didn't exist at that time). It needed special hardware that was built for the purpose of running Lisp. Lately there are people trying to program PC's to simulate the Lisp hardware and to get the Lisp Machine software released (now that the commercial market for it has long since dried up). However, both of those projects have a ways to go. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
On Sat, 8 Jan 2005 21:29:47 -0600, John Roth [EMAIL PROTECTED] wrote: Bengt Richter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen [EMAIL PROTECTED] wrote: Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in assembler. Actually, when Unix was first written that belief was entirely correct, and OSes *did* have to be written in assembler. That is, pure C did not have the capability to handle all that was required. I recall it taking a good decade before it became *common* to find C compilers with, for example, @interrupt support to let the compiler generate code that properly saved all registers and used RTI instead of RTS (or whatever it might have been called one one's particular flavour of CPU). Now, once you added a few tiny interrupt handlers, and some context switching (stack manipulation) routines, pretty much everything else *could* be done in C, but that doesn't invalidate the point. I think it's safe to say that none of pure C, pure Lisp, or pure Python are really capable of being used as the *sole* language to build an operating system. It's also safe to say that this is a largely irrelevant point. It would probably only be of academic interest to try to do something like that. Any practical attempt would not think more than twice of resorting to a little glue in assembler or in the form of canned byte sequences built by hand and stuck into the appropriate places in memory... Well, usually there's more than one tool in the chain from source to bootable loader and OS image, even if you are writing in C and assembler, and there's usually more to an OS than the bootable image contains. So ISTM writing an OS in language is pretty loose talk ;-) Most people who work in the field know what it means, though. Even if they know the whole story intimately, IMO it is not unlikely that they are talking about particular chapters, and it may not be clear whether they are thinking totally radically of rewriting ALL software in the system in Python, visualizing a holy grail of saying goodby to both GNU and M$ and having a purely Python-defined system (which would mean Python tool chains that could prepare binary images (no theoretical problem) for a computer's boot BIOS and on from there, as a tour de force project, or whether they want e.g. to integrate Python front end to gcc (or at one remove via C as is easier), and not reinvent so many wheels. One of the touchstones of language design is whether you can write the compiler and runtime in that language. PyPy is working on that for Python, Squeak Smalltalk is written in Smalltalk and then converted to C for compilation of the runtime. Both of them This runtime is then represented as an executable file that an OS shell you are using will ask its host OS kernel to load and execute as an OS-managed user process, right? Or is it bootable? If so, in what format that what loader understands? are completely virtualizable: you can run them (very slowly) under themselves for testing. But what binary is running? The compiled C output of the backend? Interpeting the Python source of itself to spit out the same C that it itself was compiled from? That's cool. And it shows that you can prepare a binary with the help of the C compiler+linker (most likely with gcc libraries) to produce a userland program executable. But I suspect some are thinking that Python source should implement the whole environment it runs in. That's more radical ;-) I would guess a cross development system hosted on a normal PC OS but targeting some limited embedded environment would be where I'd expect to see this kind of thing first. But still going via C tools to the end product most likely, since C is so ubiquitous. Given that everything in Python is an object, I see no reason why one couldn't create a set of objects that are appropriate for an operating system kernel and can also be converted cleanly to the operating system subset of C, and write a converter that does it. OSCTypes? That's the easy part. The hard part is writing the operating system. Look at the (lack of) progress the GNU HURD project has been making recently. There are more interesting things to do than reinvent wheels though, even if it is fun doing it in Python ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roose [EMAIL PROTECTED] writes: My point was that you can't do a lot of hardware interface programming in pure Python -- there would be so much non-trivial code in C that it would be hard to call it a Python OS. Why do you say that? Is the same thing not true of C, where you need some assembly code at the lowest levels? Because Linux has some assembly code, would you say that it's not written in C? It's a difference of degree, but an important difference. I haven't looked at Linux or Windows NT source, but my guess is the assembly used is just small functions for accessing special CPU instructions for atomicity, context switching, and the like. I KNOW they don't have huge amounts of assembly simply because they run on different architectures. But are you really going to write a virtual memory system in Python? Are you going to write a file system, and a task scheduler in Python? Are you going to have people write device drivers in Python? I'm not saying it can't be done, but it would be a poor engineering decision, and the rationale thus far seems to be Python is cool, I like OSes, let's write a whole OS in Python. If that's not the case then let me know what your rationale is. The right tool for the right job. I love Python probably more than any other language. But it's not the right tool for every job. I don't know why people would think it is, just as C is not the right tool for every job (which is one of the reasons I learned Python, being a C programmer first). So this basically proves my point -- that you need different hardware altogether in order to make an OS in a high level language like Lisp or Python. It doesn't prove anything of the sort. The Lisp hardware was needed for performance reasons, back in the day. OK, then give me an example of Lisp OS that runs on a PC. I would like to install it on my PC tomorrow. Or maybe my Mac. That was your whole point, originally, that since it could be done in Lisp, why not Python? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
In message [EMAIL PROTECTED], Christopher Koppler [EMAIL PROTECTED] writes Still, Java feels like C++ done right, while being more wrong :-[ Couldn't disagree more. Just about anything you want to do that is low-level, is impossible in Java. Anyway this is off-topic. Stephen -- Stephen Kellett Object Media Limitedhttp://www.objmedia.demon.co.uk RSI Information:http://www.objmedia.demon.co.uk/rsi.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
In message [EMAIL PROTECTED], Arich Chanachai [EMAIL PROTECTED] writes think). Or what about D? Digital Mars have a D compiler. http://www.digitalmars.com Stephen -- Stephen Kellett Object Media Limitedhttp://www.objmedia.demon.co.uk RSI Information:http://www.objmedia.demon.co.uk/rsi.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
[EMAIL PROTECTED] (Michael Hobbs) writes: The problem when using Python instead of C for OS development is that C was *specifically designed* to create an OS, while Python was designed for completely different purposes. If you want to write an OS, it would be wise to use a language that is suited for that purpose. If you dislike C so much and prefer Python so much more, your first step should be to design a Python dialect that is more appropriate for writing OS's. But I thought Python was an all-purpose language. After all, OS's have been written in Lisp before too. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
On Fri, 07 Jan 2005 16:34:48 -, [EMAIL PROTECTED] (Michael Hobbs) wrote: David Brown [EMAIL PROTECTED] wrote: Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an operating system for a long long time and the only possibilities I could find were C++ and assembly. The problem when using Python instead of C for OS development is that C was *specifically designed* to create an OS, while Python was designed for completely different purposes. If you want to write an OS, it would be wise to use a language that is suited for that purpose. If you dislike C so much and prefer Python so much more, your first step should be to design a Python dialect that is more appropriate for writing OS's. (I know that you mentioned C++, not C, but I decided to setup C as a straw-man to make my argument.) I'd say look at Ada for HLL inspiration, if you want to deal with OS level stuff in Python. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: [EMAIL PROTECTED] (Michael Hobbs) writes: The problem when using Python instead of C for OS development is that C was *specifically designed* to create an OS, while Python was designed for completely different purposes. If you want to write an OS, it would be wise to use a language that is suited for that purpose. If you dislike C so much and prefer Python so much more, your first step should be to design a Python dialect that is more appropriate for writing OS's. But I thought Python was an all-purpose language. After all, OS's have been written in Lisp before too. Pure Lisp? Or a Lisp/C/Asm combo? Lisp has a compiled flavor by the way. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai [EMAIL PROTECTED] writes: But I thought Python was an all-purpose language. After all, OS's have been written in Lisp before too. Pure Lisp? Or a Lisp/C/Asm combo? Lisp has a compiled flavor by the way. Compiled flavor? Lisp has been compiled since the 1950's. No, there was no C code on Lisp machines. There was some low-level code at the bottom whose capabilities were such that you could accurately call it asm, but it was Lisp too, just a very restricted form. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Paul Rubin wrote: Arich Chanachai [EMAIL PROTECTED] writes: But I thought Python was an all-purpose language. After all, OS's have been written in Lisp before too. Pure Lisp? Or a Lisp/C/Asm combo? Lisp has a compiled flavor by the way. Compiled flavor? Lisp has been compiled since the 1950's. :-) I was being sarcastic. No, there was no C code on Lisp machines. There was some low-level code at the bottom whose capabilities were such that you could accurately call it asm, but it was Lisp too, just a very restricted form. Fair enough. But of course, there is doubt that the OP would require a compilable version of Python capable of similarly restricted forms, and as far I know, none such version exists. ;-) -- http://mail.python.org/mailman/listinfo/python-list
Python Operating System???
Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an operating system for a long long time and the only possibilities I could find were C++ and assembly. I don't mind assembly so much if I don't have to use it very often. But C++ is so complicated and errors are pretty much impossible to find in the code for me. So, I was wondering if it would be possible to find a bootloader that loads a python file at startup or something... Is there an example somewhere of a Python OS? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
David Brown wrote: Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an operating system for a long long time and the only possibilities I could find were C++ and assembly. I don't mind assembly so much if I don't have to use it very often. But C++ is so complicated and errors are pretty much impossible to find in the code for me. So, I was wondering if it would be possible to find a bootloader that loads a python file at startup or something... Is there an example somewhere of a Python OS? Thanks! Hasn't there been numerous discussions about this in the past?? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
David Brown wrote: Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an operating system for a long long time and the only possibilities I could find were C++ and assembly. I don't mind assembly so much if I don't have to use it very often. But C++ is so complicated and errors are pretty much impossible to find in the code for me. So, I was wondering if it would be possible to find a bootloader that loads a python file at startup or something... Is there an example somewhere of a Python OS? Thanks! People don't make Python OSs because it's a serious pain in the Deng-Xiao-ping. J/k, I am half kidding. Go to google groups, and search for Python OS. You will find that this topic has been discussed numerous times. There was another project other than Unununium which was Python based, but it is not being developed any longer and I fail to remember what it was called. So search away, you will find many results! Alternatively you could contact the Unununium folks for help. Note also that there are Java OSs as well (and probably others). But then again, if you don't like C++, you probably won't like Java. They can be very different languages, but in my experience, the reasons why one does not like C++ is usually due to a quality/flaw that can also be found in Java. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai wrote: But then again, if you don't like C++, you probably won't like Java. They can be very different languages, but in my experience, the reasons why one does not like C++ is usually due to a quality/flaw that can also be found in Java. Oh, brother. The Zen of Python says that simple is better than complex and complex is better than complicated. Java does pretty well here. C++ didn't even get complicated is better than convoluted right. There's are a ton of flaws in C++ not found in Java. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
On Thu, 06 Jan 2005 16:12:54 -0800, Carl Banks wrote: Arich Chanachai wrote: But then again, if you don't like C++, you probably won't like Java. They can be very different languages, but in my experience, the reasons why one does not like C++ is usually due to a quality/flaw that can also be found in Java. Oh, brother. The Zen of Python says that simple is better than complex and complex is better than complicated. Java does pretty well here. C++ didn't even get complicated is better than convoluted right. There's are a ton of flaws in C++ not found in Java. Still, Java feels like C++ done right, while being more wrong :-[ -- Christopher If there was a scheme for Lisp world domination... -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
What exactly do you mean by an operating system? If you don't want to program in C/C++ then you're going to have a hard time. I don't want to be too discouraging, but with that attitude I doubt you would get very far. It sounds like you want to make more of an OS shell -- no? You can implement a shell on top of any OS and probably do it in a language like Python. But if it is going to be a complete OS in pure Python, uh, it won't be! You'll have to do a lot of stuff in C, at the least interface with the hardware. David Brown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an operating system for a long long time and the only possibilities I could find were C++ and assembly. I don't mind assembly so much if I don't have to use it very often. But C++ is so complicated and errors are pretty much impossible to find in the code for me. So, I was wondering if it would be possible to find a bootloader that loads a python file at startup or something... Is there an example somewhere of a Python OS? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Fuzzyman wrote: There is/was a project (Peter Hansen ?) to produce a pure python file system. that could be an interesting component. Good memory... uh, sort of. :-) It was probably me you're thinking of, but the point of the project was solely a virtual file system, to be used exclusively as a tool for supporting automated testing. It has no concept of persistence, no support for it in the design, and wouldn't be what would help anyone in this respect. Sorry. (Work on it has actually not progressed lately, because there is no additional requirement driving the work. The primitive initial state of the tool suffices so far.) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Carl Banks wrote: Arich Chanachai wrote: But then again, if you don't like C++, you probably won't like Java. They can be very different languages, but in my experience, the reasons why one does not like C++ is usually due to a quality/flaw that can also be found in Java. Oh, brother. The Zen of Python says that "simple is better than complex" and "complex is better than complicated". Java does pretty well here. C++ didn't even get "complicated is better than convoluted" right. There's are a ton of flaws in C++ not found in Java. I knew this would get blown out of proportion, but I posted nevertheless. I was saying that Java and C++ share flaws (some and perhaps all of which could be perceived as qualities by someone) and that these common flaws are often the reason why people do not like C++ or Java. This is speaking from experience, not statistical evidence. In no way was I saying that both languages were the same or aligned at particular levels of complexity/simplicity. Both have flaws and qualities the other does not. Whether or not C++ has "a ton of flaws" not found in Java or not, this was not my subject of discussion. I was not speaking in quantitative terms as I was referring purely to those flaws which are common to both and coming to a conclusion based on experience with people who do not like C++ or Java. - Arich P.S. All in good fun but I am not your brother. ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Roose wrote: What exactly do you mean by an operating system? If you don't want to program in C/C++ then you're going to have a hard time. I don't want to be too discouraging, but with that attitude I doubt you would get very far. Indeed, this is very true. It sounds like you want to make more of an OS shell -- no? You can implement a shell on top of any OS and probably do it in a language like Python. He should just build around a linux core or use OS kit (if he is serious/determined). But if it is going to be a complete OS in pure Python, uh, it won't be! You'll have to do a lot of stuff in C, at the least interface with the hardware. He could use something like O' caml or Oz no? I might be confused, but I understood them to be C/C++ comparable in terms of power and in that they both compile vs. VMs and interpreters (for O' caml this is optional I think). Or what about D? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Operating System???
Arich Chanachai [EMAIL PROTECTED] writes: He should just build around a linux core or use OS kit (if he is serious/determined). There's Ubuntu Linux, a Debian-based distro with commercial backing and a regular release schedule. One of the neat things about Ubuntu is that Python use is encouraged. Python scripting everywhere is a stated goal, and they have a number of bounties that concentrate on deepening the use of Python in the OS: http://www.ubuntulinux.org/community/bounties I've been using it on a couple of desktops, and I've been impressed by the overall quality of the distro. One thing I especially like is that the root account is disabled by default, administrative tasks are performed with sudo by users in the appropriate group (much like it is in Mac OS X 10.3). Nick -- # sigmask || 0.2 || 20030107 || public domain || feed this to a python print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?') -- http://mail.python.org/mailman/listinfo/python-list