Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Is it feasible to use Lisp to write an OS?
This autumn I'll be taking a course in my university that, among other
things, involves writing a simple OS from scratch.

The usual plan seems to be to write it in C, but I haven't been able to
find any restrictions other than "it must work". Obviously, you need a
lot more groundwork to run Lisp code than you do to run C code, but is it
feasible to write a simple Lisp (interpreter?) in C and use that?

I won't have time to reimplement all of Common Lisp, but some useful
subset should be possible.

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? (How fast *is* CLISP anyway? Would a
tenth of that do?) I'm not sure about the GC, but that's a detail.


Having a decent REPL would help with debugging, but is it at all possible
to complete something like this in one semester, or am I smoking crack?
I won't have much of anything else to do, so let's say ~3 months to be on
the safe side.

Report this thread to moderator Post Follow-up to this message
Old Post
Svein Ove Aas
06-08-04 08:58 PM


Re: Is it feasible to use Lisp to write an OS?
Am Tue, 08 Jun 2004 22:10:12 +0200 schrieb Svein Ove Aas:

Have you looked at Movitz? From http://www.common-lisp.net/project/movitz/ :
>
The Movitz system aspires to be an implementation of ANSI Common Lisp that
targets the ubiquitous x86 PC architecture "on the metal". That is,
running without any operating system or other form of software
environment. Movitz is a development platform for operating system
kernels, embedded, and single-purpose applications. There can potentially
be several completely different operating systems built using Movitz.
<

Simon

Report this thread to moderator Post Follow-up to this message
Old Post
Simon Adameit
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Simon Adameit wrote:

> Am Tue, 08 Jun 2004 22:10:12 +0200 schrieb Svein Ove Aas:
>
> Have you looked at Movitz? From
> http://www.common-lisp.net/project/movitz/ :
>
Yes, I've looked; in fact, one of my teachers is the guy *writing* it.

it doesn't fit the bit at all, though. For one thing, I'm supposed to
start from scratch; Movitz already includes everything that I'd write and
then some.

For another, it's taken him four years so far. I don't have that much
time, which is why I suggested I'd be doing something a lot simpler. I
don't need all of Common Lisp when the primary goal is to write something
friendlier than C.

Hopefully what I'd write would be a proper subset so I could complete it
at need, but that's not really an issue either.


Report this thread to moderator Post Follow-up to this message
Old Post
Svein Ove Aas
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Svein Ove Aas wrote:

> This autumn I'll be taking a course in my university that, among other
> things, involves writing a simple OS from scratch.
>
> The usual plan seems to be to write it in C, but I haven't been able to
> find any restrictions other than "it must work". Obviously, you need a
> lot more groundwork to run Lisp code than you do to run C code, but is it
> feasible to write a simple Lisp (interpreter?) in C and use that?
>
> I won't have time to reimplement all of Common Lisp, but some useful
> subset should be possible.

I have heard that lots of Scheme implementations get written as course
tasks, so you might get some more useful information at
comp.lang.scheme. If you don't want to implement the whole of Common
Lisp but don't want to switch to Scheme either, ISLISP provides a pretty
useful subset of CL. Restrict it further by removing classes and generic
functions, and you have a pretty core Lisp IIRC.

Another option would be to write an interpreter for some bytecode
format. For example, I think that CLISP has a well-documented bytecode.
This gives you more options in the long run to actually improve
performance by compiling the bytecode. Other CL implementations use
bytecodes as well.

Just brainstorming...


Pascal

--
1st European Lisp and Scheme Workshop
June 13 - Oslo, Norway - co-located with ECOOP 2004
http://www.cs.uni-bonn.de/~costanza/lisp-ecoop/

Report this thread to moderator Post Follow-up to this message
Old Post
Pascal Costanza
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Pascal Costanza wrote:

> I have heard that lots of Scheme implementations get written as course
> tasks, so you might get some more useful information at
> comp.lang.scheme. If you don't want to implement the whole of Common
> Lisp but don't want to switch to Scheme either, ISLISP provides a pretty
> useful subset of CL. Restrict it further by removing classes and generic
> functions, and you have a pretty core Lisp IIRC.
>
I'll take a look; thanks.

I'm *not* switching to Scheme; I /like/ multi-paradigm languages, which
Scheme is not. Well, not to the same degree.

> Another option would be to write an interpreter for some bytecode
> format. For example, I think that CLISP has a well-documented bytecode.
> This gives you more options in the long run to actually improve
> performance by compiling the bytecode. Other CL implementations use
> bytecodes as well.
>
Yes, I thought about that.
I could definitely do it; however, I'd like the system to be self-hosting
from the Lisp source and up, which means I'd also need to copy CLISP
itself... I'm pretty sure I'm not allowed to copy code like that, but
when it comes to compilers... would the CLISP compiler run with just the
VM - is it self-hosting, I mean?
If so, I'd just need the VM and a REPL. That would be nice.

I'm allowed to use any compiler I feel like on the development machine, so
copying the *compiler* shouldn't be much of a stretch.


I'll go read their documentation now, I think.


Report this thread to moderator Post Follow-up to this message
Old Post
Svein Ove Aas
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Simon Adameit wrote:
 

