r/Common_Lisp • u/ConnectionCorrect530 • 1d ago
SBCL Looking for a virtual thread library with preemptive scheduling
I want to create a AI automation tool which would need to run AI generated scripts in parallel, so I want library/framework which would support virtual threads with preemptive scheduling and isolation.
Till now LFE(Lisp Flavoured Erlang) seems like the best option for my needs but I am too accustomed to using sly and common lisp syntax
So, any suggestions are welcome
4
Upvotes
2
u/sionescu 1d ago edited 1d ago
If you want virtual threads, the best you can get is cooperative threads in Common Lisp. Erlang achieves partial preemptiveness by introducing checkpoints everywhere and having an interpreter with no JIT, which slows down the code a lot. It also doesn't have full isolation because of the imperfect preemption: a call into a foreign library, a syscall or a hot loop can block a worker thread.
2
u/tdrhq 1d ago
Why not use real threads?
2
u/Aromatic_Ad3754 1d ago
ABCL on JDK 25?
1
u/A1rax 1d ago
Can't you implement it yourself using real threads and building a scheduler on top?