4 ms·
An mp3 player and a calendar are not operating systems. If your contention is that C is terrible for actual OS development you'll need a better argument.
by nfg 16y ago
An mp3 player and a calendar are not operating systems. If your contention is that C is terrible for actual OS development you'll need a better argument.
- loup-vaillant 16y agoUNIX gives top-level (userland, not root) programs a "raw access to registers and the memory allocator". Incredibly low level things which aren't needed, and are a source of errors, some of which are security breaches. This is bad™. The question is "why did they do that" ? The most obvious answer is C: If you write your OS in C, you will most likely make C-like APIs, which don't properly hide low-level stuff, but are easier to implement (the "Worse is Better" principle).
- ars 16y agoWait, you want the OS to do memory allocation of individual variables and garbage collection? And if you are writing X86 code you don't have a choice about register access - and why is that a problem anyway? Do you want an OS that is actually a virtual machine? I don't. I want an OS that lets me use my CPU. > If you write your OS in C, you will most likely make C-like APIs, That's a fundamental misunderstanding. The API are written for the _hardware_. Did you forget there was an actual computer in there? It's nice and all to go high level, but at the end of the day you have a CPU and memory and you need to use it.
- loup-vaillant 16y ago> Wait, you want the OS to do memory allocation of individual variables and garbage collection? Almost, if not outright yes. Current OS'es already do manage memory in some ways, so they could as well do more work, so you don't have to re-invent that wheel every time you write a new compiler. Having a full blown virtual machine as an OS actually sound very promising : you can for instance migrate from X86 to ARM transparently, re-compiling nothing but the kernel. You can reduce hardware support for fancy features, simplifying it. Now, a good enough compromise could be a layer of compatibility for a garbage collected language. And we already have plenty of these. > The API are written for the _hardware_. You got that backwards. The API is written for humans to use the hardware. If the hardware is complex and quirky, it's the job of the API to make it simple and straightforward. It's nice and all to go low level, but at the end of the day you have to get things done. You sound like you need every last drop of performance out of your CPU. When you really do, then you may want to do your work in kernel space with no runtime check at all. But most of the time, you don't. To sum up, an OS written in C will most likely have a C-like API (I note that you didn't disagree with that). There's still the high-level vs low-level debate, but it basically has the same structure as the GPL vs BSD debate. I prefer high-level and GPL, on the grounds that they eventually enable more. You seem to prefer low level (and BSD?), on the grounds that they permit more (which is not the same at all). We could go on, but if we actually disagree on that point, I don't know how we could convince each other.
- ars 16y agoIn practice high level is more complex and quirky then low. Low level has just a few well defined interfaces. High level has tons, and high level is not flexible either. An OS will have a C like API not because of C, but because that's how computers work. C was written to copy the computer. And what I said has nothing to do with GPL vs BSD, I don't think your analogy applies. And I don't agree with what you assume I meant about high/low permit/enable. I simply said that an OS is made to handle an actual real computer, and it's written that way. It has nothing to do with C, it has to do with hardware. Personally I prefer a mix - define the low level and allow using it. On top of that make tons of high level helper functions, but always make sure that even if you use the high level functions you are still allowed to use the low level if you want.
- loup-vaillant 16y ago> I simply said that an OS is made to handle an actual real computer, and it's written that way. It has nothing to do with C, it has to do with hardware. This is one of the most widespread and major misunderstanding about computers. Computer science is not about computers; Just like astronomy is not about telescopes (Dijkstra). The only thing that really matter about computers is that they are communicating Turing-complete machines. Every communicating Turing-complete hardware on the planet is therefore the same, modulo the necessary emulation layer (performance is becoming secondary, so let's pretend it's not a problem). What we want as humans is communicating Turing-complete machines that are easy to use. That's a fact about us, not about hardware. Therefore, OS APIs should depend on us, not on hardware. Having an OS whose API is influenced by the actual hardware is a pity. Making an OS whose API is influenced by the actual hardware is a shame.
- jedbrown 16y agoFor most people, "operating system" is not synonymous with "kernel". I like C, but a lot of userland programs that are often considered to offer "operating system" functionality could tolerate being written in a safer language. OTOH, C is probably "good enough" as the lingua franca.