Over the years, computer science kept evolving; leading to the emergence of what has become a standard in modern software development: Multitasking. Whether logical or physical, it has become a requirement for today's programs. In order to make it possible it became necessary to establish the notion of concurrency and scheduling. In this essay, concurrency will be discussed as well as two types of scheduling; pre-emptive used in threads and cooperative used in agents, their similarities and differences.
Concurrency is an essential part of multitasking; after all using concurrency signifies executing several tasks at the same time or at least to give that impression, “Concurrency is an illusion of parallelism. Thus, two tasks are concurrent if there is an illusion that they are being performed in parallel, whereas, in reality, only one of them may be performed at any time. ” (D.M.Dhamdere, 2006, p91).However, in the case of multi-core processors or multi-processors true parallelism can be achieved. In any case, in order to maintain the illusion of parallelism, executing alternately various tasks is essential, therefore, determining which task execute next is particularly serious. That is where scheduling comes forth since according to D.M.Dhamdere(2006,p91) scheduling is selecting the next process to be serviced, in order to do so different policies can be used, depending on the context in which the program is going to be used, of course combinations are also possible. Let’s focus mainly on pre-emptive scheduling commonly (used by threads) and cooperative scheduling (used by agents). Firstly pre-emptive scheduling, in this configuration, a process, thread or application can be pre-empted. This means that it can be suspended by ...
... middle of paper ...
...me needed for the scheduler to switch task; it may cause some latency but will still be better than a non scheduled batch.
In conclusion, both pre-emptive and cooperative scheduling have strengths as well as weaknesses, and those can affect performances. In the end, it all comes down to choosing the one that is appropriate to the type of result and behaviour one wants to achieve as well as the hardware available. In some cases, pre-emptive scheduling might prevail; in others it might be cooperative scheduling, but of course making use of the two together is also a possibility.
Microsoft MSDN (2010) Comparing the concurrency runtime to other concurrency models. Available at http://msdn.microsoft.com/en-us/library/dd998048.aspx (Accessed: 21 May 2011)
Dhamdere, M.D. (2006), Operating Systems: A concept based Approach 2E, Tata McGraw-Hill Education