optimize task scheduling using shortest job first (sjf ... · penjadualan baru yang akan...

46
OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF) ALGORITHM IN WORKFLOWSIM NIK NUR IZZATI BINTI NIK HUSSIN BACHELOR OF COMPUTER SCIENCE (COMPUTER NETWORK SECURITY) WITH HONOURS UNIVERSITI SULTAN ZAINAL ABIDIN 2021

Upload: others

Post on 28-Mar-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF)

ALGORITHM IN WORKFLOWSIM

NIK NUR IZZATI BINTI NIK HUSSIN

BACHELOR OF COMPUTER SCIENCE

(COMPUTER NETWORK SECURITY) WITH HONOURS

UNIVERSITI SULTAN ZAINAL ABIDIN

2021

Page 2: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga
Page 3: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF)

ALGORITHM IN WORKFLOWSIM

NIK NUR IZZATI BINTI NIK HUSSIN

BACHELOR OF COMPUTER SCIENCE

(COMPUTER NETWORK SECURITY) WITH HONOURS

FACULTY OF INFORMATICS AND COMPUTING

UNIVERSITI SULTAN ZAINAL ABIDIN

2021

Page 4: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

i

DECLARATION

I hereby declare that this thesis is produced based on my original work with the aid of

obtaining information from the sources. The work is a result of my own investigation

using information from knowledgeable. I would also declare that this thesis has been

previously or concurrently submitted for any other degree at Universiti Sultan Zainal

Abidin or other institutions.

Name: Nik Nur Izzati Binti Nik Hussin

Date: …………………………………

Page 5: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

ii

CONFIRMATION

This is to confirm that the research conducted and the writing of this thesis was under

my supervision.

Name: Prof Madya Dr Zarina Binti Mohamad

Date: ……………………………………

Page 6: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

iii

DEDICATION

In the name of Allah, the Most Gracious and the Most Merciful, all praise is only for

Him, the King of the whole universe. May His blessing is upon his beloved Prophet

Muhammad S.A.W and all his family. A very great hamdalah I served to Him for giving

me enough health, time and maturity of mind to prepared this project and complete this

thesis.

I would like to express my deepest appreciation to all who provided me the possibility

to complete this thesis. A special thanks to my supervisor Prof Madya Dr Zarina Binti

Mohamad for her guidance, ideas, help, criticism and advice from the start until end

that is helpful to me to complete this final year project.

Next, I was proud to thank my parents and my family for giving moral support and

encouragement throughout my life whenever I feel like giving up. I also take this

opportunity to give special thanks to all lecturers of Faculty of Informatics and

Computing and my colleagues for their attentions, guidance and advice during my final

year project. To all panel that involve in appraisal session and give useful comment and

tips. I express my heartful gratefulness for their guide. May Allah S.W.T bless all effort

for completing this final year project.

Thank you.

Page 7: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

iv

ABSTRACT

Nowadays, the popularity and complexity of distributed computing systems make the

usage of simulation toolkit rising rapidly to develop, configure, and evaluate the system

performance. Many tasks can be done by Workflow Sim such as an evaluation of

scheduling techniques and it even considers the diverse task scheduling or execution

failures. The assessment of the performance of the workflow optimization technique in

real infrastructure is complex. Simulation-based studies have become a widely accepted

way to value Workflow Sim. The CPU becomes idle and overheating can affect the

output of the computer system. So, we need to find the best optimal value of CPU

utilization and Workflow Sim is the best tool that can be used. Workflow Sim is

extended of the existing Cloud Sim simulator by providing a higher layer of workflow

management. The main focus of this proposal is to implement Shortest Job First (SJF)

Algorithm in Workflowsim and comparing the default scheduling algorithm in

Workflow Sim with the new scheduling algorithm that will be implemented in the

Workflow Sim simulator. The default scheduling algorithm used in the Workflow Sim

simulator is First Come First Serve (FCFS) and Round Robin (RR), and the new

scheduling algorithm that will be implemented in the Workflow Sim simulator is

Shortest Job First (SJF) algorithm. These three scheduling algorithms will be compared

to find which one is better the scheduling algorithm to get the optimal value of the CPU

utilization.

Page 8: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

v

