Wait-free thread communication

Jin via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 8 08:58:59 PST 2016


Idea: no mutex, no CAS, only one direction queues without any 
locks.

My prototype (https://github.com/nin-jin/go.d) is up to 10x 
faster than std.concurrency.send/receive

---
writers =512
readers =1
std.concurency milliseconds=1313
jin.go milliseconds=113
---

Realization:

Queue! - buffered static typed channel. One and only one thread 
can push data to queue, and one and only one can take data from 
queue. Thread blocks when he takes from empty queue and pushes to 
fulfilled queue.

Queues! - list of queues with round robin balancing

go! - starts new thread, in future i want to implement something 
like goroutine, but i do not understand how yet.

I need some good advice, i am newbie in D :-)

Problems:

For blocking thread i use loop with Thread.sleep - this is bad 
decision IMHO.

On my system i can create only up to 1000 threads without errors. 
Fibers from core.thread or Tasks from std.parallelism potentiaĞ´ly 
can resolve this problem, but how to integrate their gracefully.

API of jin-go can be better?

Which dub modules can help me?


More information about the Digitalmars-d mailing list