Open lassik opened 2 years ago
Guile uses pthreads:
$ ldd /usr/local/bin/guile|grep thread
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c4c2b8000)
And implements SRFI-18, plus some extra procedures: https://www.gnu.org/software/guile/manual/guile.html#Scheduling
Bigloo supports SRFI-18
https://www-sop.inria.fr/mimosa/fp/Bigloo/manual.html
and uses pthreads
.
It also implements fair cooperative threads:
https://www-sop.inria.fr/mimosa/fp/Bigloo/manual-chapter16.html
Co-operative multitasking is used in coroutines. Schemes with virtual threads usually implement some form of preemptive multitasking.
Gauche uses Windows threads on MinGW version as well. What qualifies "Re-entrant interpreter"?
Thanks a lot for the feedback!
Added Guile and Bigloo.
Co-operative multitasking is used in coroutines. Schemes with virtual threads usually implement some form of preemptive multitasking.
Confusing wording on my part: the OS threads cooperate to preempt the virtual threads.
However, at least Bigloo's Fair Threads require co-operation to be implemented by user code, so it's doubly cooperative.
What qualifies "Re-entrant interpreter"?
Also confusing wording. "Multiple interpreters per OS process" would be clearer.
Basically, the whole interpreter state is contained in a C struct, allowing the C programmer to create a separate interpreter for each C thread if he so chooses. So the interpreter doesn't need any provisions for multi-threading, but also doesn't get in the way of the C programmer's multi-threading. An interpreter that keeps state in global variables is not re-entrant in this way. TinyScheme and s7 ought to be re-entrant, and Guile is probably close enough. Can one process host multiple independent embedded Gauche's?
Hey, nice initiative!
Maybe I'm misunderstanding something, but what is a "virtual machine" thread? In the case of implementations that don't have a "virtual machine" (a la JVM and BEAM), is that the "main thread" of the program?
The table seems to me to suggest that CHICKEN supports OS threads with the SRFI-18 API, but that's not the case (at least not OOB). The threads provided by the SRFI-18 egg are green threads (please forgive and correct me if this is not the correct/exact terminology). I believe there's an egg that makes it easier to use pthreads, however.
So, shouldn't CHICKEN have "No" in "OS threads"? I'm not sure about the "Virtual threads" part...
Basically, the whole interpreter state is contained in a C struct, allowing the C programmer to create a separate interpreter for each C thread if he so chooses. So the interpreter doesn't need any provisions for multi-threading, but also doesn't get in the way of the C programmer's multi-threading. An interpreter that keeps state in global variables is not re-entrant in this way. TinyScheme and s7 ought to be re-entrant, and Guile is probably close enough. Can one process host multiple independent embedded Gauche's?
Ah, I see. Then Gauche is "no", for some global environments are shared process-wide.
https://doc.scheme.org/surveys/threads/