Five ways to insert concurrency to a program written in C#


Abstract

Nowadays processors working in personal computers and mobile devices allow for more and more effective parallel computing. Developers have at their disposal many different methods of implementing concurrency, but usually use the one, that they now best. It is beneficial to know, when a particular technique is good and when it is better to find an alternative. This paper presents different ways of implementing parallel mathematical calculations using threads, tasks, thread pool, task pool and parallel for loop. Each method was used in a C# application running on Windows Presentation Foundation engine on .NET platform. Implemented operation is calculation value of Pi using Leibnitz’s formula.


Keywords

parallel programming; .Net; C#; pi

[1] Blaar H., Lange T., Winter R., Karnstedt M.: Possibilities to solve the clique problem by thread parallelism using task pools. 19th IEEE International Parallel and Distributed Processing Symposium 2005.
[2] Bugnion Laurent: MVVM : Multithreading and Dispatching in MVVM Applications. MSDN Magazine, 2014.
[3] Choudhury Olivia i inni: Balancing Thread-Level and Task-Level Parallelism for Data-Intensive Workloads on Clusters and Clouds. IEEE International Conference on Cluster Computing, 2015.
[4] Jin Jiangming, Zhang Yang, Tang Shanjiang, Fan Hongfei: Performance Modeling and Analysis for Critical Section Contention in Parallel Codes. IEEE
Trustcom/BigDataSE/ISPA, 2016.
[5] Lee Jiyeon, Chwa Hoon Sung, Lee Jinkyu, Shin Insik: Thread-level priority assignment in global multiprocessor scheduling for DAG tasks. Journal of
Systems and Software, 2016.
[6] Nowak Robert Współdzielenie obiektów w aplikacjach współbieżnych. Software Developers Journal 2010
[7] Paolieri Marco i inni: A Software-Pipelined Approach to Multicore Execution of Timing Predictable Multithreaded Hard Real-Time Tasks. 14th IEEE International Symposium on Object/Component/Service-Oriented Real-Time Distributed Computing, 2011.
[8] Schubring Tadeusz: Algorytmy równoległe w języku programowania C#. TTS Technika Transportu Szynowego, 2016.
[9] Schwan K., Zhou H.: Dynamic scheduling of hard realtime tasks and real-time threads. IEEE Transactions on Software Engineering, 1992.
[10]Smoliński Mateusz: Elimination of task starvation in conflictless scheduling concept. Information Systems in
Management vol. 5 (2) 2016, 237−247.
[11]Tousimojarad Ashkan i inni: Number of Tasks, not Threads, is Key. 23rd Euromicro International Conference on Parallel, Distributed, and Network-Based Processing, 2015.
[12]Warczak Mateusz i inni: Programowanie równoległe i asynchroniczne w C# 5.0. Wydawnictwo Helion, 2014.
[13]Wirth Niklaus: Tasks versus Threads: An Alternative Multiprocessing Paradigm. Springer-Verlag 1996.
Download

Published : 2018-03-30


Szyszko, P., & Smołka, J. (2018). Five ways to insert concurrency to a program written in C# . Journal of Computer Sciences Institute, 6, 62-67. https://doi.org/10.35784/jcsi.641

Paweł Szyszko  pawel.szyszko24@gmail.com
Institute of Computer Science, Lublin University of Technology, Nadbystrzycka 36B, 20-618 Lublin, Poland  Poland
Jakub Smołka 
Institute of Computer Science, Lublin University of Technology, Nadbystrzycka 36B, 20-618 Lublin, Poland  Poland