I get that C and its super sets allow you to have low level access, but could you use a differen开发者_如何学运维t language. For example Visual Basic, C# or even Java? I was just curious because it seems like something better should have come along since C's inception.
You can write an operating system in any language you choose - provided you have the bootstrapping required to compile it onto that platform.
For example, JNode is a Java based OS (with a small amount of assembler).
You could use any of those to write the operating system. However, you would need a bootstrap (probably written in C) to load and run the runtime for your language.
Google Scholar shows some good starting points for research: http://scholar.google.com/scholar?q=java+operating+system&hl=en&btnG=Search&as_sdt=1,5&as_sdtp=on
http://de.wikipedia.org/wiki/JavaOS
You can use pretty much any programming language. You'll probably need some assembly and/or C glue code to use any managed programming languages though.
You can get alot of information at OSDev wiki and forum.
There's one project where they even created C# compiler that compiles directly to machine code so there's probably not much if any C or other code in the kernel. Some assembly is pretty much a requirement for any kernel.
I'm pretty sure you can, but as you say C is used since it allows you to have low level access, however, Visual Basic, Java and C# they're where maded to work under a Framework
There may be tools out there to take bytecode (or IL in the case of C#) and compile it down to machine level code that the current processor architecture can understand. I don't know of any myself, though.
ASSEMBLER ist the answer! C alone cannot produce a nice bootsector, because you don't have the right output formats available. But most OSs consider C a nice language for most of its parts.
There are a few C# operating systems out there
http://en.wikipedia.org/wiki/Singularity_(operating_system)
http://www.brokenwire.net/bw/Programming/62/c-operating-system
http://www.gocosmos.org/index.en.aspx
There are several languages you can use "out of the box" to write an OS such as C++, D, assembly.
If you want to use a language like C#, Java, or VB you will need to have a runtime environment (including JIT compiler in some of those cases). That means, you will have to WRITE those runtimes and you won't be able to do that in a language like Java. You would have to write your runtime code in a language like C/C++/Assembly then, your runtime could load your Java/VB code.
An alternative is to write a new compiler for C#/Java/VB that will compile to machine code or assembly. This will work but, you'd have a lot of trouble using languages like VB or Java at the OS/Executive level since they don't allow you to do memory access like C/C++ would. Neither lets you run CPU instructions directly.
It seems like from all the answers that yes you can, but It wont be as simple or easy as creating one written in C. Most likely it would require either hardware support or at a minimum some c or c++ "glue code"
Cosmos - C# Open Source Managed Operating System
http://www.codeproject.com/KB/system/CosmosIntro.aspx
精彩评论