New languages for OS level programming?

I've been reading a lot about various new languages like Ruby, Haskell, Python, etc. But none of them seem suitable for programming say, an Operating System, or performing really low level work on an embedded device. First, these languages (understandably) sacrifice efficiency for ease of use (but I don't think these are always mutually exclusive). Second, a lot of times these languages simply don't provide any mechanism for getting at the hardware.

Has there been any research into new languages that would be as suitable for an OS as C?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Haskell, House, and BitC

I've been reading a lot about various new languages like Ruby, Haskell, Python, etc. But none of them seem suitable for programming say, an Operating System...

The House project would suggest otherwise, at least as far as Haskell goes.

Beyond that, you might want to look at the BitC language, which
...is a systems programming language that combines the ``low level'' nature of C with the semantic rigor of Scheme or ML. BitC was designed by careful selection and exclusion of language features in order to support proving properties (up to and including total correctness) of critical systems programs.

See "A Principled Approach to Operating System Construction"

The recent paper on House is A Principled Approach to Operating System Construction. It describes a Hardware monad that gives nice properties:

For example, we can assert that executing a program in userspace has no impact on kernel data structures. Such properties can be viewed as part of the specification of the interface.

I've been playing with the pure Haskell TCP/IP stack lately. The House cvs repo includes code to attach to the tun/tap device in Linux, meaning the stack gets its own interface, ip address, etc.

Scheme and Java

Neither is exactly new, but both have been used for operating systems. Scheme in particular is high-level but can be compiled to C and thence to bare iron.

NesC, for some embedded device

I think I never saw this mentioned on LtU, it is a kind of C dialect enhanced with concurrency constructs and a component architecture, and it is used to build software for wireless sensors networks which tipically have a lot of hardware constraints.

Anyway, there is at least one operating system being built with python on a small C/asm core.

safe low-level languages

Lots of work has also been done in low-level languages with better safety properties than C, such as Cyclone and Vault. There's also tons of work on improving reliability of legacy C code, such as CCured and DieHard, to name just a couple.

Safe languages in Minix 3

The Minix 3 developers are thinking of using type-safe languages to battle common issues as buffer overflow attacks. Since Minix 3 has quite an extreme microkernel design with device drivers running as separate programs in user space this will be relatively easy to try for just some components.

They experimented a bit with Cyclone but are also looking around for other candidates. The microkernel is in C and communicates with other services via message passing (so one problem would be to make this mechanism work with other languages).

link

That's pretty interesting. I'm waiting for my Minix 3 book to be delivered in a few weeks. I wasn't able to find a discussion regarding safe languages, do you have a link? Thanks.

I pretty much copied the info

I pretty much copied the information from a post by Jorrit (J.N.) Herder on comp.os.minix this week. It was in response to a short discussion on fighting buffer overflows and the like.

You might be able to find this newsgroup via Google Groups.

[on edit] Thread on Google Groups. Have fun with your book, I've always enjoyed reading AST's books.

Ada. It's not 100% safe, but

Ada. It's not 100% safe, but it does provide a good number of ways to get at the hw and precisely describe the structure of low level stuff, abstract away from it and manage it. This is what it was designed for really.

I wanted to write an OS with it, but never got round to it. I might return to that once I get l4 working with bochs, but don't hold your breath.