Неоднозначная семантика и некорректности при работе с потоками на C#

Владимир Арнольдович Биллиг, V.A. Billig · Международный журнал Программные продукты и системы · 2015

Modern processors are multi-core. Increasing computing power by increasing the number of processors and the number of cores in each processor will only be progressing. Changing of hard leads to changing soft. As a result, parallel computing becomes one of the main directions of modern programming. When programming in C#, parallel computing is supported by the mechanism of threads created by an operating system. You can create a thread object of the Thread class and associate a certain piece of code with it. It seems natural that when you create a program object of Thread class, the operating system creates a physical thread which will execute the code. For example, it occurs with file objects – creating a file object in the program leads to the creation of a physical file. The article shows the situations when the “natural” semantics takes place, as well as the situations when creation of program thread does not create the physical thread. The author provides recommendations for optimizing the degree of parallelization in recursive methods and in methods without recursion. The research has made it possible to detect the situation when interaction of two important mechanisms (threads and anonymous methods) leads to incorrect work. The constructed examples show incorrect work of anonymous methods when paralleling.

Cited by 0 works. doi:10.15827/0236-235x.110.032-038

Authors