Chicken Scheme
call-cc.org
call-cc.org
>The only thing missing are lightweight green threads.
...Ummm... Chicken already has that. It implements srfi-18 style pre-emptive coroutines which do qualify as green threads by the standard definition. They all run in a single thread, so you can parallelize without an explicit fork(2) like you can in Erlang and Go, but they are Green threads.
But that's just a guess, if you really want to know, I'd ask Felix: He's the lead developer on Chicken, and he's the one who actually wrote the thing and pushed the commit (see https://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.g...). He's also pretty approachable.
https://wiki.call-cc.org/man/4/faq#does-chicken-support-nati...
Chicken does have fork, concurrent native callbacks and mpi, among other stuff, so you can do parallel stuff. It's just more expensive.
https://wiki.call-cc.org/man/4/Unit%20srfi-18
"The disadvantage is that execution of Scheme code on multiple processor cores is not available."
Is there any solid support for message passing or other multi-processing?
There's concurrent-native-callbacks, which allows you to run Chicken callbacks inside other threads http://wiki.call-cc.org/eggref/4/concurrent-native-callbacks.
Chicken also has MPI support, through http://wiki.call-cc.org/eggref/4/mpi, but I don't really know MPI well.
Pthreads allows you to send C code (not scheme code) out to a pthread pool for execution. http://wiki.call-cc.org/eggref/4/pthreads
Mailbox allows for erlang-style threadsafe mailboxes (FIFO queues) http://wiki.call-cc.org/eggref/4/mailbox, and mailbox-threads attaches a mailbox to each thread http://wiki.call-cc.org/eggref/4/mailbox-threads. Finally, remote-mailbox-threads allows for mailbox send/receives across threads through zmq http://wiki.call-cc.org/eggref/4/remote-mailbox-threads.
Not optimal, but it can all work.
But beyond the elegance of Chicken's internals, it's probably the most practical Scheme implementation for just getting stuff done fast. It has excellent C FFI, a good stdlib with solid POSIX bindings, an excellent package repository with all the libraries you might need, and it's very fast. It's not about the elegance, although it's there, it's about practicality: getting stuff done, efficiently, effectively, and now, not later.
If you want to get in-depth on Cheney on the MTA, I'd reccomend Peter Bex's article on the Chicken GC (http://www.more-magic.net/posts/internals-gc.html), and the original paper, "CONS should not CONS its arguments, part II: Cheney on the MTA". But I'll do my best to sum it up here.
Cheney on the MTA is a really neat hack that allows for cheap continuations, realtively efficient C compilation of Scheme code, and an effective garbage collection scheme.
Effectively, with CMTA, you have a generational GC, but the first generation is stack allocated. When the stack allocations run out of space, all the data is copied out to the heap, into the second generation of GC. This is super effective because most data is only allocated for a short time, so it never goes out to heap, and your accesses are closer together, and also on the stack, so there's less chance of a cache miss. But it gets better: In Scheme, a program's continuation (think basically its instruction pointer and stack state) can be reified as an actual data structure. However, since you're GCing the stack already, this doesn't causr any overheard, or at least not nearly as much as it does in, say, Guile, which has to copy the stack every single time a continuation is created.
The reason it's called Cheney on the MTA is because it uses Cheney's algorithm for GC, and because it's using the stack to hold data, popping the stack would invalidate program state, so it never returns.
What never returning has to do with the MTA is a cultural alusion that would take too long to explain here. But that's never stopped me before.
It's a reference to a song called "M.T.A", originally created for Walter O' Brian's campaign in 1949 (Boston's subway was known as the MTA at the time). It became a hit when recorded by The Kingston Trio in 1959. Looking up the song is left an excercise to the reader.
Unofficially, the song is known as "Charlie on the MTA," hence the title of the paper. And yes, this is where the CharlieCard gets its name.
The song is fairly entrenched in the area: I grew up in Connecticut, and know the lyrics from memory. And on one of several trips to Boston, I've seen at least one person expect to have to pay on their way out of the subway system because of the song :-).
Oh let me tell you a story about a function named *recursive* on a tragic and faithful time,
It was called with 3 long ints, popped the stack and set a jumpbuf, called itself on the SGI.
But did it ever return? No, it never returned, and its value is still unknown,
It may run forever on the SGI mainframe, it's the function that never returned.
Well that function ran a check to see when the stack would overflow, it ran almost past they say,
But when it got there the function called a longjump on the jumpbuf,
It just wasn't returning that day.
But did it ever return? No it never returned, and its value is still unlearned
It may run forever on the SGI mainframe, it's the function that never returned.
Man, GLS makes this look so easy. It's actually kind of hard.Did you see this? http://wiki.call-cc.org/emacs
Generally, for Schemes the standard is to use Geiser mode (not that you would know that as a beginner)
I've wanted to port my operating system attempts to some LISP-Like system but I've not found a good Scheme implementation that generated nice and clean assembly code.
However, it makes heavy use of ELF and dynamic linking by default (although you can link statically), and libchicken, the runtime system, depends upon libc by default.
So yes, you probably could make use of it for OS work, but it's not ideal for that context.