ABSTRAK

Pada masa kini, populariti dan kerumitan sistem pengkomputeran terdistribusi

menjadikan penggunaan toolkit simulasi meningkat dengan pesat untuk

mengembangkan, mengkonfigurasi, dan menilai prestasi sistem. Banyak tugas yang

dapat dilakukan oleh Workflow Sim seperti penilaian teknik penjadualan dan bahkan

menganggap kegagalan penjadualan atau pelaksanaan tugas yang pelbagai. Penilaian

prestasi teknik pengoptimuman aliran kerja dalam infrastruktur sebenar adalah

kompleks. Kajian berdasarkan simulasi telah menjadi kaedah yang diterima secara

meluas untuk menghargai Workflow Sim. CPU menjadi tidak berfungsi dan terlalu

panas boleh mempengaruhi prestasi sistem komputer. Jadi, perlu mencari nilai

penggunaan CPU optimum terbaik dan Workflow Sim adalah alat terbaik yang dapat

digunakan. Workflow Sim adalah pengembangan dari simulator Cloud Sim yang ada

dengan menyediakan lapisan pengurusan aliran kerja yang lebih tinggi. Fokus utama

dalam cadangan ini adalah untuk menerapkan Algoritma Pendek Pekerjaan Terpendek

(SJF) di Workflowsim dan membandingkan algoritma penjadualan lalai di Workflow

Sim dengan algoritma penjadualan baru yang akan dilaksanakan di simulator Workflow

Sim. Algoritma penjadualan lalai yang digunakan dalam simulator Workflow Sim

adalah First Come First Serve (FCFS) dan Round Robin (RR), dan algoritma

penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah

algoritma Shortest Job First (SJF). Ketiga tiga algoritma penjadualan ini akan

dibandingkan untuk mencari mana yang lebih baik algoritma penjadualan untuk

mendapatkan nilai penggunaan CPU yang optimum.

Page 9: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

vi

TABLE OF CONTENTS

Page

DECLARATION ....................................................................................................................... i

CONFIRMATION ....................................................................................................................ii

DEDICATION .......................................................................................................................... iii

ABSTRACT .............................................................................................................................. iv

ABSTRAK ................................................................................................................................. v

LIST OF FIGURES ............................................................................................................... viii

LIST OF TABLES ................................................................................................................... ix

LIST OF EQUATION .............................................................................................................. x

LIST OF ABBREVIATIONS/ TERMS/ SYMBOLS............................................................ xi

CHAPTER 1 ............................................................................................................................. 1

INTRODUCTION .................................................................................................................... 1

1.1 Background ................................................................................................... 1

1.2 Problem Statement ........................................................................................ 3

1.3 Objectives ...................................................................................................... 3

1.4 Scope ............................................................................................................. 4

1.5 Limitation of work ........................................................................................ 4

1.6 Summary ....................................................................................................... 4

CHAPTER 2 ............................................................................................................................. 5

LITERATURE REVIEW........................................................................................................ 5

2.1 Introduction ..................................................................................................... 5

2.2 Task Scheduling in Cloud Computing ............................................................ 6

2.3 Task Scheduling Algorithm ............................................................................ 7

2.4 What is Workflow Sim? .................................................................................. 9

2.5 Previous research techniques and comparison .............................................. 11

2.6 Summary ....................................................................................................... 14

CHAPTER 3 ........................................................................................................................... 15

METHODOLOGY ................................................................................................................ 15

3.1 Introduction ................................................................................................... 15

3.2 Scheduling Model in Cloud Computing ........................................................ 16

3.3 Framework of WorkflowSim ........................................................................ 18

3.4 Task Scheduling Algorithms ......................................................................... 19

Page 10: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

vii

3.4.1 First Come First Serve Algorithm ........................................................... 19

3.4.2 Flowchart of First Come First Serve (FCFS) Algorithm ......................... 20

3.4.3 Pseudocode of First Come First Serve (FCFS) Algorithm ...................... 21

3.4.4 Round Robin (RR) Algorithm ................................................................. 22

3.4.5 Flowchart of Round Robin (RR) Algorithm ............................................ 23

3.4.6 Pseudocode of Round Robin (RR) Algorithm ......................................... 24

