Multi-programming vs Multitasking Operating System
Setting base to concept. . .
- In OS there are multiple processes waiting for getting CPU.
- They want to get CPU to get executed.
- These process are also known as jobs so don’t get confused if someone use word job instead of process.
- Because a process is going to perform job while getting executed so say it a process or job or use these words interchangeably.
- Coming back to topic, now there are lots of processes waiting for getting CPU, but the main memory is so small so all the process can’t get the space enough to sit and wait there so they wait in a place named job pool.
Multi-programming OS
- CPU get one job out of the pool and start executing it.
- Now between the execution there are 2 case look what
- CASE 1: CPU will get the job and execute it until it finish.
- CASE 2: CPU will be keep executing the job until the JOB itself ask the CPU to wait, as I am going for some I/O operating.
- When the job go for I/O operation, What CPU will do?
- It will no sit idle; it will choose some other job and Execute till the old one come back.
- Switching from one job to other is known as Context switching.
Multitasking OS
- Multitasking means working on more than one task at a time means you are using computer and listening song also searching some thing on internet using browser and making word file that’s your assignment.
- This is you are doing multitasking it seems like all the task are happening in the same time.
- Its not all the task happening at the same time it’s the processor switching between the different tasks in so speedy manners you think that they are happening at the same time.
- Lets go on the next slide to see how it happens behind the scene.
- Multitasking is also using the concept of context switching but with the concept of time sharing.
- You know what is context switching, but what is time sharing?
- Time sharing is the CPU share the time between process, But how?
- The CPU let say decides it will give one second to each job, so what it will do…
- It will pick a job execute it for one second and then get for the next job without taking care if the job is completed or not.
- It will give time equally to all and come back to non-completed jobs in the next cycle.
Preemptive and Non-Preemptive
Preemptive is when CPU give all the time to process to complete the task and then move on towards the next process.
Non-Preemptive when CPU use the time slice and give equal time to each job no matter if the job finishes or not in the time.
Download PDF Slides
No comments:
Post a Comment