The concept of multiprogramming is that more than one program that is to be executed by the processor is loaded into the memory .
Say we have 2 programs loaded into the memory. The first program that is loaded is getting executed . At one point of time it requires input from the user or waiting for some data.During the waiting time , the CPU is idle. Instead of wasting the time , the CPU will now begin to execute the second program. Meanwhile the first program once it receives the required data , will again get the CPU time and get executed blocking or pausing the execution of the second program. After the completion of the first program, the second program is executed from where it was paused.The concept was introduced to maximize the CPU usage.
Both the memory and CPU time is shared among the tasks It performs multiple tasks concurrently. It gives a illusion that all the processes or tasks are performed simultaneously. For example in your desktop you can listen to music , download things simultaneously. The concept is that the CPU time is shared equally among the processes or tasks. Again take an example that 3 tasks are loaded into the main memory . Consider that the time allocated for each program is 5 micro seconds .Now the first task is executed . After 5 microseconds irrespective whether the task gets completed or not it gets switched to the second task. Similarly after 5 seconds it goes to the third task . Thus the CPU time is shared equally among the tasks
The term multiprocessing is introduced around the modern times when they started to use more than one processor in a single computer (Remember the terms like dual core , quad core ,octa core processor). These processors share some things in common like Memory,peripherals etc. By sharing the memory and peripherals they are able execute different task simultaneously.
Multiprogramming – takes place in a system where it has a single processor .
Multitasking – single processor or sometimes multiprocessor
Multiprocessing – multiprocessor.
Each task is performed by separate processor incase of multiprocessing and this is were the actual concurrent execution or parallel execution take place.