
“If you could have a wish granted, what would you like to see next in Racket?”
https://www.reddit.com/r/Racket/comments/hwe49b/if_you_could_have_a_wish_granted_what_would_you/?utm_source=share&utm_medium=ios_app&utm_name=iossmf\|https://www.reddit.com/r/Racket/comments/hwe49b/if_you_could_have_a_wish_granted_what_would_you/?utm_source=share&utm_medium=ios_app&utm_name=iossmf or original twitter

@ego has joined the channel

@richo has joined the channel

I have questions about parallelism in Racket… I understand that Racket threads are like green threads (?) and provide concurrency but not parallelism And places provide sub-vms which do provide parallelism (and communicate via shared memory)
Then there are futures… they can provide parallelism as long as the code in them is “future safe” otherwise they get blocked, I guess have to synchronise with the main thread?

I found the following: “As a general guideline, any operation that is inlined by the https://docs.racket-lang.org/guide/performance.html#%28tech._jit%29\|JIT compiler runs safely in parallel, while other operations that are not inlined (including all operations if the JIT compiler is disabled) are considered unsafe.”
generally it seems hard to say exactly what things are future safe but various tools are provided to profile and check your code to identify when it blocks (“unsafe”)

My question is how all this changes if you are compiling code under Racket CS
it was my understanding that was no longer a bytecode vm… does that mean all code is then “future safe”?

found this thread from 2 years ago, not sure if info is still current https://groups.google.com/g/racket-users/c/Vj22-WodBVg/m/O1anoRO1BwAJ
> the “cs” variant of Racket will map Racket futures onto Chez > pthreads, and many more operations are future-safe in that variant. > However, Racket threads still do not run in parallel in the “cs” > variant — you need to use futures or places to make use of more than > one hardware core from Racket.

That information is still correct. Many more things are now future-safe (such as accessing an eq-based mutable hash table, or operations on immutable hash tables). But many operations are not future safe, including all things that interact with Racket’s threads or IO.

thanks!

is there a rule of thumb to know which things are not future safe? “threads and IO” are the main ones?

“things that seem like they might need a lock to be thread-safe”

makes sense, cheers

it is unfortunate that there isn’t real documentation of this

@moe has joined the channel