top | item 4656605

Sol — a sunny little homemade virtual machine

277 points| whalesalad | 13 years ago |rsms.me | reply

54 comments

order
[+] simplekoala|13 years ago|reply
I didn't realize the author is a designer till I went to his about me page. Pretty awesome that he can write some serious code. Respect.

<edits to correct grammar>

[+] arnarbi|13 years ago|reply
Wow - he is also the designer brains behind the Spotify brand, which has always been impressive to me.
[+] skrebbel|13 years ago|reply
Wtf? Sure, making a decent VM that can actually do something is no empty feat, but that just means that he's not only a designer but also a programmer. It's not like you're stamped "designer" on your forehead at birth and that's it, you know.

I have a friend who can code and bake excellent pie. Amazing!!

[+] ojiikun|13 years ago|reply
Serious (non-snarky) question: are projects like this no longer standard fare for undergraduate CS majors? This example is rather comprehensive and well-documented, but is almost spot on what all 50-75 of us had to do for a Junior-level class at Georgia Tech back in 2003 or so.
[+] rasmusfabbe|13 years ago|reply
(Not taken as snarky) I would believe so. I never went to school, but started working when I was in 8th grade. Didn't even learn algebra or any advanced math beyond multiplication, which I have since regret at several occasions. I'm surrounded by amazingly talented computer scientists all day long and we thrive on each others' knowledge. For instance, a mathematician friend of mine once gave me the book "Fermat's Last Theorem" (ISBN 1841157910) which sparked an interest in math, and more so the function that the language of math plays in logic. I would only assume something like this Sol project of mine would be a very good fit in any CS education.
[+] jsolson|13 years ago|reply
Interesting that you mentioned Georgia Tech (BS '06, MS '09), as I was thinking that it's disappointing that no systems or compilers classes are required anymore.

The new Threads curriculum doesn't (or didn't when I last paid attention to it) require anything nearly this complicated. I have a friend who graduated under Threads without having taken CS2200 (Systems and Networks) or ECE2030 (Intro ECE). He's a talented computer scientist, but he's had to learn a lot of the bits of systems that are relevant to his day-to-day work on his own.

That said, I feel like this goes beyond anything that was ever strictly "required". The most complicated VM or language related work I had that was in a core class was Olin Shivers's[0] CS3240 (Languages and Computation). That concluded with us building a basic Scheme interpreter in Java. The other work I did on the subject was in specialization or elective classes (or grad school).

[0]: To folks who might happen to be at Northeastern, do take any class you can with Olin. He is a fantastic professor, and I can't recommend his classes enough. Favorite class I took at tech, hands down.

[+] jcurbo|13 years ago|reply
Really depends on your school. I went to a little podunk college (graduated in '02) with a tiny CS department and we did not do anything nearly this complex. You went to a top 10 CS school and did stuff like this. I don't have any real data but I imagine the situation is probably the same these days.
[+] praptak|13 years ago|reply
Implementing a multithreaded VM was part of the semester task to pass Compilers (Warsaw University, 1996.) The VM was a bare bones instruction set plus threading support. The rest of the task was to implement a compiler for a concurrency-supporting language targetting the VM.

The most tedious part was implementing a garbage collector on top of the VM (GC was not part of the VM spec) We grumbled a lot about this task :)

[+] robryan|13 years ago|reply
From my personal experience no they aren't, although I would have loved to have gone somewhere where they were.
[+] jtchang|13 years ago|reply
Amusing to see other gatech people here on here. I remember taking a systems class as well either 2nd or 3rd year (CS '03). Pretty much exactly what this is implemented all in C.

I talk to my other friends at CS schools and lately some of them don't nearly go into as much depth.

[+] okal|13 years ago|reply
Another possibility is the non-CS crowd on HN might be bigger than is generally assumed. I'm an ECE undergrad, though the programme at my school skews to EE rather than CS. Our compilers course always felt like an afterthought, with implementation being entirely at the instructors discretion. We mostly just drew a bunch of state diagrams :-)
[+] 10098|13 years ago|reply
Funny, but no, not everywhere. I did a project like that, though, in my undergrad years, but it wasn't a assignment, just for fun.

Instead of doing something like this, they just made us memorize the x86 instructions and their nuances. I shudder every time I think about it.

[+] fusiongyro|13 years ago|reply
I did not have to implement a virtual machine to get my degree at New Mexico Tech, but I did have to write a compiler with an x86 backend, and some Linux drivers. It depends on the school, but Georgia Tech is well known for a reason.
[+] flashingpumpkin|13 years ago|reply
I think it's also worth linking to David Beazley's Curious Course on Coroutines and Concurrency [1]. It's exploring the ideas of a task scheduler implemented in Python. This article reminded me of it. It's not a full VM, but about half way into the PDF he goes into quite some detail on how to build a task scheduler modelled after an OS and how it works in an actual OS. Give it a read.

[1] http://www.dabeaz.com/coroutines/

[+] s_tec|13 years ago|reply
This warms my heart; It's wonderful to see people doing crazy stuff like this for fun.
[+] tarabukka|13 years ago|reply
I wouldn't call the concept itself too far-fetched. As a learning or teaching exercise, though, building virtual machines, languages, JIT compilers and the like is very interesting. I'm assuming that "Sol" is a play on "Lua", because both virtual machines seem similar.
[+] drudru11|13 years ago|reply
I've been following this guy for a while. He did that editor a while back too. The polish on his stuff is excellent.

How does he have time for this stuff?

I would like to work on foundational projects too, but there are too many practical things that need go get done.

It is good to see that somebody has time for this.

[+] chubot|13 years ago|reply
This is cool, especially the coroutines. BTW the predecessor to Lua was called "Sol" -- moon and sun in Spanish/Portuguese.

(It was described in one of the Lua papers, but Google for "lua language predecessor sol")

[+] daurnimator|13 years ago|reply
Bad choice of name >.<

SOL (meaning Sun in Portuguese) was a VM built a PUC-Rio. It was the predecessor to Lua (meaning Moon in Portuguese).

[+] andrewcooke|13 years ago|reply
yeah - it's a neat project, but my first reaction, too, was to look for a link to lua.
[+] brianjolney|13 years ago|reply
Somewhat offtopic - I really liked the digitized whiteboard looking drawings. Is that off a tablet, or a photographed whiteboard?
[+] rasmusfabbe|13 years ago|reply
I drew those on my iPad using the Paper app. Highly recommended together with a stylus pen.
[+] alonecuzzo|13 years ago|reply
I was thinking the same thing, I think it's a whiteboard.
[+] vhf|13 years ago|reply
This is like Minix, but for VM ! :)
[+] rasmusfabbe|13 years ago|reply
I compiled my own minix back in the days and ran it on an AST Bravo laptop (monochrome display and very sparse resources.) Fun times, ha ha.
[+] kiallmacinnes|13 years ago|reply
Very interesting - handlebars.js's internals suddenly makes so much more sense!
[+] webmonkeyuk|13 years ago|reply
Is it just me that read "Bum queue" instead of "Run queue" in the first diagram