



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Operating Systems is necessary course in Computer Science. Its about threading, process scheduling, deadlocks, memory management etc. This lecture includes: Scheduling, Algorithm, Queue, Preocess, Upgrade, process, Priority, Time, Block, File
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Operating Systems [CS-604] Lecture No.
Chapter 6 of the textbook Lecture 16 on Virtual TV
Scheduling algorithms UNIX System V scheduling algorithm Optimal scheduling Algorithm evaluation
Multilevel feedback queue scheduling allows a process to move between queues. The idea is to separate processes with different CPU burst characteristics. If a process uses too much CPU time, it will be moved to a lower-priority queue. This scheme leaves I/O bound and interactive processes in the higher-priority queues. Similarly a process that waits too long in a lower-priority queue may be moved o a higher priority queue. This form of aging prevents starvation. In general, a multi-level feedback queue scheduler is defined by the following parameters: Number of queues Scheduling algorithm for each queue Method used to determine when to upgrade a process to higher priority queue Method used to determine when to demote a process Method used to determine which queue a process enters when it needs service Figure 17.1 shows an example multilevel feedback queue scheduling system with the ready queue partitioned into three queues. In this system, processes with next CPU bursts less than or equal to 8 time units are processed with the shortest possible wait times, followed by processes with CPU bursts greater than 8 but no greater than 16 time units. Processes with CPU greater than 16 time units wait for the longest time.
Figure 17.1 Multilevel Feedback Queues Scheduling
UNIX System V scheduling algorithm is essentially a multilevel feedback priority queues algorithm with round robin within each queue, the quantum being equal to1 second. The priorities are divided into two groups/bands: Kernel Group User Group Priorities in the Kernel Group are assigned in a manner to minimize bottlenecks, i.e, processes waiting in a lower-level routine get higher priorities than those waiting at relatively higher-level routines. We discuss this issue in detail in the lecture with an example. In decreasing order of priority, the kernel bands are: Swapper Block I/O device control processes File manipulation Character I/O device control processes User processes The priorities of processes in the Kernel Group remain fixed whereas the priorities of processes in the User Group are recalculated every second. Inside the User Group, the CPU-bound processes are penalized at the expense of I/O-bound processes. Figure 17. shows the priority bands for the various kernel and user processes.
Figure 17.2. UNIX System V Scheduling Algorithm
Every second, the priority number of all those processes that are in the main memory and ready to run is updated by using the following formula:
Priority # = (Recent CPU Usage)/2 + Threshold Priority + nice
Figure 17.4 FCFS Algorithm is Used in Case of a Tie
To select an algorithm, we must take into account certain factors, defining their relative importance, such as: Maximum CPU utilization under the constraint that maximum response time is 1 second. Maximize throughput such that turnaround time is (on average) linearly proportional to total execution time.
Scheduling algorithms can be evaluated by using the following techniques:
Analytic Evaluation A scheduling algorithm and some system workload are used to produce a formula or number, which gives the performance of the algorithm for that workload. Analytic evaluation falls under two categories:
Deterministic modeling Deterministic modeling is a type of analytic evaluation. This method takes a particular predetermined workload and defines the performance of each algorithm for workload in terms of numbers for parameters such as average wait time, average turnaround time, and average response time. Gantt charts are used to show executions of processes. We have been using this technique to explain the working of an algorithm as well as to evaluate the performance of an algorithm with a given workload. Deterministic modeling is simple and fast. It gives exact numbers, allowing the algorithms to be compared. However it requires exact numbers for input and its answers apply to only those cases.
Queuing Models The computer system can be defined as a network of servers. Each server has a queue of waiting processes. The CPU is a server with its ready queue, as are I/O systems with their device queues. Knowing the arrival and service rates of processes for various servers, we can compute utilization, average queue length, average wait time, and so on. This kind of study is called queuing-network analysis. If n is the average queue length, W is the
A
60
A
A
A
B
B
B A B B
1 2 3 A runs first
Higher Priority
average waiting time in the queue, and let is the average arrival rate for new processes in the queue, then
n = * W
This formula is called the Littleโs formula , which is the basis of queuing theory , a branch of mathematics used to analyze systems involving queues and servers. At the moment, the classes of algorithms and distributions that can be handled by queuing analysis are fairly limited. The mathematics involved is complicated and distributions can be difficult to work with. It is also generally necessary to make a number of independent assumptions that may not be accurate. Thus so that they will be able to compute an answer, queuing models are often an approximation of real systems. As a result, the accuracy of the computed results may be questionable. The table in Figure 17.5 shows the average waiting times and average queue lengths for the various scheduling algorithms for a pre-determined system workload, computed by using Littleโs formula. The average job arrival rate is 0.5 jobs per unit time.
Figure 17.5 Average Wait Time and Average Queue Length Computed With Littleโs Equation
Simulations Simulations involve programming a model of the computer system, in order to get a more accurate evaluation of the scheduling algorithms. Software date structures represent the major components of the system. The simulator has a variable representing a clock; as this variableโs value is increased, the simulator modifies the system state to reflect the activities of the devices, the processes and the scheduler. As the simulation executes, statistics that indicate algorithm performance are gathered and printed. Figure 17.6 shows the schematic for a simulation system used to evaluate the various scheduling algorithms. Some of the major issues with simulation are: Expensive: hours of programming and execution time are required Simulations may be erroneous because of the assumptions about distributions used for arrival and service rates may not reflect a real environment
RR (q=4) 6.0 3.
RR (q=1) 7.0 3.
Average Wait Time W = t (^) w
Algorithm