DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Primer for Task Parallel Library- Task Parallel Dataflow

Greg Duncan user avatar by
Greg Duncan
·
Sep. 03, 12 · Interview
Like (0)
Save
Tweet
Share
3.41K Views

Join the DZone community and get the full member experience.

Join For Free

Visual Studio Magazine - A .NET 4.5 Parallel Dataflow Primer

"The Task Parallel Dataflow (TDF) library is built upon the existing Task Parallel Library (TPL) included in the .NET 4.0 Framework. Although the TPL provides a lot of functionality to help parallelize an application, it doesn't make it overly easy to tackle complex parallel use cases such as consumer/provider and agent-based models.

The TDF, on the other hand, provides higher-level abstractions in the form of  generic code blocks that generate and schedule the needed Task objects to handle simple to complex data flows.

The TDF is still in a preview state; it can be installed in Visual Studio 2012 RC through NuGet, as shown in Figure 1.

...

Once the package is installed, you should see a reference to System.Threading.Tasks.Dataflow in your project, as seen in Figure 2.

In the TDF, all blocks implement the common IDataflowBlock interface. The IDataflowBlock interface contains  Complete and Fault methods, and a Completion property getter. The Complete method is called upon successful completion of the dataflow block's task. The Fault method is invoked if an exception occurs and the Completion property returns the Task that will be executed asynchronously by the dataflow block.

All the dataflow blocks also implement either the ISourceBlock<T> or ITargetBlock<T> interface, or both. The ISourceBlock<T> interface defines a contract for offering data, whereas the ITargetBlock<T> interface defines an interface for receiving data.

The ActionBlock
I'll begin with the ActionBlock, which implements the ITargetBlock<T> interface. In turn, the ISourceBlock and ITargetBlock interfaces both inherit the base IDataflowBlock interface. Later I'll go over the TransformBlock  that implements both the ISourceBlock and ITargetBlock interfaces

..."

This looks like a good introduction and primer for the TDF. If you've heard of it but haven't looked into yet, this two page article will help you know what you don't know.
Task (computing) Library Interface (computing)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Best Practices for Writing Clean and Maintainable Code
  • Implementing Adaptive Concurrency Limits
  • DevOps Roadmap for 2022
  • A ChatGPT Job Interview for a Scrum Master Position

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: