Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 2, March April 2013 ISSN 2278-6856
Assistant Professor (CSE) Institute of Technology Roorkee, Roorkee (ITR) Assistant Professor (MCA) IEC College of Engineering, Greater Noida
2
Abstract: This paper explains a new approach for C P U scheduling algorithms which can be used to improve the performance of CPU in real time operating system. The new approach of CPU Scheduling algorithm is based on the integration of round-robin, SJF scheduling algorithm. Priority is calculated on the basis SJF and time quantum. It retains the advantage of simple round robin in reducing starvation and also integrates the advantage of priority scheduling. The proposed algorithm also implements the concept of SJF and time quantum by assigning new priorities to the processes. Existing round robin CPU scheduling algorithm cannot be implemented in real time operating system due to their large waiting time, large response time, large turnaround time and less throughput. In new approach 2. algorithm improves all the drawbacks of round robin CP U scheduling algorithm. The paper also presents the comparative analysis of proposed algorithm with existing round robin scheduling algorithm on the basis of SJF and time quantum, average waiting time, average turnaround time. Keyword: CPU scheduling, RR and SJF schedule Algorithms, Turnaround time, Waiting Time, Response Time, Burst Time.
the CPU. The time slice value also needs to be small enough to prevent RR from becoming a non-preemptive FCFS algorithm. A good rule of thumb is that the value should be of adequate length to ensure that 80% of all jobs can be completed in one time slice.
1. INTRODUCTION
The round-robin (RR) CPU scheduling algorithm has advantages and disadvantages. An advantage of RR is that starvation is never a problem. RR ensures that all processes in the job (process) queue share a time slice on the processor. Time slicing is defined as the allocation of limited intervals of time (quanta) to programs in contention for use of the CPU. A time slice is simply an amount of time that each job (process) will spend on the processor per iteration of the RR algorithm. All jobs are done in a FCFS algorithm fashion but are preempted after a time slice. The job will either finish in the time slice given or the job will be returned to the tail of the job queue and return to the processor at a later time. This is a disadvantage since all jobs are basically given the same priority. RR also favors short virtual processes and penalizes long ones. Another problem of RR is that the time slice value must be correct. If the time slice value is too small the context switching time is large in relation to actual work done on Volume 2, Issue 2 March April 2013
Figure 1. But the proposed implementation along with the basic RR structure helped with the solution. Scheduling Objectives: A system designer must consider a variety of factors in designing a scheduling algorithm, such as type of systems used and what are user's needs. Depending on the system, the user and designer might expect the scheduler to Maximize throughput: A scheduling algorithm should be capable of servicing the maximum number of processes per unit of time. Avoid indefinite blocking or starvation: A process should not wait for unbounded time before or while process service. Minimize overhead: Overhead causes wastage of resources. But when we use system resources effectively, then overall system performance improves greatly. Enforcement of priorities: if system assigns priorities to processes, the scheduling mechanism should favor the higher-priority processes. Achieve balance between response and utilization: The scheduling mechanism should keep resources of system busy. Favor processes exhibits desirable behavior. Degrade gracefully under heavy load. A system can accomplish these goals in several ways. The scheduler can prevent indefinite blocking of processes through the concept of aging. The scheduler can increase throughput by favoring processes whose requests can be satisfied quickly, or whose completion cause other processes to run.
2. SCHEDULING PARAMETERS
Page 110
3. EXISTING ALGORITHMS
CPU
SCHEDULING
There are many CPU Scheduling algorithms but some of them which are commonly used are explained below. First-Come, First-Served (FCFS): This algorithm allocates the CPU to the process that requests the CPU first. This algorithm is easily managed with a FIFO queue. New process enters the queue through the tail of the queue and leaves through the head of the queue (when the process is allocated to the CPU) (1). The processes are allocated to the CPU on the basis of their arrival at the queue. Once a process is allocated to the CPU, it is removed from the queue. A process does not give up CPU until it either terminates or performs IO. Shortest-Job-First (SJF): The SJF algorithm associates the length of the next CPU burst w ith each processes such that that the process that have the smallest next CPU burst is allocated to the CPU. The SJF uses the FCFS to break tie (a situation where two processes have the same length next CPU burst). The SJF algorithm may be implemented as either a preemptive or non-preemptive algorithms. When the execution of a process that is currently running is interrupted in order to give the CPU to a new process with a shorter next CPU burst, it is called a preemptive SJF. On the other hand, the nonpreemptive SJF will allow the currently running process to finish its CPU burst before a new process is allocated to the CPU. Priority Scheduling (PS): The PS algorithm associates with each process a priority and the CPU is allocated to the process based on their priorities. Usually, lower numbers are used to represent higher priorities. The process with the highest priority is allocated first. If there are multiple processes with same priority, typically the FCFS is used to break tie.
Page 111
P1 P2
P2
P3
P4
P5
P1
P2
P4
P5
Total average waiting time=50.0 Average turnaround time=58.4 According to SRT algorithm: GANTT chart
P3 P2
P4 P2
P4 P2
P1
P1
P5
P2
P5
P5
Total average waiting time=26.4 Average turnaround time= 44.6 Example IInd Suppose RR time quantum =5 Table 2.
Processes Burst time in (ms) P1 24 P2 20 P3 8 P4 10 P5 3 According to simple Round-Robin Algorithm: GANTT chart
P1 P1
P2 P2
P3 P1
P4 P2
P5 P1
P1
P2
P3
P4
Page 112
Total average waiting time=33.2 Average turnaround time=45.2 According to SRT algorithm: GANTT chart
P5 P2
P3 P2
P3 P1
P4 P1
P4 P1
P2
P1
P2
P1
5. CONCLUSION
As we know that RR is a useful algorithm for time sharing system and we have compared both the simple RR and SRT algorithms and observed that the average waiting time, average turnaround time is less in SRT so it is more efficient as compared to simple RR so for better performance we can use SRT in time sharing systems. REFERENCES