3.4.7 Shortest Job First (SJF) Algorithm .......................................................... 25

3.4.8 Flowchart of Shortest Job First (SJF) Algorithm .................................... 26

3.4.9 Pseudocode of Shortest Job First (SJF) Algorithm ................................. 27

3.5 Software and Hardware ................................................................................ 28

3.6 Summary ...................................................................................................... 28

REFERENCES ....................................................................................................................... 29

APPENDIX ............................................................................................................................. 31

Page 11: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

viii

LIST OF FIGURES

FIGURE TITLE PAGE

Figure 1: Interaction between components ................................................................... 9

Figure 2: Scheduling Model in Cloud Computing ...................................................... 16

Figure 3: The Architecture of Workflow Sim ............................................................. 18

Figure 4: Flowchart of First Come First Serve (FCFS) Algorithm ............................. 20

Figure 5: Flowchart of Round Robin (RR) Algorithm ................................................ 23

Figure 6: Flowchart of Shortest Job First (SJF) Algorithm ......................................... 26

Page 12: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

ix

LIST OF TABLES

TABLE TITLE PAGE

Table 1: Advantages and Disadvantages of the Algorithms .......................................... 8

Table 2: Research Comparison .................................................................................... 14

Table 3: Gantt Chart of Activities and Milestones of FYP 1 ....................................... 32

Page 13: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

x

LIST OF EQUATION

EQUATION TITLE PAGE

Equation 1: Formula of Waiting Time ..................................................................................... 25

Page 14: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

xi

LIST OF ABBREVIATIONS/ TERMS/ SYMBOLS

CPU Central Processing Unit

OS Operating System

SJF Shortest Job First

RR Round Robin

FCFS First Come First Serve

Page 15: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

1

CHAPTER 1

INTRODUCTION

1.1 Background

Nowadays, simulation is the most important and popular evaluation method in

scientific workflow studies. Scientific workflows consisting of many tasks and the

execution of these tasks may require many complex modules and software. The

assessment of the performance of workflow optimization techniques in real

infrastructures is complicated and time-consuming. As a result, simulation-based

studies have become one of the most widely accepted and widely used methods for

evaluating workflow systems.

Cloud computing is an emerging technology due to virtualization and low

levels of supply price of facilities based on pay-as-per-use. Cloud computing has gained

enormous popularity over the past few years as it provides a scalable and effective

solution for most Internet Providers. As it consists of multiple users, service providers,

physical devices, service broker, task scheduling algorithms, bandwidth, internet

latency, and storage technology, the cloud is a large and complex system. On the other

hand, different configurations are required for all cloud-based implementations.

Page 16: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

2

Scheduling jobs in the cloud computing system become challenging nowadays

because the jobs are cloudlets. Simulation becomes one of the ways to discover a

solution and detect the problem that had or possibly occur in the system. This proposal

is concerned with a method that will improve the overall cloudlet allocation based on

CPU utilization. It is being compared with the existing cloudlet scheduling algorithm

which is used by the Workflow Sim with the new scheduling algorithm that will be

plug-in in the Workflow Sim simulator. Workflow Sim is the simulation tool that is

used in the overall implementation task scheduling algorithm. In terms of resource

utilization, which is the use of the CPU, a comparison of the algorithm is proposed for

parameter efficiency. It will be assigned the task to the scheduler more efficiently and

speed up the computer performance.

The algorithm commonly used for CPU Scheduling in Workflow Sim is First

Come First Serve (FCFS) and Round Robin (RR). The Shortest Job First (SJF) is the

new scheduler algorithm that will be implemented in the Workflow Sim simulator. It

will be compared with the default algorithm scheduler and the objective of this project

is to analyze which algorithm is the best for scheduling to get the best performance in

terms of resource utilization.

Page 17: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

3

1.2 Problem Statement

• The failure of create a parallel and synchronized process that occurs on

time due to the wrong allocation of job scheduling.

• The inflexibility of task scheduling algorithm will cause longer

processing time and will slow down the system performance.

• To find the optimal value of CPU utilization to prevent the computer

from overheating using Shortest Job First (SJF) algorithm.

1.3 Objectives

• To implement Shortest Job First (SJF) algorithm into the Workflow Sim

