5 ms·
When people ask "how would you write an operating system without C?", Oberon is what I point them to. It's a very different style than Unix, in that the Oberon
by Athas 7y ago
When people ask "how would you write an operating system without C?", Oberon is what I point them to. It's a very different style than Unix, in that the Oberon language is a relatively integrated part of the operating system, rather than communication being through a machine-level ABI. There were some spiritual predecessors where the compiler itself was part of the OS, and there was no other way to communicate with it than through the language semantics. I'm not completely sure whether Oberon works like that, but some Concurrent Pascal systems did. It's a very different view of what an "operating system" means.
Anyway, Oberon is a memory-safe and garbage-collected language without the pointer trickery that makes C so dangerous. So how does Oberon implement the necessary low-level parts? Fortunately, some version of the source is easily browsable online: https://people.inf.ethz.ch/wirth/ProjectOberon/index.html https://people.inf.ethz.ch/wirth/ProjectOberon/index.html
Here is for example Kernel.Mod: https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Kernel.Mod.txt https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Kerne...
Low-level operations are done with magical functions that simply perform an operation on a memory address identified with an integer, e.g. `SYSTEM.PUT(q0+8, q1)`. These are then presumably handled directly by the compiler (the System.Mod file does not define any PUT function). This is syntactically more awkward than the equivalent in C (`q0[2] = q1`, assuming this is an `int` pointer), but perhaps things that are unchecked and potentially dangerous should be syntactically awkward. It's not like a lot of code will be written using these facilities.
- enriquto 7y ago> Low-level operations are done with magical functions that simple perform an operation on a memory address identified with an integer, just exactly like in C! What's the difference besides the particular syntax?
- coldtea 7y ago>just exactly like in C! What's the difference besides the particular syntax? On that part none. But Oberon is "memory-safe and garbage-collected", so you don't use that aspect for 99% of the program (whereas in C everything is like that).
- Athas 7y agoNone, but in C you use the same language mechanism for following an object reference (safe in the absence of manual memory management), indexing an array, and doing crazy address arithmetic. In Oberon, safe and unsafe operations are clearly distinguished.
- augustk 7y ago> In Oberon, safe and unsafe operations are clearly distinguished. Indeed! To use the unsafe (predefined) procedures you must import the pseudo-module SYSTEM.
- LessDmesg 7y agoOberon is not a serious OS, though. More like a teaching project. Oberon is to Linux what Scheme is to C++: clean, nice and good for pedagogic purposes, but not a serious product.
- pjmlp 7y agoOn top of that, the latest generations System 3 with its Gadgets and Active Oberon were quite good, and yes they even supported audio and video players, which made as much use of inline Assembly (Active Oberon extension) as any Windows 3.0/MS-DOS alternative back then. Enjoy a screenshot tour, https://www.progtools.org/article.php?name=oberon§ion=compilers&type=tutorial https://www.progtools.org/article.php?name=oberon§ion=co...
- fouc 7y ago>in that the Oberon language is a relatively integrated part of the operating system >There were some spiritual predecessors where the compiler itself was part of the OS Sounds very much like forth or lisp to me, (and perhaps even erlang etc). Any language that's implemented like a virtual machine internally is suited to being an "integrated" operating system. I think there's a tremendous amount of advantages to doing this as well, it reduces the levels of abstractions between the hardware and the user applications. Reduced level of abstractions means a snappier experience for the users, and also makes it easier for the developer to integrate things vertically. http://tunes.org http://tunes.org touches on this type of thing as well
- Athas 7y agoLisp machines, definitely. With respect to Forth, I'm not sure. Has there ever been a Forth operating system that provides the facilities we would expect of a modern operating system (and using Forth as the interface)? There are lots of Forth applications on bare hardware, and I see no reason why it should not be possible (except that you'd need some kind of extension for concurrency), I just don't know whether it has been done. I wonder if there is a lesson in the fact that all of the tightly language-integrated operating systems are dead. While Unix is clearly tied to C at an API level, the actual ABI is entirely based on machine code, and can be accessed through any language that can produce a binary. The downside may be that tight integration hinders language innovation, in that new languages have to target the "native language", which is awkward if it is high-level. Genera (the Symbolics Lisp OS) did host some C and FORTRAN compilers ("Zeta-C", you can get it online[0]), but I am not sure how fast it ran. Unix is often disparaged for providing "mechanism" instead of "policy", but maybe that has serious evolutionary advantages. [0]: http://www.bitsavers.org/bits/TI/Explorer/zeta-c/ http://www.bitsavers.org/bits/TI/Explorer/zeta-c/
- lispm 7y ago> Genera (the Symbolics Lisp OS) did host some C Symbolics had their own C compiler, which was unrelated to zeta-c. One could use it to for example compile the C-based X11 server.
- 7y ago
- rodgerd 7y ago> When people ask "how would you write an operating system without C?", Oberon is what I point them to. Well, you could also point them to VMS, which was deliberately designed to avoid language lock-in.
- tyingq 7y ago"SYSTEM.PUT(q0+8, q1)" I immediately thought of "POKE" on the built in BASIC interpreters for 80s home computers.
- dwheeler 7y agoIntel/Siemens had a joint venture developing the BiiN hardware. The operating system, applications, development tools, and so on were written exclusively in Ada. However, a lot of that software fully worked on that particular chip, so when it floundered commercially that was the end of it.