Algorithm Psudo Code For Scheduling Algorithm PDF
Algorithm Psudo Code For Scheduling Algorithm PDF
ABSTRACT: The main objective of this paper is to introduce a new CPU algorithm called A Novel CPU Scheduling
Algorithm which acts as both preemptive and non-preemptive based on the arrival time. The prosed algorithm helps to
improve the CPU efficiency in real time uni-processor-multi programming operating system. CPU Scheduling is the basis of
multi-programmed operating system. The scheduler is responsible for multiplexing processes on the CPU. There are many
scheduling algorithms available for a multi-programmed operating system like FCFS, SJF, Priority, Round Robin etc. In
this paper, the results of the existing algorithms (FCFS, SJF, Priority and Round Robin) are compared with the proposed
algorithm.
Keyword: Operating System, uni-processor, uni programming, multi-programming, Resource utilization, Scheduling,
FCFS, SJF, Priority, Round Robin, ERR etc.
I. INTRODUCTION
Operating system performs variety of tasks in which scheduling is one of the basic task. Scheduling is heart of any
computer system since it contains decision of giving resources between possible processes. Sharing of computer resources
between multiple processes is also called scheduling [1]. Process is a smallest work unit of a program which requires a set of
resources for its execution that are allocated to it by the CPU. These processes are many in number and keep coming in a
particular fashion, different scheduling techniques are employed that enable faster and efficient process execution thereby
reducing the waiting time faced by each process and increasing CPU utilization. A process has five basic states namely
NEW, Ready, Running, Waiting and Terminate [1] [2].
Throughout its lifetime a process migrates between various scheduling queues by different schedulers until it gets
terminated. These queues mainly contain the ready queue which contains set of processes ready for CPU response. The
second queue is the device or the I/O queue which contains all the processes that are waiting for I/O response [1]. The
operating system must select processes for scheduling from these queues in a specific manner. This selection process using a
particular scheduling technique is carried out by schedulers. Schedulers in general try to maximize the average performance
of a system according to the given criterion [3]. Scheduling algorithms are broadly classified into preemptive and non-
preemptive scheduling disciplines.
The algorithm proposed in this article is both preemptive and non-preemptive in nature and attempts to give fair
CPU execution time by focusing on average waiting time and turnaround time of a process.
This article comprises of the following sections: Section 2 presents scheduling parameters, which will decide
against which parameters the new CPU algorithm will be tested. Section 3 introduces existing scheduling algorithms.
Section 4 explains the proposed Algorithm – A Novel CPU Scheduling algorithm. Section 5 contains pseudo code of the
proposed algorithm. Section 6 explains the two basic elements that make up the simulation and provide an interactive user
interface. Section 7 presents a graphical comparison of the new algorithm with existing algorithms. Section 8 will provide
conclusion of the work.
The working procedure of A Novel Preemptive Scheduling of Preemptive and Non Preemptive algorithm is as given below:
Take the list of processes, their burst time and arrival time.
Find the condition factor F by adding arrival time and burst time of processes.
First arrange the processes, burst time, condition factor based on arrival time ascending order.
Iterate step a, b until burst time becomes zero.
a. If arrival time of first and second process are equal the arrange them based on their condition factor f.
b. Decrement the burst time and increment arrival time by 1
When burst time becomes find the waiting time and turnaround time of that process.
Average waiting time is calculated by dividing total waiting time with total number of processes.
Average turnaround time is calculated by dividing total turnaround time by total number of processes.
V. PSEUDO CODE
Initialization variables
Burst time[n] 0
Arrival time[n] 0
Numprocess[n] 0
Factor[i] 0
Turn[n] 0
Wait[n] 0
Temp 0
Current time 0
Wait time=0
www.ijmer.com 4485 | Page
International Journal of Modern Engineering Research (IJMER)
www.ijmer.com Vol.2, Issue.6, Nov-Dec. 2012 pp-4484-4490 ISSN: 2249-6645
Turn time=0
Avgwaititme=0.0
Avgturntime=0.0
Read burst time[n] and arrival time[n]
Compute factor[i] <- bursstime[i] + arrival time[i]
Screen 2 allows the user to enter the details of the processes burst time, arrival time and priority.
Screen 3 shows that a user can compare any two algorithms of his choice or he can compare all the scheduling algorithms.
Example 2: Screen 6 takes different processes burst time and arrival time and priority values
Example 3: Screen 9 takes different processes burst time and arrival time and priority values
VIII. CONCLUSION
The paper presents a new CPU scheduling algorithm called A Novel Pre-emptive and Non Pre-emptive CPU
Scheduling Algorithm. Paper also contains simulation interface and its working, which interactively takes input from the
user and compares the process set against different algorithm pairs. The result of the simulation for different process sets
using different scheduling algorithms has been presented graphically in this piece of work. The last half of the paper
provides analytical result with each set of graph. From the above graphs and results from example 1, 2 and 3, it is clear that
proposed algorithm is more efficient than FCFS, Pre-emptive Priority and Non Pre-emptive Priority, Round Robin. And also
observed that proposed algorithm gives almost equal performance like a SJF Pre-emptive and Non Pre-emptive algorithm
REFERENCES
[1] Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, “Operating System Concepts”, Sixth Edition.
[2] Milan Milenkovic, “Operating Systems Concepts and Design”, McGRAM-HILL, Computer Science Series, second edition.
[3] P. Balakrishna Prasad, “Operating Systems” Second Edition.
[4] A. Dhore “Opeating Systems”, Technical Publications.
[5] M. Dietel, “Operating Systems”, Pearson Education, Second Edition.
[6] http://en.wikipedia.org/wiki/Scheduling
[7] M Gary Nutt, “Operating systems – A Modern Perspective, Second Edition, Pearson Education, 2000.