simulator in achieving optimal resource utilization.

• To analyse the performance of the Shortest Job First (SJF) algorithm

using Workflow Sim and compare to other default scheduling algorithm

which are First Come First Serve (FCFS) and Round Robin (RR) in

terms of resource utilization.

• To study the resource of task scheduling algorithm using Workflow Sim

simulator.

Page 18: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

4

1.4 Scope

• Analyse and compare the default task scheduling algorithm with new

task scheduling algorithm implemented in Workflow Sim.

• Identify and observe which better task scheduling algorithm in

achieving an optimal resource utilization.

1.5 Limitation of work

• High cost needed in implement of scheduling in the real world and

difficult to do.

• Limited time to study the whole concept of the Shortest Job First (SJF)

scheduling algorithm to be implemented in the Workflow Sim

simulator.

• The implementation of the scheduling algorithm in the simulation

environment in real-time computer performance cannot be similar to

simulation performance.

1.6 Summary

This chapter consist of the introduction of the project such as the background

of the project, the problem statement, objectives for this project, scope of project, and

the limitation of work. Thus, it helps to organize better documentation of the project.

Page 19: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

5

CHAPTER 2

LITERATURE REVIEW

2.1 Introduction

A literature review consists of numerous techniques or approaches that have

been proposed by many researchers previously. In this chapter, it focuses on the process

of analyzing the information gathered about the topic which is in the context of resource

task scheduling and cloud computing simulation (Workflow Sim) based on the sources

find which is an article journal and few theses that discuss deeper on the simulation of

cloud computing and resource task scheduling. This chapter consists of the outcome of

the information gathering that will be analyzed and few improvements will be applied

to the project. This chapter also highlights the different tools that will be used and a few

approaches are taken and the difference between default algorithms with new

algorithms scheduling. It including a few articles and journals that related directly and

indirectly to the resource scheduling algorithm in Workflow Sim.

Page 20: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

6

2.2 Task Scheduling in Cloud Computing

Based on researcher, Poonam Rani and Pooja Nagpal 2017, task scheduling is a

process in which tasks that need to be executed are assigned to the available resources

in the cloud through the internet [1]. If any allocation of resources is not done properly,

as a result the cloud services will remain unused.

Mahendra Bhatu Gawali and Subhash K. Shinde 2018 proposed that task

scheduling is the process of arranging incoming requests (tasks) in a certain manner so

that the available resources will be properly utilized [2]. Proper task scheduling may

affect in the efficient utilization of resources.

Page 21: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

7

2.3 Task Scheduling Algorithm

There are few types of task scheduling algorithm available in the computer

resourcing for CPU utilization. In this topic, a few comparisons will be studied to

choose the best scheduling algorithm in terms of lower response time. The Table 1

shows the algorithm, technique and approaches being used in the research and

advantages and disadvantages of the algorithm is documented in a table form.

No Algorithm/ Techniques/

Approaches

Advantages Disadvantages

1 First Come First Serve

(FCFS)

• The process request in

a queue and executes

it one by one.

• Easy to implement.

• Starvation doesn’t

occur.

• Once a process is

started, CPU will

execute the process

until it ends.

• Take a long waiting

time before get the

chance to be executed.

2 Round Robin (RR) [3] • Given the same

priority.

• Starvation doesn’t

occur.

• Every process is given

a fixed time to

execute.

• The choice of the

length of the time

quantum affect the

throughput.

• If time quantum is

shorter, then CPU

efficiency will be

decrease.

Page 22: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

8

3 Priority-based

Scheduling

• The priority of a

process will be

selected based on

memory requirement,

time requirement or

user preference.

• The second

scheduling algorithm

is required to schedule

the process which has

the same priority.

• Starvation occurs

4 Shortest Job First (SJF) • Short processes are

executed first, then

followed by longer

processes.

• More processes can be

executed in less

amount of time affect

the increase of

throughput.

• The process takes

longer time.

• Starvation occurs

Table 1: Advantages and Disadvantages of the Algorithms [3]

Page 23: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

9

2.4 What is Workflow Sim?

Workflow Sim is a simulator that extends the current Cloud Sim simulator by

