Mezzano – An operating system written in Common Lisp
github.com
github.com
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://franz.com/success/customer_apps/scheduling/siscog.lh...
Gensym G2 is also written in a Lisp without GC. The Roomba software was written wit static memory allocation in a Lisp... it probably still is.
> I think he may be the only productive Lisp programmer in the world.
There are a bit more...
General GC is really overrated I think. Automatic retain counting is nicer because it's deterministic and you never have to scan memory. Compaction can be nice but you can live without it.
Its not unlike the 90's disasms. They compile. They work. But no human writes that kind of code that results when disassembling an optimized high level language's output.
The point being, that someone could code up a similar game and expect similar or better performance.
The same point would then be that Overwatch or Assassin's Creed could be written entirely in Assembler "by someone", because a disassembler can output asm code that compiles to the exact binaries needed to reproduce it.
Yes, it can just like every other Turing complete language. Even Qbasic can do it this way. Let's get back to what a human "someone" can program in the language instead of these high level computer generated abstractions through Turing complete languages.
Waterloo Basic with all its crazy line numbers could do it entirely using PEEKs and POKEs with the logic you are clinging to. And it'll be just as unreadable as the interpreted LLVM is. And exactly as fast.
LLVM can be interpreted in Brainfuck. How far down the rabbit hole can we go before you interpret the whole thing in 1's and 0's? Crazy thought!
Try the conversion yourself and look at the results. It isn't anything like what a human could be expected to read and write. I use it often enough, and I can assure you I'd never want to be the chump who hopes to refactor it into realistic / maintainable Lisp code. What makes this useful at all is the already long-standing CLOS.
It serves its purpose. But you are over-glorifying the merits of the fact that Lisp is Turing complete like so many other languages that came after it.
Other people have already pointed out a speed penalty that I won't cover here. It works, but its not the OG... with enough time and effort, it could be. But for now, it isn't even close.
Also macros might get you faster than C, for the same reason that C++ can be faster than C (compile time metaprogramming).
Rocket Arena is/was a mod
https://github.com/froggey/Mezzano/blob/master/gui/blit-x86-...
It’s amazing that this OS also has its own compiler and runtime capable of running Quake translated into Lisp.
OS writing is pretty simple, as long as you do not need a ton of device drivers and networking. There are over two dozen of them listed there: https://en.wikibooks.org/wiki/Embedded_Systems/Common_RTOS and that is not a complete list.
"Running on real hardware: The hybrid image can be burned to a CD or dd'd onto a USB drive, and booted directly. It requires a 64-bit x86 machine, 2GB of RAM, and a PS/2 keyboard and mouse."
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!
IMO a lot of it is just that all of the ingredients for a modern desktop were there for anyone with 10s of thousands of dollars of hardware, so there was both cross-pollination as well as parallel evolution of ideas.
The invention of the sewing machine is kind of like this; there was a point at which we were very close to being able to make a sewing machine, and several people solved a subset of the problems; the union of that subset gave us a sewing machine, so singling out a single inventor is somewhat non-sensical.
Most lisp machines were specifically targeted at developers while smalltalk at Xerox was more targeted at office productivity. Interestingly enough Xerox hired the BBN team that made lisp machines, and the Xerox star was made to run lisp as well.
A bunch of Lisp Machines were directed at production, not developers. From Symbolics there were special models for that and also smaller "delivery system" versions of the operating system.
For example American Express had a bunch of Lisp Machines as checking complex credit card transaction, Lucent had Lisp Machine nodes in a network switch, NASA had Lisp Machines monitoring video camera streams of rockets from Space Shuttle launches, Symbolics sold many graphics systems to TV studios, etc.
> while smalltalk at Xerox was more targeted at office productivity.
Is that true? Xerox had an office system running on the same hardware, but written in Mesa - unrelated to Smalltalk. Xerox had the CIA as a main customer for the Smalltalk machines, using an application called 'Analyst'...
https://ethw.org/Oral-History:Adele_Goldberg
'But our big commercial involvement was with the CIA.'
> Interestingly enough Xerox hired the BBN team that made lisp machines, and the Xerox star was made to run lisp as well.
BBN made a Lisp in the 60s, from where some developers went to Xerox in 1972/73. Before Lisp Machines existed. BBN Lisp was renamed Interlisp and was supported by both companies. Xerox developed Interlisp-D for Lisp Machines and BBN put Interlisp on an internal research computer.
Smalltalk was influenced by Lisp, and in turn, Smalltalk influenced the subsequent Lisp systems; that's where OOP support appeared in Lisp, first with LOOPS and MIT Flavors, ultimately with CLOS on ANSI Common Lisp.
Common Lisp also is "image-based development", just like Smalltalk. This is a direct ST influence.
Lisp from the early 60s used already images. It went from there to Smalltalk.
I believe you, but, do you have some reference? I would assume this came after Lisp 1.5, right?
http://bitsavers.org/pdf/mit/rle_lisp/LISP_I_Programmers_Man...
Page 66f: SET card writes a memory image to a tape and TST card reads a memory image from tape.
[1]> (class-of (cons 1 2))
#<BUILT-IN-CLASS CONS>
[2]> (class-of #\x)
#<BUILT-IN-CLASS CHARACTER>
[3]> (class-of nil)
#<BUILT-IN-CLASS NULL>
[4]> (class-of (function mapcar))
#<BUILT-IN-CLASS FUNCTION>> in SmallTalk you have data = program (which is running)
Isn't it just an eagerly-evaluated language with closures? Can it walk its own AST?
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/
The blue book and other excellent out-of-print books on SmallTalk can be found here:
Ruby follows in SmallTalk's footsteps and implements something similar, at least to an extent.
Each variation loaded the respective microcode into the CPU and booted into the respective environment.
You can read all about those environments here https://archive.org/details/bitsavers_xerox
When you think about it, Lisp is perfect for their use cases. Pushing patches live without rebooting and easy modification of a running system image while running.
What use cases?
There were a lot of Lisp systems for Space Shuttles which were not needing such a feature.
Examples:
'Automating Planning and Scheduling of Shuttle Payload Operation'
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.96....
'The objective of EMPRESS (expert mission planning and replanning scheduling system) is to support the planning and scheduling required to prepare science and application payloads for flight aboard the US Space Shuttle. EMPRESS was designed and implemented in Zetalisp on a 3600 series Symbolics LISP machine. Initially, EMPRESS was built as a concept demonstration system.'
https://ieeexplore.ieee.org/document/17369
'NASA used Symbolics' high-definition technology to analyze HDTV video images of the Discovery launch in real-time. This high-definition system enabled NASA engineers to get an instant replay of critical launch systems.'
ftp://ftp.ai.sri.com/pub/mailing-lists/slug/900531/msg00199.html
'An Intelligent Training System for Flight Controllers Space Shuttle'
http://www.aaai.org/Papers/IAAI/1989/IAAI89-021.pdf
and so on...
Remote Agent was a part of the Deep Space 1 space mission...
There is a fun little demo on youtube here; https://www.youtube.com/watch?v=o4-YnLpLgtk . That shows off a LISP machine roughly as it was written in the 80s/90s.
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.
Xerox stuff for Interlisp-D, Smalltalk, Mesa and Mesa/Cedar,
https://archive.org/details/bitsavers_xerox
ETHZ Research
https://people.inf.ethz.ch/wirth/
https://www.research-collection.ethz.ch/handle/20.500.11850/...
"NEWP Programming Reference Manual" for ClearPath MCP (nee Burroughs B5000 in 1961)
https://public.support.unisys.com/aseries/docs/clearpath-mcp...
https://www.smecc.org/The%20Architecture%20%20of%20the%20Bur...
Check IBM's RISC research with PL/8, before they decided to create Aix instead.
https://en.wikipedia.org/wiki/PL/8
Then you can follow up on Singularity, Midori and Barrelfish for the more up to date stuff
https://www.microsoft.com/en-us/research/project/singularity...
http://joeduffyblog.com/2015/11/03/blogging-about-midori/
https://www.microsoft.com/en-us/research/project/barrelfish/
And their fruits into mainstream Windows
https://channel9.msdn.com/Events/Build/2012/3-005
https://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-an...
https://channel9.msdn.com/Shows/Going+Deep/Inside-NET-Native
There is plenty more, however I think you can already lose yourself in such information. :)
https://en.wikipedia.org/wiki/BLISS
And there is https://www.vmssoftware.com/documents_list.html
>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...
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.
https://news.ycombinator.com/item?id=8943709 Jan 2015
when compared to this
https://common-lisp.net/project/mcclim/static/media/screensh...
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/Basix2
https://sawfish.fandom.com/wiki/Operational
https://sawfish.fandom.com/wiki/Roman
https://sawfish.fandom.com/wiki/Tufte
https://sawfish.fandom.com/wiki/SawLook
https://sawfish.fandom.com/wiki/Fvwm2Gtk
Those may not look anything fancy, but won't hurt the eyes either.
Apart from that: RESPECT!
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 :)
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...
GNU Emacs otoh is a specific editor.
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.
> “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.
And also stumbled on this which i find fascinating: https://m.youtube.com/watch?v=gV5obrYaogU
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..
ps: I mean descent
As in, you would rather see it running Descent instead of Doom?
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?
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.
osdev wiki is my favorite site ever :D so many interesting tidbits on all things low level spread all over it.
Seriously though, really cool. What other non-C languages have been used to make operating systems?
Written in Rust
I would contribute to such a project if it was coded in scheme.
[1] https://github.com/froggey/Mezzano/blob/master/gui/desktop.l...
Disclosure: I'm a Lisp programmer.
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)".For example:
- https://docs.microsoft.com/en-us/dotnet/fsharp/tour#pipeline...
- https://ocaml.org/learn/taste.html#Polymorphism-sorting-list...
- http://wiki.c2.com/?ExampleForthCode
- https://github.com/bryanjenningz/25-elm-examples/blob/master...
- https://github.com/marklnichols/haskell-examples/blob/master...
defun is actually a complete sentence, contracted, as others have pointed out. Defining a function uses a noun-like keyword in some languages. For instance in, oh, Awk, the function keyword is used.
There is a def prefix convention in Lisp, as well as a define- one: defmacro, defclass, defconstant, ... define-symbol-macro, define-setf-expansion. The def-s are contracted words with no dashes; the define-s are whole words joined by dashes. All the macros named this way have a some global defining effect, and are mainly used used as top-level forms: if you see one nested in code, then that's a red flag.
Functions are often named verbs when they are not actually functions, but procedures: subroutines that have a side effect: print, put_pixel, sort, connect, ...
Functions that calculate something from their arguments and return a value are often not named after verbs, but rather nouns.
Even if you aren't familiar with functional programming, you probably know some pure functions in some languages. For instance, arithmetic ones: sin, sqrt, atan. Or how about accessors that retrieve the property or state of an object: length, position, temperature. All these are nouns.
(Sometimes pure functions are verbed, after the process that they perform to calculate the return value, such as join, catenate. sort and reverse could be names pure functions that returns a sorted sequence, though reverse is also a noun (function that returns the reverse of its input)).
Blind adherence to rules like "functions must start with verbs" is a symptom of cargo cult programming.
The usage of eval there makes sense because it is launching a program. It's equivalent to e.g. using system() or /bin/sh in a launcher on a unix system.
How did this unreadable gobbledyook fail to conceal its use of eval from your eyes?
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, ...
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.
Given, everything seems quite well-named here, and that helps a ton.