Svein Ove Aas <svein+usenet01@brage.info> writes:

> it doesn't fit the bit at all, though. For one thing, I'm supposed
> to start from scratch; Movitz already includes everything that I'd
> write and then some.

This isn't entirely accurate. One aspect of Movitz is to be an
absolutely minimal run-time environment for Common Lisp, in much the
same way that e.g. GCC provides a minimal run-time environment for
C. (Of course, C being what it is, the C version is going to be a lot
smaller.) So in this sense, GCC also includes everything you'd write
in an OS course the form of Linux or NetBSD or what have you.

Also, it is actually not true that Movitz includes everything you'd
do in an OS course. In Movitz there are no processes, no address-space
protection, paging, no nothing, really. Again, much like GCC out of
the box.

I seem to remember that one of the early exercies in the OS course is
to implement printf. You could easily implement your own format in
Movitz, if you wanted.

> For another, it's taken him four years so far. I don't have that
> much time, which is why I suggested I'd be doing something a lot
> simpler. I don't need all of Common Lisp when the primary goal is to
> write something friendlier than C.
>
> Hopefully what I'd write would be a proper subset so I could
> complete it at need, but that's not really an issue either.

You should compare my work to that of implementing GCC, libc,
etc. Don't confuse the compiler and run-time with the OS as such.

Then again, you should remember that the OS course is most likely an
course in how C-based OS'es work. There are many similarities with
some Lispish OS, but also differences.

--
Frode Vatvedt Fjeld

Report this thread to moderator Post Follow-up to this message
Old Post
Frode Vatvedt Fjeld
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Svein Ove Aas <svein+usenet01@brage.info> writes:

> This autumn I'll be taking a course in my university that, among other
> things, involves writing a simple OS from scratch.
>
> The usual plan seems to be to write it in C, but I haven't been able to
> find any restrictions other than "it must work". Obviously, you need a
> lot more groundwork to run Lisp code than you do to run C code, but is it
> feasible to write a simple Lisp (interpreter?) in C and use that?

Possibly.

> Ideally, the drivers - network, console, etc. - should be written in Lisp
> as well. Would this be fast enough? (How fast *is* CLISP anyway? Would a
> tenth of that do?)

It should be possible.  These days, peripherals are glacially slow
compared to the processor.

> I'm not sure about the GC, but that's a detail.

You may wish to reconsider this statement.

> Having a decent REPL would help with debugging, but is it at all possible
> to complete something like this in one semester, or am I smoking crack?
> I won't have much of anything else to do, so let's say ~3 months to be on
> the safe side.

You will need to be smoking crack by the end of the semester.  I
suggest amphetamines as well.  It's a lot of work.  You will really
need to discuss this with your professor.  Your end result will be
*nothing* like the half-assed unix clones that everyone else will be
writing, so this may or may not be satisfactory for the course.  If
your prof agrees with the plan, though, I expect that you'd easily
learn as much.

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Marshall
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Joe Marshall wrote:

> Svein Ove Aas <svein+usenet01@brage.info> writes: 
>
> It should be possible.  These days, peripherals are glacially slow
> compared to the processor.
> 
>
> You may wish to reconsider this statement.
>
By "detail", I meant "implementation detail". Not "simple", more like
"unknowable at the moment".
 
>
> You will need to be smoking crack by the end of the semester.  I
> suggest amphetamines as well.  It's a lot of work.  You will really
> need to discuss this with your professor.  Your end result will be
> *nothing* like the half-assed unix clones that everyone else will be
> writing, so this may or may not be satisfactory for the course.  If
> your prof agrees with the plan, though, I expect that you'd easily
> learn as much.
>
We'll see.

If a VM for CLISP is allowable, along with CLISP, then that takes care of
most of it and I'll get a high-level language almost for free. (Well, in
comparison...)

I might end up doing something totally different; I just don't want to
write another half-assed unix clone, as you so perceptively noted.

Report this thread to moderator Post Follow-up to this message
Old Post
Svein Ove Aas
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
Svein Ove Aas schrieb:

> I'm *not* switching to Scheme; I /like/ multi-paradigm languages, which
> Scheme is not. Well, not to the same degree.

In what way isn't scheme a multi-paradigm language?
Scheme is lisp, isn't it?


André
--

Report this thread to moderator Post Follow-up to this message
Old Post
André Thieme
06-09-04 01:57 AM


Re: Is it feasible to use Lisp to write an OS?
On Wed, 09 Jun 2004 01:25:14 +0200, André Thieme wrote:

> Svein Ove Aas schrieb:
> 
>
> In what way isn't scheme a multi-paradigm language?
> Scheme is lisp, isn't it?
>
>
> André

Scheme is in the Lisp *family*.  I think Scheme is multi-paradigm, but it
is true that it has a stronger bias towards functional style than Common
Lisp does.

Cheers,
Bill.
--
Dr. William Bland.
It would not be too unfair to any language to refer to Java as a
stripped down Lisp or Smalltalk with a C syntax.   (Ken Anderson).


Report this thread to moderator Post Follow-up to this message
Old Post
William Bland
06-09-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Pages (8): [1] 2 3 4 5 6 » ... Last »
Search this forum -> 
Post New Thread

Lisp archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 01:14 PM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.