offering a higher workflow management layer [4]. Therefore, Workflow Sim aims to

extract the standard features of different workflow systems rather than concentrating on

a particular aspect of workflow management and to support commonly used workflow

management techniques [4]. Workflow Sim was developed by a team of researchers

under the guidance of Weiwei Chen at the Information Sciences Institute at the

University of Southern California. It describing essential components such as workflow

mapper, clustering engine, workflow engine, and workflow scheduler, and job

execution.

Figure 1: Interaction between components [4]

Figure 1 shows an interaction between components such as workflow mapper,

clustering engine, workflow engine and workflow scheduler and job execution.

Workflow mapper – DAG files that formatted in XML and other metadata information

such as file size by using the workflow mapper. The Workflow Mapper generates a list

of tasks after mapping, and assigns these tasks to an execution location. A task is the

activity that a user would like to execute.

Page 24: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

10

Clustering engine - The Clustering Engine combine tasks into jobs to reduce the

scheduling overheads. Vertical clustering is type of clustering strategies that merge

tasks at the same pipeline vertically.

Workflow engine - Based on its dependencies, the Workflow Engine handles jobs to

ensure that a job can only be released when all of its parent jobs are successfully

completed. The Workflow Engine will only release free jobs to the Scheduler [4].

Workflow scheduler and job execution - The Workflow Scheduler is used to match

jobs to worker nodes based on the criteria selected by users and many other heuristics.

For static algorithms, at the workflow planning level, jobs are allocated to a worker

node. It will only wait until the allocated worker node is free when the task hits the

remote scheduler. For dynamic algorithms, each time a worker node becomes idle, jobs

are matched to a worker node in the remote scheduler.

Page 25: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

11

2.5 Previous research techniques and comparison

This comparison is to explore the difference technique being use in task

scheduling between another researcher.

Based on the researchers which are Babur Hayat Malik, Mehwashma Amir,

Bilal Mazhar, Shehzad Ali, Rabiya Jalil and Javaria Khalid (2018), the research is all

about the scheduling algorithm which is Round Robin (RR). Round Robin is a simple

example of load balancing technique and it is designed to divide scheduling time among

all scheduled task equally.

Soheil Anousha and Mahmoud Ahmadi (2013) stated that Min Min algorithm

act as select selects the task with minimum completion time and assigns it to the

resource on which the minimum execution time is achieved. This algorithm considers

all jobs at a time and produces a better makespan.

Andysah Putera Utama Siahaan (2016) stated that First Come First Serve

algorithm is commonly use in task scheduling. First Come First Serve algorithm is a

process that arrives first will be served first. The process in the queue behind had to wait

until all the process in front of him is complete.

Poonam Rani and Pooja Nagpal (2017) doing a research about Max Min

algorithm. They stated that Max Min algorithm is used to perform tasks first which takes

Page 26: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

12

more time for completion. The small tasks stay in queue until all huge tasks finished

their execution.

N. Xoxa, M. Zotaj, I. Tafa and J. Fejzaj (2014) stated that Shortest Job First

algorithm is a shorts process executed first.Even the procedure on the queue has a lower

execution time, he expects the execution process to be completed.

YEAR AUTHOR TITLE TECHNIQUE DESCRIPTION

2018

Babur Hayat

Malik,

Mehwashma

Amir, Bilal

Mazhar,

Shehzad Ali,

Rabiya Jalil,

Javaria Khalid

Comparison

of Task

Scheduling

Algorithms

in Cloud

Environment

Round Robin

(RR)

Algorithm

- a simple example of

load balancing

technique.

- designed to divide

scheduling time among

all scheduled task

equally, in which all

tasks get in queue list,

and each task gets an

equally small unit of

time.

- The load balancing

and response time are

much better.

Page 27: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

13

2013

Soheil

Anousha,

Mahmoud

Ahmadi

An Improved

Min-Min

Task

Scheduling

Algorithm

in Grid

Computing

Min Min

Algorithm

- selects the task with

minimum completion

time and assigns it to

the resource on which

the

minimum execution

time is achieved.

- this algorithm

considers all jobs at a

time and

produces a better

makespan.

2016

Andysah

Putera Utama

Siahaan

Comparison

Analysis of

CPU

Scheduling:

