Valdrin Haxhiu, Vehbi Neziri
Publication year: 2010


In this seminar work discussed one of the greatest features of the general purpose computer programming language – C#. Multitasking, which means doing many things at the same time (of course, this is something relative, because the processor executes given tasks in parallel so it makes us think that they are executing simultaneously) is one of the most fundamental concepts in computer engineering and computer science. Multitasking is related to other fundamental concepts like processes and threads. A process is a computer program that is executing in a processor, while a thread is a part of a process that has a way of execution; it is a thread of execution. Every process has at least one thread of execution. There are two types of multitasking: process-based and thread-based. Process-based multitasking, means that on a given computer there can be more than one program or process that is executing, while thread-based multitasking, which is also known as multithreading, means that within a process, there can be more than one thread of execution, each of them doing a job and so accomplishing the job of their process. When there are many processes or many threads within processes, they may have to cooperate with each other or concurrently try to get access to some shared computer resources like: processor, memory and input/output devices. They may have to, for example: print a file in a printer or write and/or read to the same file. We needed to avoid situations where some processes and/or threads might make things go in an unpredictable way. We need a way of setting an order, where processes and/or threads could do their jobs (user jobs) without any problem, we need to synchronize them. C# has built-in support for process and thread synchronization, there are some constructs that can be used when synchronization is needed, and most of them are covered in this work.