Comment by msadeghzadehg
1 year ago
that's cool. but i'm looking for a preemptive concurrency like golang in pyhton that schedules routines and get threads back when routine runs a blocking syscall. the hard part is detection of syscalls. is there any idea?
If I understand correctly, goroutines = asyncio (non-invasive) + asyncio.to_thread (when needed, but automatic). So, it is still cooperative concurrency that feels preemptive due to its design. This Go capability is interesting, and it 'seems' that it cannot be replicated without some integration with the runtime of the target language, i.e., a 'baked-in solution'. For now, I'm fine with true preemptive concurrency, but this might change in the future.