290 likes | 543 Views
Scheduling. Computing Theory – F453. Scheduling, Job Queues and Priorities. Life requires Schedules, Priorities and Queues. Without them, nothing would function. What are your priorities?. Physical Spiritual Mental Emotional. Scheduling. Look at a multi-user operating system
E N D
Scheduling Computing Theory – F453
Scheduling, Job Queues and Priorities • Life requires Schedules, Priorities and Queues. Without them, nothing would function .
What are your priorities? • Physical • Spiritual • Mental • Emotional
Scheduling • Look at a multi-user operating system • there are a number of jobs that must be in the memory in order for the OS to switch from one job to another • This means that the OS must have a set of rules that it can use in order to determine the order in which the jobs are handled. • The use of this set of rules is called Scheduling.
Define The Term Scheduling • “The use of a set of rules to determine the order in which jobs should be handled is called scheduling”
Scheduling rules • The rules used in scheduling will be decided by the importance applied to the different jobs which need to be carried out. • This concept of importance implies that the jobs can be arranged into some sort of order which can then be followed by the OS. • In order to decide on the importance of a job, the CPU must decide on the job’s Priority
How do you order jobs in your life? • Jobs that require physical strength (interfacing with physical objects) • Jobs that require emotional strength (require processing and brain power)
A Processor has TWO types of jobs • Jobs which require significant contact with peripheral devices • Printing • Playing Music • Typing a letter • Jobs which require significant use of the processor • Calculating prime numbers • Searching for data • Sorting and filtering database results I/O Bound Jobs Processor Bound Jobs
Which Type of Job has Priority? • Why do you think this would be the case? I/O Bound Jobs Processor Bound Jobs
Exam Practice! • Past paper questions are one of the best ways to help you remember the answers when it matters….
Types of Scheduling – ROUND ROBIN • Imagine you are settling an argument with a group of people. • The fairest way to listen to everyone is to give them an equal slot of time to talk where you will listen to them. • Round Robin is exactly this – each job is given an equal amount of time and dealt with in turn until all the jobs are processed.
Types of Scheduling – FCFS • Imagine you have a queue at a supermarket of people waiting to pay. • Would Round Robin work? • Instead, the fairest way to deal with the customers is through the First Come First Served scheduling type. • The first job to arrive in the queue gets all the processor time until it is complete and the processor moves on.
Types of Scheduling – SJF • Consider your coursework. What is the easiest way to compile a huge file of documentation? • Do the Shortest Job First, then move onto to the larger tasks and finally, while your motivation is at it’s highest – tackle the long job. • But what if we kept giving you other medium sized tasks to complete?
Types of Scheduling – SRT • Consider your prep. You have tried the RR approach, but there’s still loads to do. You want to see your pile of work diminish in the quickest way… • Do the Shortest Remaining Time, then move onto to the longer tasks and the quickest prep gets done, and it looks like you have done more, as more tasks get finished! • But what if we kept giving you other shorter tasks to complete?
Types of Scheduling – MFQ • Multilevel Feedback Queues involve a very complex algorithm which makes use of a number of queues set up according to rules and act like a set of league tables. • Those jobs that use more peripheral time drop down the league table, with some being relegated to other ‘lower’ queues. • When one job finishes, another job can then be promoted.
Match the scenario to the scheduling • You are given three tasks and you do them in the order you are given them. You are given three tasks and you do the quick tasks then move onto the long boring one. You are given three tasks and you devise a system where an alarm goes off if you spend too much time on the task which makes you move onto another high priority job. You are given three tasks and you do a bit of each until they are all done. RR FCFS MFQ SJF
Exam Practice! • Past paper questions are one of the best ways to help you remember the answers when it really matters….
Why use scheduling anyway? • Scheduling is used to try to: • Maximise the use of the computer system. • Allow all users ‘fair’ processing time • Create a reasonable response time for everyone • Prevent the system from being overloaded or blocked.
Job States • Jobs in the processor can be in any of three states enters processor leaves processor
What controls the jobs? • Scheduling within the processor is controlled by… • THE SCHEDULER! • The scheduler is split into three parts: • The High Level Scheduler • The Medium Level Scheduler • The Low Level Scheduler
The Scheduler • The part of the OS that controls jobs in the processor is called The Scheduler • Different tasks are carried out by different parts of the schedule – when a job wants to be processed, it enters the system and the Scheduler places it into the Ready Queue. • It is the High Level Scheduler (HLS) that loads the job into the Ready Queue.
The Scheduler • When the job that is currently running has to stop, then the job at the top of the Ready Queue is loaded into the processor to be run. • It is the Low Level Scheduler (LLS) that loads the job from the Ready Queue to the processor. • At this point, jobs may leave the ‘running’ state for three reasons.
The Scheduler • Can you think of FOUR reasons why a job may move from the ‘running’ state? Peripheral Required ‘blocked’ Processing Time is up ‘ready’ Job Finished Higher Priority Job ‘ready’
The Scheduler – We missed the MLS! • The Medium Level Scheduler is responsible for moving jobs between primary and secondary storage. • It is the Medium Level Scheduler (MLS) is a pre-epmtive scheduler. It is allowed to move jobs out of the ‘running’ state into the ready queue. • Some jobs can only be moved out of ‘running’ if they need I/O or have completed – these are called ‘Non-Pre-emptive’ MLS enters processor HLS LLS leaves processor LLS
Key Terms: High Level Scheduler Medium Level Scheduler Low Level Scheduler Pre-emptive Scheduler Non-Pre-emptive Scheduler • Scheduling • Scheduler • Priority • I/O Bound Jobs • Processor Bound Jobs • Round Robin • SJF • FCFS • MFQ • Job State (ready, running, blocked)