What are the differences between multitasking and multiprogramming?

Task is defined as a system program which consumes very less system resources(memory, CPU time, HD etc..).

A task should have periodic activity and event based activity.

Assume a printer which takes 10msec to print each line and you have fired a job to the printer.So the CPU should send every line with a 10msec gap. But transmitting a line to the printer is an output operation, which means the CPU has to execute some instrucions in order to transmit a line to the printer.

Assume that the CPU takes 2usec to execute this. So this 2us is nothing but a sysem resource. So this is called as task since it is making less usage of system resource and it is periodic(every 10msec it has to execute instructions) and it is also event based(it has to check whether the printer is ON/OFF)

Dos: Mutlitasking (can do printing and scanning simultaneously) but not multi programming(it can execute only one c/c++/java etc program in memory)

Unix: Multiprograming and hence multi tasking.

Answer

Multitasking and Multiprogramming:

In multiprogramming, more than one program lies in the memory i.e. in terms of operating system, the schedular selects the jobs to be placed in ready queue from a number of programs. The ready queue is placed in memory and the existence of more than one program in main memory is known as multiprogramming.

Example of multiprogramming, we open word, excel, access and other applications together but while we type in word other applications such as excel and access are just present in main memory but they are not performing any task or work. Or we can say that are not being used at the same time.

Whereas multitasking means performing multiple tasks in parallel. Usually, CPU processes only one task at a time but the switching of CPU between the processes (also known as Context Switching) is so fast that it looks like CPU(or processor) is executing multiple processes at a time.

Example of multitasking, we listen to music and do internet browsing at the same time (they execute parallely).

Also a task (or process) is a part of program under execution. In other words, task is an active entity where as program is passive entity.