FCFS,

SJF and

Round Robin

First Come

First Serve

(FCFS)

Algorithm

- a process that arrives

first will be served

first.

- The process in the

queue behind had to

wait until all the

process in front of him

is complete.

Page 28: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

14

2017

Poonam Rani,

Pooja Nagpal

Optimized

Task

Scheduling

Algorithm

for cloud

computing

environment

Max-Min

Algorithm

- used to perform tasks

first which takes more

time for completion.

- small tasks stay in

queue until all huge

tasks finished

their execution.

2014

Nevila Xoxa,

Marjo Zotaj,

Igli Tafa,

Julian Fejzaj

Simulation

of First

Come First

Served and

Shortest Job

First

Algorithms

Shortest Job

First (SJF)

Algorithm

- a shorts process

executed first.

- Even the procedure

on the queue has a

lower execution time,

he expects the

execution process to be

completed.

Table 2: Research Comparison

2.6 Summary

This chapter consist of the various sources of research related to task scheduling

in cloud computing simulation and Workflowsim simulator toolkit application shows

that flexibility of configuration of the cloud computing system. The various approach

techniques used help in generating a better version of project research in the future. A

literature review is done to ensure no identical research is done.

Page 29: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

15

CHAPTER 3

METHODOLOGY

3.1 Introduction

The methodology consists of the entire framework or design of the research

which is the choice of methods, tools, and techniques to be applied in the project. This

chapter will explain thoroughly the specific details on the method that will be used to

run this project. Firstly, it will start with a case study that can be used in this project.

Next, it will discuss the simulation technique by using NetBeans IDE 8.2 to simulate

the flow of the Workflow Sim model in the real world. All diagrams that are applied in

structural analysis and design are implemented which are used framework, use case

diagram and sequence diagram of the system in the logical model.

Page 30: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

16

3.2 Scheduling Model in Cloud Computing

Figure 2: Scheduling Model in Cloud Computing [5]

The main component in the scheduling model is Broker, Client, Resources,

Resources Supporter and Information Services [5]. Figure 2 shows that Broker is the

middle in the interface between Resource Provider and Client. The first process that

happens in Scheduling Model is to start by the client submits the task to the broker, then

the broker searches for the resources in the information service and after that deploys

the tasks to the appropriate resources according to the algorithm provided to the broker.

In the Broker, it consists of Job Control Agent, Schedule Advisor, Explorer, Trade

Manager, and Deployment Agent.

Job Control Agent function as monitor the jobs in the software system such as

status of jobs and communicating with clients and schedule advisor.

Page 31: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

17

Next, Schedule Advisor being used to determine resources, allocate available

resources that satisfy the demands of clients such as deadline and cost. While Cloud

Explorer functions as a tool that communicates with cloud information services to find

resources and records resource status information.

Trade Manager used to determine resources access cost and try to communicate

with resources at a low cost under the control of schedule advisor. Last but not least,

Deployment Agent uses scheduler instruction as well as to activate the execution of

tasks and update the status of execution sending back to Job Control Agent in regular

intervals [6].

Page 32: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

18

3.3 Framework of WorkflowSim

Figure 3: The Architecture of Workflow Sim [4]

The architecture of WorkflowSim is shown in Figure 3. The area surrounded by

dotted lines is represented by CloudSim. The submit host consists of Workflow Mapper,

Clustering Engine, Workflow Engine, and Workflow Scheduler. Each component has

its function or task. The Workflow Mapper which is mapped abstract workflows to

concrete workflows that depend on execution sites. The clustering Engine function

merges the small tasks into a large job such that the scheduling overhead is reduced.

Next, the execute site consist of Failure Monitor, Failure Generator, Worker

Nodes, and Remote Scheduler. Each component has its function such as Failure Monitor

which job collects failure records to return these records to the Clustering Engine.

Remote Scheduler is used to match jobs to a worker node based on criteria selected by

users, Worker Nodes. Last but not least, Failure Generator jobs as inject task failures at

each execution site during the simulation.

Page 33: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

19

3.4 Task Scheduling Algorithms

3.4.1 First Come First Serve Algorithm

First Come First Serve (FCFS) Algorithm is a default algorithm that is

