3 ms·
Thanks for this comment Gavin. I use colon separated syntax to indicate the multiplexing of different hierarchy levels of thread/coroutine/lightweight threads.
by samsquire 4y ago
Thanks for this comment Gavin.
I use colon separated syntax to indicate the multiplexing of different hierarchy levels of thread/coroutine/lightweight threads.
1:M:N means 1 scheduler thread, M kernel threads and N lightweight threads. So 8 lightweight threads multiplexed over 2 kernel threads multiplexed by one scheduler thread looks as this:
1:0:0
1:0:1
1:0:2
1:0:3
1:1:0
1:1:1
1:1:2
1:1:3
Can use ringbuffers to route data between threads, there's a multiproducer multiconsumer ringbuffers available. I also wrote what I call token ring parallelism where there is no locks but threads take turn writing but read as fast as they can.
My token ring parallelism can be found in this sourcefile
https://github.com/samsquire/multiversion-concurrency-control/blob/main/src/main/java/main/TokenRingTimer2AsyncAwait.java https://github.com/samsquire/multiversion-concurrency-contro...
Essentially there is a state machine that each thread is in reading mode or writing mode. Each thread enables the writing mode of the next thread THREAD_ID + 1 % threads.size(). When the last thread is reached, writing mode is enabled and then when that finishes, reading mode for all threads is reenabled.
Need some approach to representing data flow between threads that is efficient and is pull/push driven.