The operating system picks and begins to execute one of the jobs in the memory. Eventually the job may have to wait for some task, such as tape to be mounted or an input and output operation to computer. In non-multi program system, the CPU would sit idle. In a multi-programming system. The operating system simply switches to and executes another job when that job needs to wait, the CPU is switched to another job. When that job needs to nob finishes waiting and gets the CPU back. As long as there is always some job to execute the CPU will never be idle.
Eg:- A lawyer does not have only one client at a time. Rather several clients may be in the process of being served at the same time. The process of being served at the same time. While one case is waiting to go trial or to have papers typed, the lawyer can work on another case. If the lawyer has enough client he never needs to be idle.
Multi programming is the first instance where operating system must make decisions for the users.
1. All the jobs that enter the system are kept in the job pool. This pool consists of all processes residing on mass storage awaiting allocated of main memory.
2. If several jobs are realy to be brought into memory but there is not enough memory for all of them then the system must choose a many them. Making this decision is job scheduling.
3. When the operating system a job from the job pool, it loads that job into memory for execution.
4. If several jobs are ready to run at the sametime, the system must choose among them and this decision is made b CPU scheduling which is discussed later.