1 / 14

Plinq Presentation

Plinq Presentation. Steen L. Knudsen slk@neas.dk steen.l.knudsen@gmail.com. NEAS. Nordjysk Elhandel. PLinq. Parrallel Linq Make it easy for the developer to take advantage of multiple cores . Declarative way of expressing parrallel computations. Thread Pool.

samuru
Download Presentation

Plinq Presentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PlinqPresentation Steen L. Knudsen slk@neas.dk steen.l.knudsen@gmail.com

  2. NEAS • Nordjysk Elhandel

  3. PLinq • ParrallelLinq • Make it easy for the developer to takeadvantage of multiple cores. • Declarativeway of expressing parrallel computations

  4. Thread Pool • A lot of codeneeded to manage the plumbinginvovled in this

  5. Plinqthread Pool • Split the enumerable list intopartitions and let the threads run the tasks

  6. When to usePlinq • N elements - M threads - T time to process • Overhead • Split the enumerableinto parts O(N) • Start the threads O(M) • Merge the part resultsinto the completeresult O(N) • Gain O(N/M*T) • O(N/M*T) > (2*O(N)+ O(M))

  7. AsParrallel • .AsParrallel • Extension to IEnumerable • publicstaticParallelQueryAsParallel( thisIEnumerable source ) • The IEnumerableshouldrepresent the tasksthatshould run in parrallel

  8. ParallelQuery • .WithDegreeOfParallelism() • The number of threadsused

  9. Partitioner • The default partitioner split the list intochunks • Youcanwrite a customPartitionerthatinherits from Partitioner<T> • Example

  10. ParallelQuery • ForAll() • WithMergeOptions() • FullyBufferedeachthreadprocess the part, thenmerge • Example • WithCancellation() • CancellationToken • AsOrdered()

  11. Exceptions • AggregateException

  12. Plinq and dbsources • Becareful the source for the AsParrallel is a database source. • Example

  13. Task Parallel Library

  14. Task Parallel Library • Task<T> • Future • Parallel.ForEach

More Related