commonly used in task scheduling of the operating systems in simulators of cloud

computing such as WorkflowSim and CloudSim. First Come First Serve (FCFS)

Algorithm is easy to be implemented since it is a simple task scheduling algorithm and

it is an error-free scheduling algorithm that helps in saves CPU resources.

First Come First Serve (FCFS) Algorithm is an algorithm scheduling operating

system that executes a queued request and processes it based on its arrival order. The

concept of the execution process of the FCFS Algorithm is the first job come will be

handled first and the next job will be executed once the previous job is done executed.

Page 34: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

20

3.4.2 Flowchart of First Come First Serve (FCFS) Algorithm

No

Yes

Figure 4: Flowchart of First Come First Serve (FCFS) Algorithm

Start

Read number of process and burst time

i++

Calculate waiting time and turnaround time

Display First Come First Serve Process

Stop

Page 35: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

21

3.4.3 Pseudocode of First Come First Serve (FCFS) Algorithm

1. Start

2. Read number of process (int)

3. Read the burst time

4. Calculate waiting time and turnaround time

5. Display FCFS Algorithm process

6. Calculate average waiting time and average turnaround time and display it

7. Stop

Page 36: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

22

3.4.4 Round Robin (RR) Algorithm

Round Robin (RR) Algorithm is one of the algorithms employed by process

and network schedulers in computing and manipulate all the process without priority. It

is a simple algorithm and easy to be implemented and gives starvation-free as well as

in the process of job scheduling in the operating system.

One of the characteristics of the Round Robin (RR) Algorithm is handling each

job in uniform portions and time allocation without priority assigned. The benefit of

using the Round Robin (RR) Algorithm is used as an alternative to a first come first

serve queue. Round Robin scheduling algorithm results in max-min fairness if the data

packets are equally sized.

Page 37: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

23

3.4.5 Flowchart of Round Robin (RR) Algorithm

Figure 5: Flowchart of Round Robin (RR) Algorithm

Start

Declare time limit variable

Quantum time =

time limit process

Calculate time waiting, turnaround

time and average turnaround time

Print Round Robin Algorithm

process

Stop

Page 38: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

24

3.4.6 Pseudocode of Round Robin (RR) Algorithm

1. Start

2. Declare time limit variable

3. Take the number of process and burst time of every process

4. Take quantum value (time limit of process)

5. Calculate time waiting, turnaround time and average turnaround time

6. Print Round Robin (RR) Algorithm process

7. Stop

Page 39: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

25

3.4.7 Shortest Job First (SJF) Algorithm

Shortest Job First (SJF) Algorithm is a scheduling algorithm that is based on

the logic, a shorts process executed first [10]. SJF Algorithm can be divided into two

types which are pre-emptive and non-pre-emptive. This algorithm works as it will make

execution time to be complete its job scheduled.

One of the characteristics of the Shortest Job First Algorithm is non-pre-

emptive where is no pre-empted task is allowed until a certain task had completed its

CPU burst. Besides, there is a function of priority queue when the ready queue takes

action based on the smallest CPU time.

The criteria of Shortest Job First (SJF) Algorithm is the Waiting Time (W.T).

The calculation of the waiting time is stated in equation 3.1

Waiting Time = Turn Around Time – Burst Time

Equation 1: Formula of Waiting Time

1. Completion Time: Time at which process completes its execution.

2. Turn Around Time: Time Difference between completion time and arrival time.

Turn Around Time = Completion Time – Arrival Time

3. Waiting Time (W.T): Time Difference between turnaround time and burst time.

Waiting Time = Turn Around Time – Burst Time

Page 40: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

26

3.4.8 Flowchart of Shortest Job First (SJF) Algorithm

No

Yes

Figure 6: Flowchart of Shortest Job First (SJF) Algorithm

Start

Read number of process

Calculate shortest burst time

i++

Print process value with

Shortest Burst Time

Stop

Page 41: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

27

3.4.9 Pseudocode of Shortest Job First (SJF) Algorithm

1. Start

2. Input number of process

3. Select process which has the shortest burst time among all process will execute first

4. If the process has the same burst time length then First Come First Serve scheduling

algorithm used.

5. Make an average waiting for the time length of the next process

