Subscribe by Email


Wednesday, April 24, 2013

What is multi-tasking, multi-programming and multi-threading?


When it comes to computing, there are 3 important tasks that are inter-related concepts namely multi-programming, multitasking and multi-threading. 

What is Multitasking?

- This has actually emerged out of the need of multitasking since while the system performed one task a lot of time was wasted. 
- As their needs grew,people wanted the computer to perform many tasks at the same time. Multi-tasking is what we call it. 
- Here, multiple tasks or processes are carried out simultaneously.
- The common processing resources i.e., the main memory and the CPU are shared by these processes. 
- If the system has only one CPU to work with, then it can only run one task at a time. 
- Such systems seek to multi-task by scheduling all the processes required to be carried out. 
- It runs one task and the other one waits in the pipeline.
The CPU is reassigned to all the tasks turn by turn and this is termed as a context switch. 
- When this happens very frequently, it gives an illusion that the processes are being executed in parallel. 
- There are other systems called multi-processor machines which have more than one CPU and can perform a number of tasks greater than the number of CPUs. 
- There are a number of scheduling strategies that might be adopted by the operating systems and they are:
Ø  Multi – programming
Ø  Time – sharing
Ø  Real – time systems

What is Multi-Programming?

- Earlier we had very slow peripheral devices and therefore the CPU time was a luxury and so expensive. 
- Whenever a program was being executed for accessing a peripheral, the CPU was to keep waiting for the peripheral to finish with processing the data. 
- It is very inefficient. 
- Then came the concept of multi–programming which was a very good solution. 
-  When the program reached the waiting status, its context was stored in the memory and the CPU was given some other program to execute. 
- This processing continued till all the processes at hand were completed. 
- Later,developments such as VMT or virtual machine technology and virtual memory greatly increased the efficiency of the multi – programming systems. 
With these two technologies the programs were able to make use of the OS and the memory resources just as they were being used by the currently executing programs. 
- However, there is one drawback with multi–programming which is that is does not guarantees that all programs will be executed in a timely manner. 
- But then also it was of a great help in processing multiple batches of programs.

What is Multi-threading?

 
- With multi–tasking a great improvement was seen in the throughput of the computer systems. 
- So programmers found themselves implementing programs in sets of cooperating processes.
- Here, all the processes were assigned different tasks like one would take input, other one would process it and a third one would write the output to the display. 
- But for this, there was a requirement of tools that allowed an efficient exchange of the data.
- Threads were an outcome of the idea that the processes can be made to cooperate efficiently if their memory space is shared.
- Therefore, threads can be defined as the processing running in a memory context that is same for all. 
- These threads are said to be light – weight since there is no need for a change of memory context for switching between them. 
- The scheduling followed here is of the preemptively. 


No comments:

Facebook activity