I get that C and its super sets allow you to have low level access, but could you use a different 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
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.
我很确定你可以,但正如你所说的那样使用C,因为它允许你进行低级访问,但是,Visual Basic,Java和C#,它们是在框架下工作的地方
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
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.
似乎从所有答案中可以肯定,但它不会像创建用C语言编写的那样简单或容易。最有可能需要硬件支持或至少需要一些c或c ++“胶水代码”
Cosmos - C# Open Source Managed Operating System
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.