
Mezzano – An operating system written in Common Lisp - pjmlp
https://github.com/froggey/Mezzano/
======
heisig
There are still people explaining to me why you need a 'system programming
language' like C or Rust for certain tasks. Meanwhile, I'm playing a game of
Quake on Mezzano, where everything from drivers to the actual videogame is
written in pure Common Lisp.

In case you wonder how froggey managed to obtain a Common Lisp version of
Quake, have a look at
[https://github.com/froggey/Iota](https://github.com/froggey/Iota).

~~~
314
As a datapoint Quake is quite old. When it was released it used software
rendering on a Pentium2. While is nice that everything from the ground up is
written in lisp it sounds as if you are only achieving the performance of a P2
on modern hardware. What is the performance gap between Mezzano and an
OS/application written in C/C++?

~~~
NovaEcosophy
I think you forget just how old Quake is. I remember playing it on a 486DX
66Mhz, a P2 would have been total over kill for that game.

~~~
skocznymroczny
P2 sounds about right for Quake2

~~~
6thaccount2
Are you thinking Quake III Rocket Arena?

~~~
LambdaComplex
*Quake III Arena

Rocket Arena is/was a mod

------
zaarn
LISP has been a system programming language. Still is.

People just don't think about it much but forget that for a time, LISP was
_the shit_ in computer science, we invented half of the modern desktop on LISP
machines!

~~~
pmiller2
I was under the impression that Smalltalk contributed more to what we think of
as “the modern desktop” than LISP. If anyone has the real story, I’d love to
hear it.

~~~
behnamoh
And still I haven't seen any language more Object-Oriented than SmallTalk.
Sure, Python, C++, Java, etc. support OO to some level. But in SmallTalk
_everything_ literally is an object, which means you can achieve the same
functionality of Lisp macros in SmallTalk as well. In Lisp you have data =
code, in SmallTalk you have data = program (which is running). In fact,
everything is always running in SmallTalk. I'm more than eager to learn more
and more about SmallTalk. It's one of those languages with valuable philosophy
behind its design (just like Lisp and Haskell).

~~~
scroot
If you haven't yet, I'd recommend reading the "Blue Book" (Smalltalk-80: The
Language and its Implementation) by Goldberg. It has a very holistic approach
and, as such, is one of the most accessible and pleasant books describing a
computing/programing environment one can find.

~~~
thequux
I also recommend reading
[http://www.mirandabanda.org/bluebook/bluebook_imp_toc.html](http://www.mirandabanda.org/bluebook/bluebook_imp_toc.html)
once you're done with the blue book; the VM is a two weekend project in any
compiled high-level language (I used Rust) and it's not hard to make it
performant enough for real use. I think my timeline was ~2 days for the
initial implementation, 2 days for fixing up small bugs (mostly in
primitives), and then 2-3 hours of minor tweaks to get the VM performant
enough to be comfortable.

BTW, somebody typed the VM source in from the blue book and posted it online.
You may find the resources on that page useful:
[http://www.wolczko.com/st80/](http://www.wolczko.com/st80/)

~~~
scroot
This is dope -- didn't know about it, thanks

------
pjmlp
What opened my eyes beyond UNIX was having a great library at the university
where I could dive into alternative realities.

Luckily many of the same books and papers, now live on as facsimle copies on
bitsavers, archive and many other Internet and Faculty repositories.

Burroughs, Xerox PARC, ETHZ, TI, Genera, VMS, Lisa, Constellation, SOLO, SPIN
and plenty others are available for systems programming archeology.

~~~
thrownthrow
I was going to suggest to anyone interested in VMS to head over to the
deathrow cluster but unfortunately it's now dead.
[https://deathrow.vistech.net/410.html](https://deathrow.vistech.net/410.html)

~~~
pjmlp
BLISS links from Wikipedia are still working

[https://en.wikipedia.org/wiki/BLISS](https://en.wikipedia.org/wiki/BLISS)

And there is
[https://www.vmssoftware.com/documents_list.html](https://www.vmssoftware.com/documents_list.html)

~~~
vram22
>BLISS links from Wikipedia are still working

>[https://en.wikipedia.org/wiki/BLISS](https://en.wikipedia.org/wiki/BLISS)

Interesting. I remember Jon Bentley [1] mentions BLISS multiple times in his
book Writing Efficient Programs.

The book is a gold mine of software performance tuning techniques (with
recommendations on when to use them or not), organized in the form of many
numbered and well-named "rules" (so that you can remember when to apply them)
about saving time or space, or trading space for time or vice versa, all with
plenty of examples and "war stories". The book also talks about working at
many levels of the stack (although most of the focus is at the level of
program code), all the way from hardware up to algorithms.

[1]
[https://en.wikipedia.org/wiki/Jon_Bentley_(computer_scientis...](https://en.wikipedia.org/wiki/Jon_Bentley_\(computer_scientist\))

I took a brief look at the BLISS language, and I have to say that it does seem
a bit verbose, though in general, in the larger scheme of things, that may not
matter, given other qualities of a language, or may even be an advantage over
more cryptic or concise languages.

------
mark_l_watson
Every time I see a new release of Mezzano mentioned on HN, I smile! I only
play with Messanno using VirtualBox but one day I would like to get it running
bare metal on one of my old laptops. There are a few show stoppers for using
Mezzano as a main driver for getting work done, like the lack of SSH, but in
general it is fairly complete. Cudos!

~~~
onemoresoop
Is it an easy task to install Mezzano on Virtualbox? How long does it take to
get the system up and running?

~~~
sterkekoffie
It's as easy as downloading the disk image, which you can find under the
releases.

------
Semaphor
Previous discussions:

[https://news.ycombinator.com/item?id=8943709](https://news.ycombinator.com/item?id=8943709)
Jan 2015

[https://news.ycombinator.com/item?id=8955140](https://news.ycombinator.com/item?id=8955140)
Jan 2015

[https://news.ycombinator.com/item?id=12358177](https://news.ycombinator.com/item?id=12358177)
Aug 2016

~~~
dang
[https://news.ycombinator.com/item?id=14072121](https://news.ycombinator.com/item?id=14072121)
Apr 2017

------
LargoLasskhyfv
So this McCLIM widget set looks like something from the 90ies, typical Tcl/Tk
like here [http://tktable.sourceforge.net/tile/screenshots/demo-alt-
uni...](http://tktable.sourceforge.net/tile/screenshots/demo-alt-unix.png)

when compared to this

[https://common-
lisp.net/project/mcclim/static/media/screensh...](https://common-
lisp.net/project/mcclim/static/media/screenshots/2eL0LhQ.png)

I'm perfectly fine with that and can live with it. But why oh why the terrible
window decorations with beveling, gradients, rounding and shiny bubble buttons
which _do not fit to that_?

Why nothing like

[https://sawfish.fandom.com/wiki/Basix](https://sawfish.fandom.com/wiki/Basix)

[https://sawfish.fandom.com/wiki/Basix2](https://sawfish.fandom.com/wiki/Basix2)

[https://sawfish.fandom.com/wiki/Operational](https://sawfish.fandom.com/wiki/Operational)

[https://sawfish.fandom.com/wiki/Roman](https://sawfish.fandom.com/wiki/Roman)

[https://sawfish.fandom.com/wiki/Tufte](https://sawfish.fandom.com/wiki/Tufte)

[https://sawfish.fandom.com/wiki/SawLook](https://sawfish.fandom.com/wiki/SawLook)

[https://sawfish.fandom.com/wiki/Fvwm2Gtk](https://sawfish.fandom.com/wiki/Fvwm2Gtk)

Those may not look anything fancy, but won't hurt the eyes either.

Apart from that: RESPECT!

------
xelxebar
I'm quite fond of the Everything in Language X projects. In this case, how
does Mezzano boot a CL runtime? I'd expect this to be a combination of
assembly and C, but if they have CL all the way down somehow that'd be really
friggin' cool.

~~~
simiones
As far as I could tell looking around the project a bit, they configure the
boot sector of a USB/CD/DVD/ISO to jump directly into a pre-built lisp image,
no assembly/C code required. At the very least least, the paging system, IO,
GC definitely seem to be written in pure Lisp.

They do compile the initial Mezzano image using SBCL, which is partly written
in C, but it seems that they don't depend on any SBCL/C code on the machine
that they control.

I'm definitely not an expert though, I may be completely wrong about this :)

------
kreetx
Can you ssh out of it? Does it run emacs? Need to know if all the essentials
are there :)

~~~
phoe-krk
Emacs isn't a CL program, but mezzano has an emacslike editor.

I don't think SSH ever had an implementation in pure Lisp. Telnet for sure is
there, but I don't think SSH is. You theoretically could try compiling openSSH
into LLVM-IR and then into Lisp, the same way Quake was compiled, though...

~~~
lispm
Nitpick: Emacs is a category of editors. There are also several written in
different Lisp dialects, incl. CL.

GNU Emacs otoh is a specific editor.

~~~
c256
That’s very nit-y. I’ve used several different emacs-like editors, including
Hemlock, Edwin, Alpha, and Epsilon, and while I’m happy that they exist, the
current state of the world is pretty much divided between GNU Emacs plus close
variants, and editors that copy parts of the emacs UI but not its core
extensibility.

In most cases, the key (I claim) isn’t “is it GNU or not?” but rather “can it
run a large fraction of the Hugh mass of elisp?” - and unfortunately the
answer is either “no” or “hopefully in the future”.

If that’s changed, please do let me know. Is there a better Common Lisp emacs
these days than Hemlock? Is anyone making progress on a cl-capable guile emacs
anymore? Thanks in advance.

~~~
lispm
I use Clozure CL and LispWorks, which have CL based Hemlock variants.

> “can it run a large fraction of the Hugh mass of elisp?”

Most of that runs only in GNU Emacs and less so in forks (Xemacs) of it.

Remember, Mezzano's goal is not to be a GNU or Linux compatible thing. There
are already lots of that.

When one writes a Lisp system like Mezzano, it's probably better not to use
GNU Emacs anyway, since the compatibility to GNU Emacs isn't important and the
Emacs UI isn't that great anyway, and there is no GNU system underneath.

If it runs McCLIM, one could also port an McCLIM-based editor (also a variant
of Emacs) to it and use that.

Sure it will not run the zillion lines of Emacs Lisp, but I guess that was not
the main interest for this 'exotic' Lisp OS project.

~~~
eschaton
Honestly, based on my minimal experience fooling with Zmacs on my Lisp
Machines, a non-GNU emacs with Common Lisp underneath is likely to be much
better, especially if it can use a general purpose command system like CLIM’s.

~~~
lispm
Also if one looks at MCL's Fred (-> Fred resembles Emacs deliberately), that
was nicely programmable and also possible to use as dialog items in GUIs. For
CL applications I vastly prefer such a flexible model (object-oriented
architecture, editor windows with an optimized Emacs-like command set, reuse
as components in GUIs, ...), instead of a large monolithic editor, which then
needs to be used as an external program...

------
mmargerum
This guy has lisp OS running on a z80. Pretty neat
[https://makerlisp.com/](https://makerlisp.com/)

------
onemoresoop
Symbolics Lisp Machine demo
[https://m.youtube.com/watch?v=o4-YnLpLgtk](https://m.youtube.com/watch?v=o4-YnLpLgtk)

And also stumbled on this which i find fascinating:
[https://m.youtube.com/watch?v=gV5obrYaogU](https://m.youtube.com/watch?v=gV5obrYaogU)

------
cat199
Is there a technical paper or short writeup for this?

I'd be interested in hearing about the internals / structure.. e.g.:

1) what is the process/threading/privilege model

2) is this it's own lisp or ??

etc.

suppose i can read the source..

------
reddotX
looks like this in VirtualBox
[https://www.youtube.com/watch?v=Wd_-h5kRQLo](https://www.youtube.com/watch?v=Wd_-h5kRQLo)

~~~
agumonkey
decent

ps: I mean descent

~~~
stronglikedan
> _ps: I mean descent_

As in, you would rather see it running Descent instead of Doom?

~~~
agumonkey
It was just a late realized pun that was too good to ignore :)

------
galaxyLogic
There was the Lisp-machines, Symbolics etc. I was lucky to be able to work on
one. Then they went out of favor because of cheaper hardware that could run
anything.

But I wonder, what happened to the Lisp-machine software? Should it not be
possible to run it on current day general purpose hardware even more snappily?

~~~
_delirium
The short answer to what happened to Genera is that it's owned by a private
holding company that bought up a bunch of Symbolics IP in the 1996 bankruptcy
proceedings. They made one further release in 1998, and afaik haven't done any
development on it since.

Presumably there's some price at which they'd be willing to either open-source
it or sell it to someone who would put dev resources into it, but that hasn't
happened.

~~~
jf
John Mallery owns the Genera IP and, from what I’ve heard, there doesn’t seem
to be a price he’d be willing to accept for the IP.

~~~
_delirium
That's useful to know, thanks! Although not good news for it ever seeing the
light of day.

------
timvisee
I'm surprised the shell doesn't use a `((` prompt ))

------
mike_kamau
Kudos to the creators! It always amazes me when people create their own
operating systems. Where do you even start?

~~~
feiss
[https://wiki.osdev.org/Main_Page](https://wiki.osdev.org/Main_Page) and its
forum :)

~~~
vectorEQ
even though useful, i would start to write a bootloader :D it will introduce
first to 'bare metal' code before you want to create an actual OS based upon
such code.

osdev wiki is my favorite site ever :D so many interesting tidbits on all
things low level spread all over it.

------
DigitalTerminal
Lisp makes me wanna fucking kill myself but good job this is cool!

------
ashton314
I thought this was a post about Emacs. ;-)

Seriously though, really cool. What other non-C languages have been used to
make operating systems?

~~~
tanzbaer
www.Redox-os.org

Written in Rust

------
amirouche
Nice achievements.

I would contribute to such a project if it was coded in scheme.

------
mruts
I’ve always wished that Mezzano made the desktop look more like the lisp
machines. I’ve always liked how Genera looked.

------
Pulletwee12549
Its Windowth

------
codedokode
Looked through source code [1]. It lacks readability and is worse than Rust.

[1]
[https://github.com/froggey/Mezzano/blob/master/gui/desktop.l...](https://github.com/froggey/Mezzano/blob/master/gui/desktop.lisp)

~~~
phoe-krk
The code looks readable to me - looks like usual Common Lisp code. Anything in
particular that's unreadable?

Disclosure: I'm a Lisp programmer.

~~~
codedokode
Too many brackets and dashes. Arithmetic expressions look unfamiliar, and
class declarations too. I am a PHP developer by the way.

Also, I noticed a use of eval:

    
    
                 (when (and unclicked-thing (eql unclicked-thing clicked-thing))
                     (let ((*package* (find-package :cl-user)))
                       (eval (read-from-string (third unclicked-thing)))))))))))
    

Also, some function names do not start with a verb, like "(defun desktop-main
(desktop)".

~~~
lispm
DEFUN is not a function.

It's a definition macro and stands for `DEFINE FUNCTION`.

These defining macros are beginning by a style convention with DEF: DEFUN,
DEFMACRO, DEFCLASS, DEFVAR, ...

~~~
hibbelig
I think GP was complaining about desktop-main, not about defun.

~~~
lispm
thanks, seeing that now...

But that's not unusual in Lisp, as functions may be seen as objects, getters,
formulas, etc..

For example a function maybe a top level loop. Then I might call it TOP-LEVEL-
LOOP and not run-top-level-loop or similar.

------
vectorEQ
i hope to god they used the llvm -> cl transpiler also written by this guy to
make this xD can't imagine the horror of writing this directly. awsome though.
nerd points 9000+

