Skip to content

Add threads survey#17

Open
lassik wants to merge 5 commits intomasterfrom
lassik-threads
Open

Add threads survey#17
lassik wants to merge 5 commits intomasterfrom
lassik-threads

Conversation

@lassik
Copy link
Member

@lassik lassik commented Aug 31, 2021

@jpellegrini
Copy link
Contributor

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

@jpellegrini
Copy link
Contributor

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

@aoh
Copy link

aoh commented Aug 31, 2021

Co-operative multitasking is used in coroutines. Schemes with virtual threads usually implement some form of preemptive multitasking.

@shirok
Copy link

shirok commented Aug 31, 2021

Gauche uses Windows threads on MinGW version as well.
What qualifies "Re-entrant interpreter"?

@lassik
Copy link
Member Author

lassik commented Aug 31, 2021

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?

@siiky
Copy link

siiky commented Aug 31, 2021

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...

@shirok
Copy link

shirok commented Sep 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants