Tpl Dataflow - Part 1
Tpl Dataflow - Part 1
this post is the first of post series which will focus
on the new Tpl Dataflow library (TDF).

TDF goal is to address high-throughput / low-latency
flow scenario of complex computing / IO intensive / immense traffic.
The library is using a few basic buffering and message base pattern in order to
enable basic block which can be compose together into full scale scenario.
each building block construct as agent which have internal buffer and execution management.
one of the most simple block is the ActionBlock:
each time item is send into the ActionBlock it will be buffer in
the internal buffer, than the Block Task will take
one item at a-time and will process it.
by default the ActionBlock schedule only single Task at a-time,
but latter on this series we will see that this default can be change.
actually the Block release Its Task whenever the buffer become empty.
Code Snippet
- var ab = new ActionBlock<int>(i => Console.Write(i));
- Parallel.For(0, 1000, i => ab.Post(i));
as we can see the ActionBlock syntax can be very simple.
it define an action (in the above case Console.Write) and it can fed with data, ab.Post(i).
Summary
ActionBlock is one of the simplest block.
in the future post we will survey other blocks, TDF interfaces, blocks overloads and concepts,
we will see how to chain blocks in a row, and we will
discuss some of the architecture decisions.
Point Of Interest:
My lecture on this topic at Microsoft User group has change to 2011-08-17.
you can register using this link.