-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
1/98
Narsee Monjee Institute ofManagement Studies
A Project Report on
Multiprocessor SchedulingAlgorithm Implementation Using
Genetic Algorithms
Submitted in Partial Fulfillment of the
Requirements for the Degree of
Bachelor of Technology
Authors:
Tanmaya MahapatraParth BhalaniSamarth Mittal
Supervisor:
Dr. Nitin S.Choubey
April 30, 2012Department of Computer Science,
Mukesh Patel School of Technology Management &
Engineering, NMiMS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
2/98
Certificate
This is to certify that the project titled Multiprocessor Scheduling Im-plementation Using Genetic Algorithms is conducted and submitted
for Trimester XII of Bachelor of Technology (Computer Engineering) asthe partial fulfilment submission for the said degree by
Parth Bhalani (SETSHR080000045)Samarth Mittal (SETSHR080000051)
Tanmaya Mahapatra (SETSHR080000253)
(Project Guide) (Head of Dept.)Dr. N. S. Choubey Dr. N. S. Choubey
(Internal Examiner) (External Examiner)
-(Associate Dean)
Dr. M.V. Deshpande
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
3/98
Declaration by Authors
We hereby declare that the Project report entitled Multiprocessor Schedul-
ing Implementation Using Genetic Algorithms is an original work.
The contents of the project report have not been published before and re-
flect the work done by us during our academic year 2011-12 at Department
of Computer Engineering, MPSTME, NMiMS, Shirpur. Borrowed ideas,
graphics & quotations have been duly acknowledged.
Place :
Authors
Date :
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
4/98
Acknowledgment
FirstlyWe would like to invoke the blessings of the Almighty without whose
permission nothing is permissible in this world. We would like to express our
sincere gratitude from the very inner core of our heart to Dr. Tapan Bagchi,
Director, NMIMS Shipur Campus for providing us with positive criticism
throughout the work which played a pivotal role in successful completion
of this project. We would like to thank Dr. Nitin S. Choubey, Associate
Professor & HOD (CS), our project guide whose words became our sole
source of inspiration to complete the project in time. His constant encour-
agement, positive criticism helped us to progress in the right direction. We
are extremely indebted to him for instilling in us the level of confidence and
showing what perseverance actually means. We would also like express our
in-debt gratitude to Dr. M.V.Despandewho made us feel that we were not
alone at any stage of our work. Last but not the least we are also grateful
to all faculty members of the Department of Computer Science and Engi-
neering for their guidance and suggestions which ultimately culminated in
the form of this finished project.
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
5/98
Abstract
In case of multiprogramming environment we can easily conclude that there
are a number of processes or threads that compete for the resources or
aptly for the CPU concurrently. There may be a number of processes in
the READY state. The scheduler is responsible in deciding which process
to run next. It makes use of complex algorithms to make the toughest
decision. These algorithms called as Scheduling Algorithms have their own
limitations because presence of real time information may at times render
the decision made earlier useless. The traditional way of designing a complex
Scheduling Algorithm to deal with complex real time issues does not suffice.
Since in a sense natural evolution is a process of continuous adaptation,
it seems appropriate to consider Genetic Algorithms as good candidates
for dynamic scheduling problems. We here make an attempt to study the
different scheduling algorithms present, analyze their performance as well as
their limitations and devise a scheduling algorithm based on GA to address
these dynamic issues.
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
6/98
Contents
Page
List of Figures v
List of Tables vii
List of Listings viii
List of Algorithms ix
List of Abbreviations x
1 Operating Systems 21.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.1 Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.2 Networking . . . . . . . . . . . . . . . . . . . . . . . . 41.2.3 Security . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2.4 User Interface. . . . . . . . . . . . . . . . . . . . . . . 4
2 Process Scheduling 52.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1 Process Execution . . . . . . . . . . . . . . . . . . . . 62.2 Process Scheduling Algorithms . . . . . . . . . . . . . . . . . 7
2.2.1 FCFS Scheduling . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 Round Robin Scheduling . . . . . . . . . . . . . . . . 72.2.3 Priority Scheduling. . . . . . . . . . . . . . . . . . . . 82.2.4 SJN Scheduling . . . . . . . . . . . . . . . . . . . . . . 82.2.5 Lottery Scheduling . . . . . . . . . . . . . . . . . . . . 8
3 Genetic Algorithms 93.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Candidate Solution & Chromosome. . . . . . . . . . . . . . . 10
3.2.1 Chromosome . . . . . . . . . . . . . . . . . . . . . . . 103.3 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
ii
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
7/98
3.3.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.2 Selection . . . . . . . . . . . . . . . . . . . . . . . . . 123.3.3 Reproduction . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3.1 Crossover . . . . . . . . . . . . . . . . . . . . 123.3.3.1.1 Methods of selection of chromosomes
for crossover . . . . . . . . . . . . . 133.3.3.1.2 Crossover Techniques . . . . . . . . 13
3.3.3.2 Mutation . . . . . . . . . . . . . . . . . . . . 153.3.4 Termination. . . . . . . . . . . . . . . . . . . . . . . . 16
3.4 Criticism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4 Literature Survey 19
5 Process Scheduling Using GA 315.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . 315.2 Problem Description . . . . . . . . . . . . . . . . . . . . . . . 32
5.2.1 Assumption for Process Scheduling Problem. . . . . . 335.3 GA Based Algorithm . . . . . . . . . . . . . . . . . . . . . . . 33
5.3.1 Genotype . . . . . . . . . . . . . . . . . . . . . . . . . 335.3.2 Initial Population. . . . . . . . . . . . . . . . . . . . . 345.3.3 Fitness Function . . . . . . . . . . . . . . . . . . . . . 345.3.4 Selection . . . . . . . . . . . . . . . . . . . . . . . . . 345.3.5 Crossover . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.3.6 Inversion . . . . . . . . . . . . . . . . . . . . . . . . . 355.3.7 Replacement Strategy . . . . . . . . . . . . . . . . . . 355.3.8 Termination Condition. . . . . . . . . . . . . . . . . . 36
6 Software Engineering Aspects 386.1 System Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . 396.1.1.1 Functional Requirements . . . . . . . . . . . 396.1.1.2 Non-Functional Requirements . . . . . . . . 39
6.1.2 Analysis Diagrams . . . . . . . . . . . . . . . . . . . . 406.1.3 Architecture . . . . . . . . . . . . . . . . . . . . . . . 40
6.2 Hardware & Software Requirements . . . . . . . . . . . . . . 426.3 Development Plaftorm . . . . . . . . . . . . . . . . . . . . . . 42
6.3.1 Tools Used . . . . . . . . . . . . . . . . . . . . . . . . 426.4 Project Management . . . . . . . . . . . . . . . . . . . . . . . 43
6.4.1 Software Life Cycle. . . . . . . . . . . . . . . . . . . . 436.4.2 Process Model . . . . . . . . . . . . . . . . . . . . . . 436.4.3 Team Members Contribution . . . . . . . . . . . . . . 44
6.4.3.1 Parth Bhalani . . . . . . . . . . . . . . . . . 446.4.3.2 Samarth Mittal . . . . . . . . . . . . . . . . 446.4.3.3 Tanmaya Mahapatra . . . . . . . . . . . . . 44
iii
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
8/98
6.4.4 Project Schedule . . . . . . . . . . . . . . . . . . . . . 44
7 Project Implementation 467.1 Implemented Modules . . . . . . . . . . . . . . . . . . . . . . 46
7.1.1 Main. . . . . . . . . . . . . . . . . . . . . . . . . . . . 477.1.2 Application . . . . . . . . . . . . . . . . . . . . . . . . 477.1.3 Applog . . . . . . . . . . . . . . . . . . . . . . . . . . 477.1.4 File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 497.1.5 Error Handler. . . . . . . . . . . . . . . . . . . . . . . 497.1.6 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . 507.1.7 FCFS . . . . . . . . . . . . . . . . . . . . . . . . . . . 517.1.8 Round Robin . . . . . . . . . . . . . . . . . . . . . . . 51
7.1.9 SJN . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527.1.10 Genetic . . . . . . . . . . . . . . . . . . . . . . . . . . 52
8 Testing & Deployment 538.1 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538.2 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9 Simulation Results 589.1 Static Process Pool . . . . . . . . . . . . . . . . . . . . . . . . 589.2 Dynamic Process Pool . . . . . . . . . . . . . . . . . . . . . . 60
9.2.1 Graphs Explanation . . . . . . . . . . . . . . . . . . . 60
10 Concluding Remarks 7510.1 Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
References 76
A Computational complexity 79A.1 P Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . 79A.2 NP Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . 80A.3 NP - Complete . . . . . . . . . . . . . . . . . . . . . . . . . . 81A.4 NP - Hard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Index 83
iv
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
9/98
List of Figures
1.1 Role of Operating System . . . . . . . . . . . . . . . . . . . . 3
2.1 Scheduling Classification . . . . . . . . . . . . . . . . . . . . . 6
3.1 Demonstration of Candidate Solution. . . . . . . . . . . . . . 113.2 One-point Crossover . . . . . . . . . . . . . . . . . . . . . . . 143.3 Two-point Crossover . . . . . . . . . . . . . . . . . . . . . . . 143.4 Cut and Splice . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5 Three Parent Crossover . . . . . . . . . . . . . . . . . . . . . 15
5.1 Demonstration of Crossover . . . . . . . . . . . . . . . . . . . 355.2 Demonstration of Inversion . . . . . . . . . . . . . . . . . . . 36
6.1 Activity Diagram . . . . . . . . . . . . . . . . . . . . . . . . . 406.2 State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 416.3 Gantt Chart for Project . . . . . . . . . . . . . . . . . . . . . 45
8.1 Application Deployment . . . . . . . . . . . . . . . . . . . . . 55
9.1 Static Pool - Process Arrival Pattern . . . . . . . . . . . . . . 639.2 Static Pool - Process Arrival Pattern(log) . . . . . . . . . . . 639.3 Static Pool - Average Wait Time . . . . . . . . . . . . . . . . 649.4 Static Pool - Average Turn Time . . . . . . . . . . . . . . . . 649.5 Process Arrival Pattern - 1st Iteration . . . . . . . . . . . . . 65
9.6 Process Arrival Pattern(log) - 1
st
Iteration. . . . . . . . . . . 659.7 Average Wait Time - 1st Iteration . . . . . . . . . . . . . . . 669.8 Average Turn Time - 1st Iteration . . . . . . . . . . . . . . . 669.9 Process Arrival Pattern - 2nd Iteration . . . . . . . . . . . . . 679.10 Process Arrival Pattern(log) - 2nd Iteration . . . . . . . . . . 679.11 Average Wait Time - 2nd Iteration . . . . . . . . . . . . . . . 689.12 Average Turn Time - 2nd Iteration . . . . . . . . . . . . . . . 689.13 Process Arrival Pattern - 3rd Iteration . . . . . . . . . . . . . 699.14 Process Arrival Pattern(log) - 3rd Iteration . . . . . . . . . . 699.15 Average Wait Time - 3rd Iteration . . . . . . . . . . . . . . . 70
v
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
10/98
9.16 Average Turn Time - 3rd Iteration . . . . . . . . . . . . . . . 70
9.17 Process Arrival Pattern - 4th Iteration . . . . . . . . . . . . . 719.18 Process Arrival Pattern(log) - 4th Iteration . . . . . . . . . . 719.19 Average Wait Time - 4th Iteration . . . . . . . . . . . . . . . 729.20 Average Turn Time - 4th Iteration . . . . . . . . . . . . . . . 729.21 Process Arrival Pattern - 5th Iteration . . . . . . . . . . . . . 739.22 Process Arrival Pattern(log) - 5th Iteration . . . . . . . . . . 739.23 Average Wait Time - 5th Iteration . . . . . . . . . . . . . . . 749.24 Average Turn Time 5th Iteration . . . . . . . . . . . . . . . . 74
A.1 Euler Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 81
vi
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
11/98
List of Tables
4.1 Survey of Previous Work Done . . . . . . . . . . . . . . . . . 20
8.1 Test Cases for Application Developed . . . . . . . . . . . . . 56
9.1 Average Wait & Turn time - Static pool . . . . . . . . . . . . 599.2 Average Waiting Time - Dynamic Pool. . . . . . . . . . . . . 619.3 Average Turn Time - Dynamic Pool . . . . . . . . . . . . . . 62
vii
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
12/98
Listings
7.1 Applog Module Implementation. . . . . . . . . . . . . . . . . 487.2 Error Handler Module Implementation . . . . . . . . . . . . . 497.3 partial Scheduling Module Implementation. . . . . . . . . . . 50
viii
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
13/98
List of Algorithms
3.1 Genetic Algorithm Procedure . . . . . . . . . . . . . . . . . . 165.1 Genetic Algorithm - Process Scheduling . . . . . . . . . . . . 36
ix
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
14/98
List of Abbreviations
CP U Central Processing Unit
EA Evolutionary Algorithms
EC Evolutionary Computation
EP S Encapsulated PostScript
F C F S First Come First Serve
GA Genetic Algorithms
GN U GNUs NOT UNIX
I/O Input/Output
IP C Inter-process Communication
N P Non-Deterministic Polynomial-Time Hard
OS Operating System
P DF Portable Document Format
P N G Portable Network Graphics
P S PostScript
SJ N Shortest Job NextT P S Transactions Processed per Second
x
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
15/98
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
16/98
CHAPTER 1
Operating Systems
Computers are good atfollowing instructions, but not atreading your mind.
Donald Knuth
This chapter briefly introduces to Operating Systems and its variouscomponents. A brief knowledge of Operating Systems is needed to grasp the
fundamentals ofprocess schedulingwhich in turn would help to understandthe implemented project.
SECTION 1.1
Introduction
An Operating System is a special software that entirely manages the com-puters hardware resources and provides services needed by application soft-ware to run successfully. Every program like OpenOffice or amaroK to run ina system requires some memory and may also have additional requirements.The main job of the operating system is to provide resources needed for these
applications to run which includes but not necessarily limited to memoryallocation. It often acts as an intermediary in handling the hardware. Forexample we have a document in post script format which we need to printusing a printer attached to a system. Considering that the printer attachedis a simple hardware which never understands any human languages usedin the world. So here the main job of the OS is to help in running a specialapplication software that translates this post script document into a formatunderstandable by the printer and asks the printer to take a print i.e. a
2
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
17/98
CHAPTER 1. OPERATING SYSTEMS 3
User
Application
Operating System
Hardware
Figure 1.1: Role of an Operating System
hard copy of the document. Basic role of an operating System is depictedin Figure1.1
SECTION 1.2
Components
An operating System has many different components which work together ina co-ordinated manner to achieve the desire functionality. All applicationsneed to go through the OS in order to use the hardware.
1.2.1
Kernel
It is the core of an Operating System. It is a bridge between applicationsand the actual data processing done at the hardware level. The kernelsresponsibilities include managing the systems resources (the communicationbetween hardware and software components). A kernel can provide thelowest-level abstraction layer for the resources (especially processors andI/O devices) that application software must control to perform its function.It typically makes these facilities available to application processes throughinter-process communication mechanisms and system calls[3].
1.2. COMPONENTS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
18/98
CHAPTER 1. OPERATING SYSTEMS 4
1.2.2
NetworkingCurrently most operating systems support a variety of networking protocols,hardware, and applications for using them. This means that computersrunning dissimilar operating systems can participate in a common networkfor sharing resources such as computing, files, printers, and scanners usingeither wired or wireless connections[3].
1.2.3
Security
A computer being secure depends on a number of technologies working prop-
erly. A modern operating system provides access to a number of resources,which are available to software running on the system, and to external de-vices like networksvia the kernel. The operating system must be capableof distinguishing between requests which should be allowed to be processed,and others which should not be processed. While some systems may simplydistinguish between privileged and non-privileged, systems commonlyhave a form of requester identity, such as a user name. To establish iden-tity there may be a process of authentication. Often a user name must bequoted, and each user name may have a password[3].
1.2.4
User Interface
Every computer that is to be operated by an individual requires a userinterface. The user interface is not actually a part of the operating system.It generally runs in a separate program usually referred to as a shell1, butis essential if human interaction is to be supported [3]
1A shell is a piece of software that provides an interface for users of an operating systemwhich provides access to the services of a kernel.
1.2. COMPONENTS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
19/98
CHAPTER 2
Process Scheduling
Most of you are familiar withthe virtues of a programmer.There are three, of course:laziness, impatience, andhubris.
Larry Wall
This Chapter briefly describes Process Scheduling and various traditional
algorithms generally used for scheduling. Also enlisted are various criteriaunder which a scheduling decision is taken. The sources of information havealso been indicated wherever appropriate.
SECTION 2.1
Introduction
Scheduling is making the choice of which process to run next when thereare a number of processes in the READY state [27]. This is one of thescenarios frequently encountered in case of multiprogrammed environments.
A number of processes or threads compete for the CPU concurrently. Allscheduling problem are NP hard. The scheduling jobs have been broadlyclassified as either static or dynamic. See Figure 2.1
Static : The scheduling is said to be static when all the jobs are knownbefore the processing starts.
Dynamic : In this scenario then job release times are not fixed andjobs arrive at different times.
5
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
20/98
CHAPTER 2. PROCESS SCHEDULING 6
Scheduling
Static Dynamic
Figure 2.1: Scheduling Classification
If all jobs are known before processing starts a scheduling problem is
said to be static, while, to classify a problem as dynamicit is sufficient thatjob release times are not fixed at a single point in time, i.e. jobs arrive tothe system at different times. Scheduling problems can also be classifiedas either deterministic, when processing times and all other parameters areknown and fixed, or as non-deterministic, when some or all parameters areuncertain [12].
2.1.1
Process Execution
In the case ofbatch processing systemsthe scheduling process was relatively
straight forward. The scheduling algorithm just needed to run the next job.But this is not the case with modern multiprogrammed environments. Eventoday the type and nature of scheduling needed varies depending on theusage of system. Consider a case of a home user starting simultaneouslya word processor and a music player, the scheduling of the processes donot matter very much because the end user is waiting for both the tasks tofinish. But the situation changes dramatically when we consider a server.In this case there are multiple processes competing for the CPU. Resourcesare limited and scheduling decides whether to choose an important processor an unimportant one. CPU scheduling decisions may take under one ofthe following circumstances[23]:
When a process goes from the running state to the wait state.
When a process goes from the running state to the ready state.
When a process goes from the wait state to the ready state.
When a process terminates.
2.1. INTRODUCTION
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
21/98
CHAPTER 2. PROCESS SCHEDULING 7
SECTION 2.2
Process Scheduling Algorithms
The concept of scheduling stands valid only when a process terminates or itswitches from the running state to the wait state. The scheduling schemecan again be categorized as either preemptive or non-preemptive. Undernon-preemptive scheduling, once the CPU has been allocated to a process,the process keeps the CPU until it releases the CPU either by terminatingor switching to the waiting state [23]. But in case of preemptive the CPUcan be snatched away from the process and may be allocated to anotherprocess depending on :
Expiration of time Quantum.
Interrupts.
High Priority jobs.
2.2.1
FCFS Scheduling
This is the simplest of all the CPU scheduling algorithms [23]. The processrequesting for the CPU first is granted the CPU first irrespective of allother conditions or criteria. When a process is currently using the processor
other jobs may arrive which are stored in a FIFO queue. When the processfinishes the dispatcher simply selects the process first in the FIFO queueand allocates it the CPU. There are certain shortcomings in this type ofscheduling like a small process may have to wait for a very longer period oftime till one large job finishes. This effect is termed as Convoy effect.
2.2.2
Round Robin Scheduling
The Round-Robin scheduling algorithm is designed especially for time shar-ing systems. It is similar to FCFS scheduling but preemption is added to
switch between processes. A small unit of time, called a time quantum ortime slice is defined [23]. Basically the process is allocated the CPU for thedefined time quantum, After the expiry of the timer a process switch takesplace where by the CPU is allocated to the next process in the queue. Theready queue used for storing the processes or jobs arriving at different timeinstances is basically a FIFO queue.
2.2.3
2.2. PROCESS SCHEDULING ALGORITHMS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
22/98
CHAPTER 2. PROCESS SCHEDULING 8
Priority Scheduling
In round robin we implicitly assume that all processes are equal but heretaking external factors into account we give priorities to the processes takingexternal factors into account. A single user PC also has many processes,some are more important than others, so we need to arrange them accordingto various priorities.
2.2.4
SJN Scheduling
This algorithm associates with each process the length of the processs nextCPU burst. When the CPU is available, it is assigned to the process that the
smallest next CPU burst[23]. This reduces the average waiting time of theprocesses and eradicates the Convoy effect as seen in the FCFS schedulingalgorithm. But there may be circumstances where we encounter two ormore processes with exactly the same CPU burst time. In such cases FCFSscheme is often used to decide which process should be allocated the CPUfirst.
2.2.5
Lottery Scheduling
In this the basic idea is to give lottery tickets for various resources like CPU
time, to various processes. Whenever, scheduling has to be done, a lotteryticket has to be chosen at random and the process holding that ticket getsthe resource.
2.2. PROCESS SCHEDULING ALGORITHMS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
23/98
CHAPTER 3
Genetic Algorithms
The trouble with programmersis that you can never tell what aprogrammer is doing until itstoo late.
Seymour Cray
This chapter basically discusses the basic aspects ofGenetic Algorithmswhich we have studied and this further helped to successfully design ascheduling algorithm using GA. The sources of information have also beenindicated wherever appropriate.
SECTION 3.1
Introduction
Genetic Algorithms are a class of heuristic algorithms which operate in afashion quite similar to natural evolution. These algorithms were first pro-posed by Holland in 1975. In Genetic Algorithms there is no unique way ofsolving a particular problem. It can be applied in many fields. Initially the
solution space contains some solutions generated in any way possible. Butwhen the algorithm iterates it keeps on generating more solutions and keepsthe optimum results while discarding the less optimum solution space. Itcan be viewed as a sequence of permutation and combination. It belongs tothe larger class of EA1. It generates solutions to various optimization prob-lems involving a number of methods which essentially mimic the biologicalevolution process. Some of the methods are :
1An evolutionary algorithm (EA) is a subset of evolutionary computation, a genericpopulation-based meta-heuristic optimization algorithm
9
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
24/98
CHAPTER 3. GENETIC ALGORITHMS 10
Inheritance
Mutation
Crossover
Selection
Before discussing the general methodology involved in Genetic Algo-rithms we would be first discussing about Candidate Solutions & Chromo-somes. That would be quite illuminating for understanding the underlyingmechanism.
SECTION 3.2
Candidate Solution & Chromosome
In optimization , a candidate solution is a member of a set of possible solu-tions to a given problem. A candidate solution need not be the most optimalor reasonable solution to the problem - it is simply in the set that satisfies allconstraints. The space of all candidate solutions is called the feasible region,
feasible set, search space, or solution space. In the case of the genetic algo-rithm, the candidate solutions are the individuals in the population beingevolved by the algorithm [1]. Feasible region is shown in Figure 3.1
3.2.1
Chromosome
In genetic algorithms, a chromosome2 is a set of parameters which definea proposed solution to the problem that the genetic algorithm is trying tosolve. The chromosome is often represented as a simple string, althougha wide variety of other data structures are also used [3]. For chromosomedesign refer to Example 3.2.1.
Example 3.2.1. In the travelling salesman problem, we seek an ordered listof cities that results in the shortest trip for the salesman to travel. Supposethere are six cities, which well call A, B, C, D, E, and F. A good design
for our chromosome might be the ordered list we want to try. An examplechromosome we might encounter in the population might be DFABEC [3].
2Also called as a genome
3.2. CANDIDATE SOLUTION & CHROMOSOME
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
25/98
CHAPTER 3. GENETIC ALGORITHMS 11
Figure 3.1: A series of linear programming constraints on twovariables produces a region of possible values for those
variables. Solvable problems will have a feasible region inthe shape of a simple polygon [1].
SECTION 3.3
Methodology
In Genetic Algorithms the chromosomes which have an initial solution evolvein a manner similar to biological evolution and give finer optimal results. Inother words they encode candidate solutions. The solutions can be encodedusing simple 1s and 0s but various other encoding schemes have also been
used. The generation starts with a random candidate solution and iterates.After every generation the fitness of every individual in the population iscalculated. Multiple individuals are selected based on their fitness and mu-tated to form new population. This new population so formed is used in thenext generation. The algorithm iterates in this fashion till a predefined num-ber of iterations is attained or a satisfactory fitness level has been achieved.The fitness level is computed using a fitness function3. A Genetic algorithmbasically requires :
Genetic Representation 4 of the Problem Domain.
A Fitness Function.
3.3.1
Initialization
Initially many individual solutions are randomly generated to form an initialpopulation. The population size depends on the nature of the problem, but
3A fitness function is a particular type of objective function that is used to summarize,as a single figure of merit, how close a given design solution is to achieving the set aims.
4Genetic representation is a way of representing solutions/individuals in evolutionarycomputation methods.
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
26/98
CHAPTER 3. GENETIC ALGORITHMS 12
typically contains several hundreds or thousands of possible solutions. Tra-ditionally, the population is generated randomly, allowing the entire rangeof possible solutions (the search space).
3.3.2
Selection
During each successive generation, a proportion of the existing population isselected to breed a new generation. Individual solutions are selected througha fitness-based process, where fitter solutions (as measured by a fitness func-tion) are typically more likely to be selected. Certain selection methods ratethe fitness of each solution and preferentially select the best solutions. Othermethods rate only a random sample of the population, as the latter processmay be very time-consuming.
3.3.3
Reproduction
The next step is to generate a second generation population of solutionsfrom those selected through genetic operators:crossover5 and/ormutation.
For each new solution to be produced, a pair of parent solutions isselected for breeding from the pool selected previously. By producing achild solution using the above methods of crossover and mutation, a newsolution is created which typically shares many of the characteristics of itsparents. New parents are selected for each new child, and the processcontinues until a new population of solutions of appropriate size is generated.Although reproduction methods that are based on the use of two parentsare more biology inspired, some research[28][11] suggests that more thantwo parents generate higher quality chromosomes. Although Crossoverand Mutation are known as the main genetic operators, it is possible to useother operators such as regrouping, colonization-extinction, or migration ingenetic algorithms[4].
3.3.3.1 Crossover
Crossoveris a genetic operator used to vary the programming of a chro-mosome or chromosomes from one generation to the next. It is very similarto reproduction and biological crossover, upon which genetic algorithms arebased. Cross over is a process of taking more than one parent solutionsand producing a child solution from them. The methods for selection of thechromosomes are :
5Also called recombination
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
27/98
CHAPTER 3. GENETIC ALGORITHMS 13
3.3.3.1.1 Methods of selection of chromosomes for crossover
Roulette wheel selection The simplest selection scheme isroulette-wheel selection6 The individuals are mapped to contiguous segments of aline, such that each individuals segment is equal in size to its fitness. Arandom number is generated and the individual whose segment spans therandom number is selected. The process is repeated until the desired numberof individuals is obtained (called mating population). This technique isanalogous to a roulette wheel with each slice proportional in size to thefitness [7].
3.3.3.1.2 Crossover Techniques
The widely used crossover techniques have been discussed below.
One-point crossover A single crossover point on both parents organ-ism strings is selected. All data beyond that point in either organism stringis swapped between the two parent organisms. The resulting organisms arethe children. Refer to Figure 3.2
Two-point crossover Two-pointcrossover calls for two points to beselected on the parent organism strings. Everything between the two pointsis swapped between the parent organisms, rendering two child organisms.Refer to Figure 3.3
Cut and splice In the cut and splice approach, there is a change inlength of the children strings. The reason for this difference is that eachparent string has a separate choice of crossover point. Refer to Figure 3.4
Uniform Crossover and Half Uniform Crossover The UniformCrossoveruses a fixed mixing ratio between two parents. Unlike one andtwo point crossover, the Uniform Crossover enables the parent chromosomesto contribute the gene level rather than the segment level.
Three parent crossover In this technique, the child is derived fromthree parents. They are randomly chosen. Each bit of first parent is checkedwith bit of second parent whether they are same. If same then the bit istaken for the offspring otherwise the bit from the third parent is taken forthe offspring. For example refer to Figure 3.5
6Also called as stochastic sampling with replacement.
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
28/98
CHAPTER 3. GENETIC ALGORITHMS 14
Figure 3.2: One-point Crossover [3]
Figure 3.3: Two-point Crossover [3]
Figure 3.4: Cut and Splice [3]
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
29/98
CHAPTER 3. GENETIC ALGORITHMS 15
Figure 3.5: Three Parent Crossover [26]
3.3.3.2 Mutation
Mutation is a genetic operator used to maintain genetic diversity fromone generation of a population of algorithm chromosomes to the next. It isanalogous to biological mutation. Mutation alters one or more gene valuesin a chromosome from its initial state. In mutation, the solution may changeentirely from the previous solution. Hence GA can come to better solutionby using mutation. Mutation occurs during evolution according to a user-definable mutation probability. This probability should be set low. If it is
set to high, the search will turn into a primitive random search.
Bit string mutation The mutation of bit strings ensue through bitflips at random positions. The probability of a mutation of a bit is 1
l, where
l is the length of the binary vector.
Flip Bit This mutation operator takes the chosen genome and invertsthe bits7.
Boundary This mutation operator replaces the genome with eitherlower or upper bound randomly. This can be used for integer and float
genes.
Uniform This operator replaces the value of the chosen gene with auniform random value selected between the user-specified upper and lowerbounds for that gene. This mutation operator can only be used for integerand float genes.
7If the genome bit is 1,it is changed to 0 and vice versa
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
30/98
CHAPTER 3. GENETIC ALGORITHMS 16
Non-Uniform The probability that amount of mutation will go to 0with the next generation is increased by using non-uniform mutation op-erator. It keeps the population from stagnating in the early stages of theevolution.It tunes solution in later stages of evolution. This mutation oper-ator can only be used for integer and float genes.
3.3.4
Termination
The generational process is repeated until a termination condition has beenreached. Common terminating conditions are:
A solution is found that satisfies minimum criteria.
Fixed number of generations reached.
Allocated budget (computation time/money) reached.
The highest ranking solutions fitness is reaching or has reached aplateau such that successive iterations no longer produce better results.
Manual inspection or combinations of the above.
For General GA algorithm and Pseudo-code refer to Algorithm 3.1andPseudo-Code 1 respectively.
Algorithm 3.1 Simple Genetic Algorithm procedure
1. Choose the initial population of individuals.
2. Evaluate the fitness of each individual in that population.
3. Repeat on this generation until termination (time limit, sufficient fit-ness achieved, etc.):
(a) Select the best-fit individuals for reproduction.
(b) Breed new individuals through crossover and mutation operationsto give birth to offspring.
(c) Evaluate the individual fitness of new individuals.
(d) Replace least-fit population with new individuals
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
31/98
CHAPTER 3. GENETIC ALGORITHMS 17
PSeudo-Code 1 General GA Pseudo-codeM ax individuals
pop= pop[M ax] Choose the initial population of individualsf it= f it[M ax]counter 0for all pop do Evaluate the fitness of each individual
fitness(pop[counter])
counter counter+ 1end forwhile term=true do
counter 0for all pop do Select the Best Fit
bfpop best fit(pop[counter])counter counter+ 1
end forcrossover(bfpop) Breed new individuals - Crossovermutation(bfpop) Breed new individuals - Mutationcounter 0
for all bfpop do Evaluate the fitness of each individualf it[counter] fitness(bfpop[counter])counter counter+ 1
end forfor all bfpop do Replace least-fit population
if f it[counter]> f itness level thenpop[counter] bfpop[counter]counter counter+ 1
elsecounter counter+ 1continue
end ifend for
end while
3.3. METHODOLOGY
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
32/98
CHAPTER 3. GENETIC ALGORITHMS 18
SECTION 3.4
Criticism
There are several criticisms of the use of a genetic algorithm compared toalternative optimization algorithms. Some of them are :
In many problems, GAs may have a tendency to converge towardslocal optima or even arbitrary points rather than the global optimumof the problem.
The better solution is only in comparison to other solutions. As aresult, the stop criterion is not clear in every problem.
Genetic algorithms do not scale well with complexity. That is, wherethe number of elements which are exposed to mutation is large thereis often an exponential increase in search space size. This makes itextremely difficult to use the technique on problems such as designingan engine, a house or plane. In order to make such problems tractableto evolutionary search, they must be broken down into the simplestrepresentation possible[26].
Operating on dynamic data sets is difficult, as genomes begin to con-verge early on towards solutions which may no longer be valid for laterdata.
GAs cannot effectively solve problems in which the only fitness mea-sure is a single right/wrong measure (like decision problems), as thereis no way to converge on the solution (no hill to climb). In these cases,a random search may find a solution as quickly as a GA [3].
3.4. CRITICISM
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
33/98
CHAPTER 4
Literature Survey
Without requirements ordesign, programming is the artof adding bugs to an empty textfile.
Louis Srygley
Genetic algorithm is one of the widely used techniques for constrain op-timization. Genetic algorithm is basically search algorithm based on naturalselection and natural genetics. This chapter briefly describes the literaturesurvey done of previous work done in the field ofCPU Process Schedulingusing Genetic Algorithm.This literature survey is a table of text that aimsto review the critical points of current knowledge including substantive find-ings as well as theoretical and methodological contributions to our. It doesnot report any new or original experimental work. Basing on the ideas col-lected from the table given in the next page we make our proposal in thenext chapter. For Literature Survey refer to Table 4.1and for proposal ofthe work to be done refer to Chapter 5.
19
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
34/98
Table 4.1: Survey of Previous Work Done in ProcessScheduling using Genetic Algorithms.
S/L No. Paper Details Work Done
1. Title : A Modified Genetic Algo-rithm for Process Scheduling in Dis-tributed SystemAuthors : Vinay Harsora &Apurva Shah
Contributions
Scheduling in distributed operatsignificant role in overall systemthroughput[14].
They have presented and evaluatedrithm based method to solve thisthat simultaneously minimizes sch
maximize average processor utiliza
It also minimizes the computationgorithm.
Limitations
Most of the existing solutions tendof the objectives but they have simwith all the three[14].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
35/98
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
36/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
3. Title : Genetic Algorithm approachto Operating system process schedul-ing problemAuthors : Dr. Rakesh Kumar,Er. Rajiv Kumar, Er. Sanjeev Gill& Er. Ashwani Kaushik
Contributions
In this paper , they use the power oto provide the efficient process sche
The aim is to obtain an efficient scand schedule the process to CPU[
Limitations
The work can be extended so thaimplemented for dynamic process quencing.
The performance can also increaseoperator on this problem[17].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
37/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
4. Title : Using Genetic Algorithmsfor Dynamic SchedulingAuthors : Ana Madureira, CarlosRamos & Silvio do Carmo Silva
Contributions
Deals with Dynamic nature of Sche
Uses Genetic Algorithm to Solve th
Has used vertical oriented EJSSP f
Limitations
No benchmark performed with otheologies.
None of the existing works has eEJSSP.
It is difficult to find test problems results for dynamic environments [
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
38/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
5. Title : A Novel Genetic Algorithmfor Static Task Scheduling in Dis-tributed SystemsAuthors : Amir Masoud Rahmani& Mojtaba Rezvani
Contributions
In this paper, a new genetic TDGASA, is presented which its ruon the number of tasks in the sched
Then, the computation time of TDGoptimal schedule is improved by Si(SA) [21].
Limitations
There is a tradeoff between the comthe total completion time. But witof simulated annealing, the compualgorithm decreases more, althougpletion time is not increased [21].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
39/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
6. Title : Genetic algorithm Approachfor Optimal CPU SchedulingAuthors : Preeti Sindhwani &Vaishali Wadhwa
Contributions
This Paper contains how we can usin finding an innovative solution fo
Using an efficient encoding, and decrossover and mutation operators foachieve this.
The algorithm requires a populatio
Limitations
The work can be extended so thaimplemented for dynamic process quencing.
The performance can also increaseoperator on this problem[24].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
40/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
7. Title : A Performance Study ofGA and LSH in Multiprocessor JobSchedulingAuthors : Mrs. S. R. Vijayalak-shmi & Dr. G. Padmavathi
Contributions
This paper proposes a comparison gorithm and list scheduling algorit
Both algorithms are naturally paraheavy data dependencies.
Based on experimental results, thdetailed analysis of the scalability, aadvantages of each algorithm.
Limitations
This paper compares scheduling alprocessor task scheduling [29].
It concludes that from a purely peview, Genetic algorithm is the bedeployment needs to be subject of aanalysis [29].
It concludes that list scheduling wthe less number of tasks and proces
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
41/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
8. Title : Dynamic Task SchedulingUsing Parallel Genetic AlgorithmsFor Heterogeneous DistributedComputingAuthors : R.Nedunchelian,K. Koushik, N. Meiyappan &V. Raghu
Contributions
A parallel genetic algorithm has dynamically schedule heterogeneogeneous processors in a distributed
The proposed algorithm uses multicentralized control for scheduling.
Limitations
The Algorithm can be extended.
The proposed algorithm uses a straing scheme and generates a randomlation[19].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
42/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
9. Title : A Novel Adaptive NeuroFuzzy Inference System Based CPUScheduler for Multimedia OperatingSystemAuthors : Mohammad Atique &Mir Sadique Ali
Contributions
Proposed a novel CPU Scheduler Neuro Fuzzy Inference System (Athe execution of multimedia appliconventional applications in multimtem.
A simulator is developed in MATLperformance of the proposed sche
against the existing algorithms[6]. It is demonstrated that, the propos
to optimize various CPU schedulingas resource utilization.
Limitations
Future scope of the work includeartificial neural network model foring [6].
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
43/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
10. Title : Scheduling in Multipro-cessor System Using Genetic Algo-rithmsAuthors : Edwin H. S. Hou, Nir-wani Ansari & Hong Ren
Contributions
This paper investigates dynamic time tasks in a multiprocessor sfeasible solution using genetic algwith well-known heuristics, such asFirst and Shortest Computation T
A comparative study of the results ulations shows that genetic algorit
schedule tasks to meet deadlines,high processor utilization.
Limitations
Employment Processing techniquecomputing domain.
Cont
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
44/98
Table 4.1 continued from previous page
S/L No. Paper Details Work Done
11. Title : A Performance Evaluationof Multiprocessor Scheduling withGenetic AlgorithmAuthors : ReaKook Hwanga, Mit-suo Gen & Hiroshi Katayama
Contributions
This paper addresses the problemscheduling represented as a directed(DAG) without communication cnected multiprocessors.
They proposed an algorithm, (Priority-based Genetic Algorithmsor First schedule) where a priorit
gorithm is improved with the intknowledge about the scheduling proresented by the use of genetic opeand mutation operators[16].
Limitations
No precise conclusions from the authat the work can be improved or tions.
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
45/98
CHAPTER 5
Process Scheduling Using GA
Most good programmers doprogramming not because theyexpect to get paid or getadulation by the public, butbecause it is fun to program.
Linus Torvalds
This chapter describes the implementation ofGenetic Algorithmfor Op-erating System process scheduling. Scheduling in Operating System has asignificant role in overall System performanceandthroughput1. An efficientscheduling is vital for System performance. The scheduling is considered as
NP hardproblem. In this chapter, we use the power of Genetic Algorithmto provide efficient process scheduling. The aim is to obtain an efficientscheduling algorithm which would schedule the processes to the CPU withminimumwaiting time2.
SECTION 5.1
Introduction
Scheduling in the operating system is a critical factor in the overall systemefficiency [20]. Process scheduling in an operating system can be stated
1It is the number of processes that complete their execution per time unit [3]. Theamount of work performed by a computer within a given time. It is a combination ofinternal processing speed, peripheral speeds (I/O) and the efficiency of the operating sys-tem, other system software and applications all working together. Transactions processedper second (TPS) is one metric commonly used to gauge throughput [2].
2It is the amount of time that a process spends waiting for the CPU in the ready queue[3].
31
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
46/98
CHAPTER 5. PROCESS SCHEDULING USING GA 32
as allocating processes to the processor so that throughput & efficiency ofthe system will be maximized. Typically scheduling problems are NP Hardproblems [9]. There is necessity to find out robust & flexible solution for thereal world scheduling problem.
Genetic Algorithmis a promising global optimization technique [13]. Itworks by emulating the natural process of evolution as a means of progress-ing towards the optimal solution. A Genetic Algorithm has the capabilityto find out the optimal job sequence which is to be allocated to the CPU.This chapter presents theGenetic Algorithmbased technique to find out theoptimal job sequence. We would be examining whether Genetic Algorithmbased scheduling will maximize the operating system performance or not.The algorithm starts with a population which consists of several solutionsto the optimization problem. A member of population is called an individ-ual. A fitness value is associated with each individual. Each solution inthe population or an individual is encoded as a string of symbols. Thesesymbols are known as genes & the solution string is called a chromosome3.The values taken by genes are called alleles4. Several pair of individuals(parents) in the population mate to produce offspring by applying the ge-netic operator - crossover. Selection of parents is done by repeated use ofa choice function. A number of individuals & off springs are passed to anew generation such that the number of individual in the new population isthe same as old population. A selection function5 determines which stringforms the population in the next generation. Each serving string undergoes
inversion6 with a specified probability.
SECTION 5.2
Problem Description
In order to schedule the process in a uni-processor as well as a multiprocessoroperating system let us suppose that there areNprocesses (1,2,3,. . . N) andthese processes have their static burst time. These processes need to beprocessed on a single CPU at a time. The aim is to find out optimal processsequence[5] by which the processes can be scheduled[8] in such a way thattotal waiting time is minimum.
5.2.1
3For More information onChromosome, refer Section3.2.14An allele is one of two or more forms of a gene.5For more information onSelection Functions, refer Section3.3.26An inversion is a chromosome rearrangement in which a segment of a chromosome is
reversed end to end. An inversion occurs when a single chromosome undergoes breakageand rearrangement within itself.
5.2. PROBLEM DESCRIPTION
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
47/98
CHAPTER 5. PROCESS SCHEDULING USING GA 33
Assumption for Process Scheduling Problem
There is a pool of ready processes waiting for the allocation of CPU.
The processes are independent and compete for the allocation of re-sources.
The job of the proposed scheduling algorithm is to distribute the re-source i.e. CPU to different processes fairly so that performance cri-teria must be optimal i.e. minimum average waiting time.
The initial population of individual solutions are randomly generated.
SECTION 5.3
GA Based Algorithm
Genetic algorithms, powerful & broadly applicable stochastic research tech-niques, are the most widely known type of evolutionary computation methodtoday. In general, a genetic algorithm has five basic components as fol-lows[15]:
An encoding method that is a genetic representation - genotype ofsolutions to the program.
A way to create an initial population of individuals - chromosome.
An evaluation function, rating solution in terms of their fitness, & aselection mechanism.
The genetic operators (crossover & inversion) that alter the geneticcomposition of offspring during reproduction.
Values for the parameter of Genetic Algorithm.
5.3.1
Genotype
In the GA based algorithms each chromosomecorresponds to a solution tothe problem. The genetic representation of the individual is calledGeno-type. Many Genotypes have been proposed in [15]. Here we represent achromosomewith the combination of five decimal numbers. Here sequenceof five decimal number is the number of jobs. E.g. (2,4,1,3,5) sequence offive jobs or processes.
5.3. GA BASED ALGORITHM
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
48/98
CHAPTER 5. PROCESS SCHEDULING USING GA 34
5.3.2
Initial PopulationA Genetic Algorithm starts with a set of individuals called initial popula-tion. Most GA based algorithms generate initial population randomly. Hereindividual solutions are randomly generated with function to form an initialpopulation. In the simulation initial population with size of POPSIZE isgenerated with function.
5.3.3
Fitness Function
The main objective of GA is to find an optimal solution. In order to find the
optimal solution a fitness function must be devised for the problem underconsideration i.e. Fit (Popcurrent). For a particular chromosome, the fitnessfunction returns a single numerical fitness, or figure of merit, which issupposed to be proportional to the utility or ability of the individualwhich that chromosome represent. Here the fitness of the individual is findout on the basis of minimum average waiting time. Those individuals whohave minimum average waiting time are the fittest as compared to other.The fittest individuals have the capability to participate in thereproductioncycle. The fitness functionof a Schedule Sj is given by Equation 5.1.
Fitness(Sj) =
N
i=1W tiN
(5.1)
where tis the job schedule; Wt1 is the waiting time of process J1, Wt2for J1 and so on. N is the total number of processes.
5.3.4
Selection
The selection process used here is based on spinning the roulette wheel,which each chromosome in the population has slot size in proportion to itsfitness. Each time we require an offspring, a simple spin of the weighted
roulette wheel gives a parent chromosome. The probability Pithat a parentSiis given by Equation 5.2.
Pi= F(Si)
POPSIZE
j=1 F(Sj)
(5.2)
Where F(Si) is the fitness of chromosome Si.
5.3. GA BASED ALGORITHM
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
49/98
CHAPTER 5. PROCESS SCHEDULING USING GA 35
5.3.5
CrossoverCrossover is generally used to exchange portions between strings. Severalcrossover operators are described in the literature [22]. Crossover is not al-ways affected; the invocation of the crossover depends on the probability ofthe crossover. Modified crossover [10] is used in this simulation. Modifiedcrossover operator is an extension of the one point crossover for permutationproblems. A cut position is chosen at random on the first parent chromo-some. Then an offspring is created by appending the second chromosome tothe initial part of the first parent(before the cut point) and eliminating theduplicates. See Figure 5.1
Figure 5.1: Demonstration of Crossover Process
5.3.6
Inversion
Inversion is a process in which the order of two gene position is swappedwith respect to each other. In inversion operator two points are selectedalong the length of the chromosome, the chromosome is cut at those pointsand the end points of the section cut, gets reversed(swapped). To make it
clear, we consider a chromosome of length 5, where two inverse points areselected randomly. See Figure 5.2
5.3.7
Replacement Strategy
When genetic operators (Modified crossover, inversion) are applied on theselected parentsS1,S2one new chromosome is generated. This chromosomeis added to the existing population. After that fitter chromosomes are se-
5.3. GA BASED ALGORITHM
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
50/98
CHAPTER 5. PROCESS SCHEDULING USING GA 36
Figure 5.2: Demonstration of Inversion Process
lected from the new population. This process continues until we do not getoptimal solution.
5.3.8
Termination Condition
There are multiple choices for termination condition: Maximum number ofgenerations, algorithm convergence, equal fitness for fittest selected chromo-somes in respective iteration. For Algorithm and Pseudo-code for the abovementioned method refer to Algorithm 5.1 & Pseudo-code 2
Algorithm 5.1 Implemented Genetic Algorithm for Process Scheduling
1. Choose the initial population of individuals.
2. Evaluate the fitness of each individual in that population.
3. Repeat on this generation until termination (sufficient fitness achievedor max generations):
(a) Selection the best-fit individuals for reproduction using Roulletewheel Selection
(b) Breed new individuals through Modified crossover to give birthto offspring.
(c) Evaluate the individual fitness of new individuals.
(d) Replace least-fit population with new individuals.
5.3. GA BASED ALGORITHM
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
51/98
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
52/98
CHAPTER 6
Software Engineering Aspects
Perfection [in design] isachieved, not when there isnothing more to add, but whenthere is nothing left to takeaway.
Antoine de Saint-Exupery
SECTION 6.1
System Analysis
Requirements analysis in systems engineering and software engineering, en-compasses those tasks that go into determining the needs or conditions tomeet for a new or altered product, taking account of the possibly conflictingrequirements of the various stakeholders, such as beneficiaries or users. It isan early stage in the more general activity of requirements engineering whichencompasses all activities concerned with eliciting, analyzing, documenting,validating and managing software or system requirements .Requirements
analysis is critical to the success of a systems or software project. The Re-quirements should be documented, actionable, measurable, testable, trace-able, related to identified business needs or opportunities, and defined to alevel of detail sufficient for system design.
6.1.1
38
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
53/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 39
Requirements
The various functional and non-functional requirements have been describedbelow.
6.1.1.1 Functional Requirements
In software engineering, a functional requirement defines a function of asoftware system or its component. A function is described as a set of inputs,the behavior, and outputs. Functional requirements capture the intendedbehavior of the system. This behavior may be expressed as services, tasksor functions the system is required to perform. The various FunctionalRequirements of the proposed application are:
FCFS Module should schedule the pool of processes in first come firstserve basis.
Input should be process details with their arrival & burst time.
Output should be a file contating scheduled details.
SJN Module should schedule the pool of processes in order of shortestjob remaining first.
Input should be process details with their arrival & burst time.
Output should be a file contating scheduled details.
Genetic Module should schedule the pool of processes in accrodancewith the proposed algorithm.
Input should be process details with their arrival & burst time.
Output should be a file contating scheduled details.
Round Robin Module should schedule the pool of processes as per thedefined time quantum in a pre-emptive manner.
Input should be process details with their arrival & burst time.
Output should be a file contating scheduled details.
6.1.1.2 Non-Functional Requirements
In systems engineering and requirements engineering, a non-functionalrequirement is a requirement that specifies criteria that can be used to judgethe operation of a system, rather than specific behaviors.In general, func-tional requirements define what a system is supposed to do whereas non-functional requirements define how a system is supposed to be.
6.1. SYSTEM ANALYSIS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
54/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 40
6.1.2
Analysis Diagrams
Figure 6.1: Activity Diagram
6.1.3
Architecture
6.1. SYSTEM ANALYSIS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
55/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 41
Figure 6.2: State Diagram
6.1. SYSTEM ANALYSIS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
56/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 42
SECTION 6.2
Hardware & Software Requirements
The following are the requirements for running the Application developed :
1. Hardware Requirements
Minimum 32 MB of Ram.
166Mhz Intel Pentium processor or any other equivalent familyof processor.
2. Software Requirements
Linux or any other Unix family of OS.
GNU Make and GCC required to compile the Source code.
SECTION 6.3
Development Plaftorm
The Application is developed on Debian Squeeze running Linux Kernel2.6.32-5. The executable produced can be run on any Unix like Operat-ing System.
6.3.1
Tools Used
GIT The goal is usually less about code quality and more about explor-ing possibilities. Academic code is often quite crude, hacked togetherby us student(s), with dozens of false starts and changes in require-ments. Trying to recreate previous experiments is often very difficultunless the previsions are made for such rollbacks. And if we have,its probably done in a way that seemed logical to us at the time butis a nightmare for someone new to the project. There are ways toavoid this, by placing more of an emphasis on software engineering,but sometimes projects are so small or short-lived that it doesnt seem
feasible to trouble with that at first. To help combat these issues, wehave used git. Git is a fast, scalable, distributed revision control sys-tem with an unusually rich command set that provides both high-leveloperations and full access to internals.
Doxygen Doxygen is a tool for writing software reference documentation.The documentation is written within code, and is thus relatively easyto keep up to date. Doxygen can cross reference documentation andcode, so that the reader of a document can easily refer to the actualcode. We have extensively used doxygen to document the API.
6.2. HARDWARE & SOFTWARE REQUIREMENTS
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
57/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 43
LaTeX LaTeX is used for documenting the project as well as for creatingthe presentation. The Beamer class in LaTeX is used for presentations.
Dia & Inkscape These two tools are also open sourced under GNU Publiclicense and were used for the creating UML diagrams and figures listedin the list of figures.
GCC The GNU Compiler collection is used for compiling the C Codeswritten with the help of GNU Make.
Emacs GNU Emacs has been used as the editor both for source code de-velopment as well as LaTeX preparation.
SECTION 6.4
Project Management
The Project Management stuff was mainly concerned with the adoption ofthe process model to be used for application development which are discusedin great detail below.
6.4.1
Software Life Cycle
Design Programming language design involves choosing features to be in-
cluded in the language. Simplicity is essential. Machine independenceimproves the portability of a language.
Specification A specification should be complete, concise, precise, correct,unambiguous, understandable, usable, and useful.
Prototypes A quickly developed version of software which is probably in-complete or inefficient.
6.4.2
Process Model
The process model used for the development of the project is the IncrementalModel.
This model combines the elements of the linear sequential model withiterative philosophy of prototyping. The incremental model applies linearsequences in a staggered fashion as time progresses. Each linear sequenceproduce a deliverable increment for the software. The process flow for anyincrement can incorporate the prototyping model. When an incrementalmodel is used, the first increment is often a core product. Hence, basicrequirements are met, but supplementary features remain undelivered. The
6.4. PROJECT MANAGEMENT
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
58/98
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
59/98
CHAPTER 6. SOFTWARE ENGINEERING ASPECTS 45
Figure6.3:Ga
ntt
Chart
for
Project
6.4. PROJECT MANAGEMENT
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
60/98
CHAPTER 7
Project Implementation
Talk is cheap. Show me thecode.
Linus Torvalds
This chapter describes briefly the major modules and the major functionsof the application that has been implemented. We tried to be as precise aspossible in giving references to the functions used from GLIBC1. We have
also given pseudo-codesas well as flow chart wherever appropriate.
SECTION 7.1
Implemented Modules
The application in short consisted of 10 modules which are briefly discussedbelow. The general architecture is that the application runs a single processintially but after setting up necessary environment for its use it starts forkingchild processes for different types of Scheduling. For example a child processis forked for FCFS Scheduling then that child processes first intialises thenecessary environment for its functioning and then it creates two threadsfor handling the two different process pools. This is same for every childprocess forked for SJN, Genetic, Round Robin Scheduling. After all thesechild processes with their respective threads finish the scheduling of processpools the final plot values are finalised. Then the user is presented with aseries of menu items displaying to plot graphs and other functionalities. Inthe event of a graph generation option another child process is forked andusing exec family of System calls the request is passed to GNU Plot which
1GNU Library for C.
46
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
61/98
CHAPTER 7. PROJECT IMPLEMENTATION 47
further proceeses the data and produces the appriopriate graphs in LaTeX,PNG and EPS format.
7.1.1
Main
The Mainmodule if the first module invoked in the application. Its mainjob is to create a structure variable of type struct rlimitand use the setr-limit function defined in sys/resource.h to allow at maximum 70% CPUusage for this program as Genetic generationscan sometimes eat away theSystems resources like hungry beasts. If the set is successful then it invokesthe display menu() defined in application Module.
PSeudo-Code 3 Main Module Pseudo-codeMAX CPU USAGE70 Limiting CPU Usage to 70 %ifset CPU= 0then
exitelse
display menu()end if
7.1.2
ApplicationThis module when called creates message queue for Inter-process commu-nication. It also implements the UNIX reliable signal API for handling ofsignals like SIGINT, SIGXCPU and a user defined SIGUSR1. The user de-fined signal SIGUSR1 can be sent between any of the associated processesof the application. It is primarily used to inform the rceiver that a messageis waiting for it in the Message queue. The structure variables for storingprocess details both for static as well as dynamic pools are created. Thedynamic process details are generated randomly and static process detailsare read from the file. Then it forks 4 child processes to handle FCFS,SJN, Round Robin and Genetic Scheduling. After the child processes exit
it displays a menu to plot graphs from the data collected.
7.1.3
Applog
This module is quite peculiar in it implementation as well as usage. Thismodule is basically used for logging purposes. It logs the main applicationevents and other stuff. Whenever a child process is forked or a thread iscreated this module is called to record those events to a log file. It also
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
62/98
CHAPTER 7. PROJECT IMPLEMENTATION 48
records events like FCFS scheduling start and end time. The following codesnippet shows its implementation.
1 i n ta pp l og ( c on st c har m es s a g e)
3 {t i me t c u r r t i m e ; // f o r h o l d i ng c u rr e nt t i me
5 t im e t s t at us ; // f o r h o ld i ng t h e s t a t u s o f t im e ( )char a s c i i t i m e [ 2 6 ] ; // t he b u f f e r fo r ho l di ng a s c i i
c o nv e rt e d t ime must b e a t l e a s t 26 c h a ra c t er s l o ng 7 i n t l o g f i l e f d ; // f o r h o ld i ng l o g f i l e d e s c r i p t or
i n t n b y t e s ; // fo r h o ld i ng number o f b y t es w r i t te n 9 m od e t mode = S IRUSR | S IWUSR | S IRGRP | S IROTH; // f o r
s e t t i n g t h e l o g f i l e p er mi ss io n s t a t u s = t i me (& c u r r t i m e ) ;
11 i f ( s t a t u s == ( t i m e t ) 1 ){
13 f p r i n t f ( s t d e r r ,%s : ti me f u nc t io n f a i l e d t o f e t ch c ur r en t k e rn e l ti me
. \n ,15 s t r e r r o r ( e r r n o ) ) ;
e x i t (EXIT SUCCESS) ;17 }
c t i m e r (& c u rr t i m e , a s c i i t i m e ) ;19 l o g f i l e l o c k ( ) ;
l o g f i l e f d = o p en (LOG FILE , O WRONLY | O APPEND, mode) ;21 i f ( l o g f i l e f d == 1)
{23 f p r i n t f ( s td er r , %s : Unable to o pen l og f i l e . \n ,
s t r e r r o r ( e r r n o ) ) ;}
25 n b yt es = w r it e ( l o g f i l e f d , a s ci i t i m e , s t r le n ( a s c ii t i m e ) );
i f ( n b y tes == 1)27 {
f p r i n t f ( s td er r , %s : w ri t in g t o l o g f i l e a t %s f a i l e d . \n ,
29 s t r e r r o r ( e r r n o ) , LOG FILE ) ;return (3 ) ;
31 }n b y t e s = w r it e ( l o g f i l e f d , message , s t r l e n ( m ess age ) ) ;
33 i f ( n b y tes == 1){
35 f p r i n t f ( s t d e r r , %s : w r i ti ng t o l o g f i l e a t %s f a i l e d . \n ,
s t r e r r o r ( er r n o ) , LOG FILE ) ;37 return (3 ) ;
}39 i f ( ( f s y n c ( l o g f i l e f d ) ) == 1)
f p r i n t f ( s t de r r ,41 %s : f sy nc ( ) f a i l ed t o s yn c I /O o pe ra ti on s t o l o g f i l e
at %s \n ,s t r e r r o r ( er r n o ) , LOG FILE ) ;
43 c l o se ( l o g f i l e f d ) ;
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
63/98
CHAPTER 7. PROJECT IMPLEMENTATION 49
l o g f i l e u n l o c k ( ) ;45 return (EXIT SUCCESS) ;
}
Listing 7.1: Applog Module Implementation
7.1.4
File I/O
This module does all the I/O involved with the application i.e writing logfiles, reading plot scripts and writing final scheduled data etc.
7.1.5
Error Handler
This module is registered with the help ofatexit()2. This does all the nec-essary clean up stuff so that the application can start normally next time.It closes all open sockets, pipes and removes all message queues created forIPC. It also removes all temporary files created and finally waits for anychild process. After all child processes and threads have exited it hangs upthe application. Its implementation is shown in Listing 7.2
#include a p i / e r r o r h a n d l e r . h 2
void
4 m s g g e t e r ro r h a n dl e r ( i n t m q i d ){
6 f p r i n t f ( s td er r , m sget ( ) f un ct io n f a i l e d to a l l o c a t er e s ou r c e : %s \n ,
s t r e r r o r ( e r r n o ) ) ;8 char msg [ 3 0 0 ] = msget ( ) f u n ct i o n f a i l e d t o a l l o c a t e r e s ou r c e
: ;s t r c a t ( msg , s t r e r r o r ( e r r no ) ) ;
10 a pp l o g ( msg ) ;e x i t (1) ;
12 }
14 voidm s g sn d e r r o r h a nd l e r ( i n t r e t v a l u e , i n t m q i d )
16 {f p r i n t f ( s t de r r , msgsnd ( ) f u n ct i o n f a i l e d t o se nd me ssa ge :
%s \n ,18 s t r e r r o r ( e r r n o ) ) ;
char msg [ 3 0 0 ] = ms ge t ( ) f u n c t i o n f a i l e d t o s en d m es sa ge : ;20 s t r c a t ( msg , s t r e r r o r ( e r rn o ) ) ;
a p p l o g ( msg ) ;22 i pc r m ( m q id ) ;
2The atexit() function registers the given function to be called at normal process ter-mination.
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
64/98
CHAPTER 7. PROJECT IMPLEMENTATION 50
e x i t (1) ;24 }
26 voide x i t ha n d le r ( void )
28 {p r i n t f ( Runni g E xi t H an dl er r o u t i n e . . P l e as e Wait \n) ;
30 a p p l o g ( Runni g E xi t H an dl er r o u t i n e . . P l e as e W ait \n) ;i p c r m ( e x i t m q i d ) ;
32 i n t s t a t u s ;w a it p i d (1 , &s t a t u s , 0 ) ;
34 c h e c k c h i l d s t a t us ( s t at u s ) ;a pp l og ( \n) ;
36 e xi t ( 0 ) ;}
38 void40 i p c r m ( i n t m q i d )
{42 m s gc t l ( m q i d , IPC RMID , 0 ) ;
}44
void
46 c h e c k c h i l d s t a t u s ( i n t s t a t u s ){
48 i f (WIFEXITED ( s t a t u s ) )a pp l o g ( C h il d p r o ce s s e x i te d s u c c e s s f u l l y \n) ;
50 e ls e i f (WIFSIGNALED ( s t a t u s ) )a p p l o g ( C h il d t e rm i na t ed w it h s i g n a l \n) ;
52 e ls e i f (WCOREDUMP ( s t a t u s ) )a p p l o g ( A c o r e f i l e was w r i t t e n \n) ;
54 }
Listing 7.2: Error Handler Module Implementation
7.1.6
Scheduling
This module serves as the core of all other scheduling modules. The parentprocess after forking several child processes for different types of scheduling
actually invoke a part of this module which does the necessary environmentsetups and then aids the specific child process to create threads to con-tinue with the scheduling process. The following snippet shows its partialimplementation.
i n t
2 f c f s ( s tru c t s t p r d e t a i l s s t d a t a , s tru c td y n a m i c p r o c e s s d e t a i l s d y d a t a )
{4 // s t w t l o c k = PTHREAD MUTEX INITIALIZER;
s tru c t s t p r d e t a i l s s t s t a r t = s t d a t a ;
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
65/98
CHAPTER 7. PROJECT IMPLEMENTATION 51
6 s tru c t d y n a m i c p r o c e s s d e t a i l s d y s t a r t = d y d a ta ;p th re ad t s t f c f s t i d ; // s to r es t hr ea d id
8 p t h r ea d t d y f c f s t i d ;i n t r e t v a l s t f c f s ; // s t o r e s r e tu rn v a l u e o f p t h r ea d c r e a te
10 i n t r e t v a l d y f c f s ;
12 / / T h r ea d i ng f ro m h e r e t o h a n d l e FCFS S c h e d u l i n g
14 r e t v a l s t f c f s =p t h re a d c r ea t e (& s t f c f s t i d , NULL, s t f c f s , (void )
s t s t a r t ) ;16 r e t v a l d y f c f s =
p t h r e a d c r e a t e (& d y f c f s t i d , NULL, d y f c f s , (void )d y s t a r t ) ;
18 i f ( ! r e t v a l s t f c f s )
a p p l o g ( Thr ea d C r ea te d S u c c e s s f u l l y f o r s t a t i c FCFS \n) ;20 e l s ea pp lo g ( T hread c r e a t i on f a i l e d f o r s t a t i c FCFS \n) ;
22 i f ( ! r e t v a l d y f c f s )a p p l o g ( Th re ad C r ea t ed S u c c e s s f u l l y f o r Dynamic FCFS \n )
;24 e l s e
a p p l og ( Th re ad c r e a t i o n f a i l e d f o r Dynamic FCFS \n) ;26
/ W ait t i l l t h r e a d s a r e c o m pl e t e b e f o r e main c o n t i n u e s .U n l e s s we /
28 / w ai t we r un t he r i s k o f e xe c ut i ng an e x i t which w i l l t e r m i n a t e /
/ t he p r oc e ss and a l l t h re a ds b e f or e t h e t h re a ds h av e
co m p l eted . /30
p t h r e a d j o i n ( s t f c f s t i d , NULL) ;32 p t h r ea d j o i n ( d y f c f s t i d , NULL) ;
34 return (EXIT SUCCESS) ;}
Listing 7.3: partial Scheduling Module Implementation
7.1.7
FCFS
This module reads the pool of processes and does the scheduling using theFirst come first serve technique. It is relatively staright forward with noneed to emphasize its internal implementation as well as working.
7.1.8
Round Robin
This module reads the pool of processes and does the scheduling using theRound Robin technique. It defines a time quantum. Basing on this time
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
66/98
CHAPTER 7. PROJECT IMPLEMENTATION 52
quantum a process is allowed to use the CPU and after that it is replacedwith the next job in the queue. This process repeats till no other processare left in the queue. It is relatively staright forward.
7.1.9
SJN
This module reads the pool of processes and does the scheduling using theShortest Job Remaining Next technique. It searches the enitre queue of wait-ing jobs and selects the process with least CPU service time and allocatesit to the CPU. It does this till all jobs have been scheduled.It is relativelystaright forward with no need to emphasize its internal implementation aswell as working.
7.1.10
Genetic
This module is the most complicated of all the modules. For its internworking refer to Algorithm 5.1& Pseudo-code 2
7.1. IMPLEMENTED MODULES
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
67/98
CHAPTER 8
Testing & Deployment
Debugging is twice as hard aswriting the code in the firstplace. Therefore, if you write thecode as cleverly as possible, youare, by definition, not smartenough to debug it.
Brian W. Kernighan
This chapter basically describes the test cases developed for the ap-plication to ensure its correctness and reliability and also documents itsdeployment.
SECTION 8.1
Testing
In computing, Software Testing is the branch of software engineering thatdeals with trying to show that a software behaves according to its intendedspecification. Each operation is to be tested by considering two aspects as
below:
The expected results.
The actual results.
The above two tests also represent the validity and invalidity tests.
The valid tests are comprised of operations that the application per-forms without any errors/warnings.
53
-
8/13/2019 Report Multiprocessor Scheduling Algorithm Implementation Using Genetic Algorithms
68/98
CHAPTER 8. TESTING & DEPLOYMENT 54
The invalid tests are comprised of operations th