Subject: Re: Is it feasible to use Lisp to write an OS?
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 08 Jun 2004 22:31:24 -0500
Newsgroups: comp.lang.lisp
Message-ID: <5PWdnTOAZswRGVvdRVn-sA@speakeasy.net>
Svein Ove Aas  <svein+usenet01@brage.info> wrote:
+---------------
| ...writing a simple OS from scratch.
...
| It doesn't need to be self-hosting, but it isn't prohibited either, so I
| was thinking - maybe a C bootstrapper that takes care of the lowest-level
| details including a Lisp VM, and a self-hosting compiler on top of that.
| 
| Ideally, the drivers - network, console, etc. - should be written in Lisp
| as well. Would this be fast enough?
+---------------

Well, it was certainly fast enough for the Lisp Machines!!  ;-}  ;-}

But seriously, coding up drivers (except perhaps a few simple ones,
as proofs-of-concept), not to mention filesystems, is a *LOT* of work.
It would probably be better to spend your time on the "middle" layers
of the operating system: process scheduler, memory management, etc.

For the low-level driver stuff, may I suggest using the Utah OSkit
(part of the Flux Project)?

  <http://www.cs.utah.edu/flux/oskit/>
  The OSKit is a framework and a set of 34 component libraries
  oriented to operating systems, together with extensive documentation.
  By providing in a modular way not only most of the infrastructure
  "grunge" needed by an OS, but also many higher-level components,
  the OSKit's goal is to lower the barrier to entry to OS R&D and
  to lower its costs. The OSKit makes it vastly easier to create a
  new OS, port an existing OS to the x86 (or in the future, to other
  architectures supported by the OSkit), or enhance an OS to support
  a wider range of devices, file system formats, executable formats,
  or network services. The OSKit also works well for constructing
  OS-related programs, such as boot loaders or OS-level servers atop
  a microkernel.

  For language researchers and enthusiasts, the OSKit lets them
  concentrate on the real issues raised by using advanced languages
  inside operating systems, such as Java, Lisp, Scheme, or ML---
  instead of spending six months or years groveling inside ugly code
  and hardware. ...

The PLT guys used this to make MzScheme[1] run on "bare iron":

  <http://download.plt-scheme.org/mzscheme/mz-103p1-bin-i386-kernel-tgz.html>

[Note: I'm not suggesting using Scheme, only that they successfully
used the Flux OSkit to host MzScheme as an "operating system", so you
could presumably do something similar...]


-Rob

[1] Though only for version up through versions 103p1. AFAICT,
    versions 200+ no longer support the "bare iron" configuration.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607