Sunday, October 30, 2022

[SOLVED] Raspberry Pi operating system based on a high level language such as C# or Java?

Issue

I know that operating systems are usually developed in low level languages such as C, C++ or even Assembly. However, is there any way to program a Raspberry Pi operating system in a high level language such as C# or Java?


Solution

While I won't say that it's impossible, programming an OS from the ground up in nothing but C# isn't really feasible. All* the C# compilers (such as the ones for .NET and Mono) compile the C# into an intermediary code called Common Intermediary Language (CIL). This language is interpreted at runtime into bytecode that is then executed by the computer. You can't very well have a runtime interpreting that code if there's no OS to be interpreting it. (Java executes into a Java-esque pseudo-bytecode which is interpreted by the Java Runtime Environment, so the same thing applies.)

What you can do is install the Windows 10 IoT Core OS onto your Raspberry Pi. Once you do that, you will be able to program and run C# programs on your machine via UWP. Maybe not a perfect solution for your needs, but it's as close as you can get without writing a custom C# compiler/runtime from scratch.

*: There are one or two third party C# compilers that do compile into C-like bytecode, but AFAIK they are abandoned, highly experimental, support ony a small subset of the language, or any combination of the three. In addition, using these compilers would disallow you to use any of the .NET standard library, meaning you really will be coding from scratch.



Answered By - Abion47
Answer Checked By - Marie Seifert (WPSolving Admin)