6. Start with the first process, selection as above and other processes are to be in the

queue.

7. Print process value with shortest burst time

8. Stop

Page 42: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

28

3.5 Software and Hardware

In this project, a few software had been used throughout of the process of

documentation and implementation which is NetBeans IDE 8.2. Next, cloud computing

simulation. Then, WorkflowSim-1.0 tool kit. Lastly, Windows 10 operating system.

There is no usage of additional hardware in this project.

3.6 Summary

This chapter discusses the general architecture and resource scheduling in a

cloud computing environment. Then, it briefly explained how the First Come First

Serve (FCFS), Round Robin (RR) and Shortest Job First (SJF) scheduling algorithm

works and what is the flowchart and pseudocode involved in both schedules. The

algorithm will be implemented in WorkflowSim by using JavaScript on NetBeans IDE

8.2 and the final expected result which is a graph can be represented in the next chapter.

Page 43: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

29

REFERENCES

[1] Monika and A. Jindal, “Optimized task scheduling algorithm for cloud

computing,” Lect. Notes Networks Syst., vol. 9, no. 5, pp. 431–439, 2018.

[2] M. B. Gawali and S. K. Shinde, “Task scheduling and resource allocation in

cloud computing using a heuristic approach,” J. Cloud Comput., vol. 7, no. 1,

2018.

[3] Comparison of Scheduling Algorithms. (n.d.). Retrieved from

https://www.studytonight.com/operating-system/comparision-scheduling-

algorithms.

[4] W. Chen and E. Deelman, “WorkflowSim: A toolkit for simulating scientific

workflows in distributed environments,” 2012 IEEE 8th Int. Conf. E-Science, e-

Science 2012, no. April 2014, 2012.

[5] S. Arora and S. Anand, “Improved Task Scheduling Algorithm in Cloud

Environment,” Int. J. Comput. Appl., vol. 96, no. 3, pp. 7–12, 2014.

[6] Ru Jia and Keung Jacky “An Empirical Investigation on the Simulation of

Priority and Shortest-Job-First Scheduling for Cloud-based Software Systems”

2013 22nd Australian Conference on Software Engineering, pp.78-87.

[7] C. Chen, J. Liu, Y. Wen, and J. Chen, “Research on workflow scheduling

algorithms in the cloud,” Commun. Comput. Inf. Sci., vol. 495, pp. 35–48,

2015.

[8] S. Anousha and M. Ahmadi, “An improved Min-Min task scheduling algorithm

in grid computing,” Lect. Notes Comput. Sci. (including Subser. Lect. Notes

Artif. Intell. Lect. Notes Bioinformatics), vol. 7861 LNCS, pp. 103–113, 2013.

[9] A. P. U. Siahaan, “Comparison Analysis of CPU Scheduling FCFS, SJF and

Round Robin,” vol. 4, no. 3, pp. 124–131, 2017.

Page 44: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

30

[10] N. Xoxa, M. Zotaj, I. Tafa, and J. Fejzaj, “Simulation of First Come First

Served (FCFS) and Shortest Job First (SJF) Algorithms,” IJCSN -International

J. Comput. Sci. Netw. ISSN, vol. 3, no. 6, pp. 2277–5420, 2014.

Page 45: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

31

APPENDIX

Page 46: OPTIMIZE TASK SCHEDULING USING SHORTEST JOB FIRST (SJF ... · penjadualan baru yang akan dilaksanakan dalam simulator Workflow Sim adalah algoritma Shortest Job First (SJF). Ketiga

32

Task

Week

W

1

W

2

W

3

W

4

W

5

W

6

W

7

W

8

W

9

W

10

W

11

W

12

W

13

W

14

Discussion title

and method

with supervisor

Discussion

abstract with

supervisor

Title, abstract

and project

scope

submission

Introduction

project

Literature

review

discussion

Proposal, slide

and gantt chart

preparation

Proposal

presentation

Proposal

correction

Methodology

POC

Methodology

conference

Format writing

conference

Proposal draft

preparation and

discussion

Proposal draft

submission

Final report and

presentation

preparation

Final

presentation

Proposal

correction

Proposal report

submission

Table 3: Gantt Chart of Activities and Milestones of FYP 1