Mathematics

# Process Scheduling in Longest Job First (LJF) Algorithm: A Proposed Framework for Starvation Problem

## ABSTRACT

The process as an individualistic program in execution forms the basis of everything in the computer system functionality, Central Processing Unit (CPU) becomes the main target of every process execution. The best ordering and sequence of assigning these processes to the CPU becomes the most difficult problem to obtain the best performances. This thesis work in the field of CPU scheduling by carefully studying all popular scheduling algorithms thereby proposing an option to the most uncommon scheduling algorithm: Longest Job First (LJF), to compete alongside others. The major problem leading to starvation was reduced by proposing a model into the LJF. The model was designed and tested thereby suggesting ways by which LJF could be enhanced to solve parts of the starvation problems, waiting times and context switches.

## 1.0 INTRODUCTION

Process scheduling algorithms has been an interesting field of study in Operating Systems.

Scheduling is a key concept in computer multitasking, multiprocessing and real-time operating system designs.
Scheduling refers to the way processes are assigned to run on available Central Processing Unit (CPU) (Galvin, 2004). Each Process (a program in execution) passes through some stages in its execution and allocation to CPU as will be illustrated in the process-state diagram. A Process is started at arrival time which gets into the Ready Queue based on some scheduling algorithm and waits for the Job scheduler/ dispatcher which decides on what scheduling algorithm to use. The process state diagram of Fig 1.1 illustrates this.

Figure 1.1: Process state diagram

The process state is as follows:

a. New: Where processes enter the system.

b. Ready: It is a stage where queues are used to order how jobs arrived

c. Running: The Scheduler and Dispatcher, based on selected algorithms, move Ready jobs to Run, a job may be pre-empted back to the ready depending on the scheduling algorithm in use.

d. Waiting: On a request for an I/O and later rescheduled on completion of the request.

e. End/Exit: Process terminates.

At the moment, based on literature, there isn’t a world most preferable scheduling algorithm (Stallings, 2000) as most operating systems use the most common scheduling algorithms which include: First Come First Serve (FCFS), Shortest Job Next (SJN), Shortest Job First (SJF), Round Robin (RR) and Priority Scheduling as an extension or the combination of two or more scheduling algorithm.

In this research, some of the existing scheduling algorithms basically the Shortest Job First (SJF) and the Longest Job First (LJF) algorithm will be looked into while putting latency and minimising total waiting time to achieve maximum utilization of the Central Processing Unit (CPU).

Furthermore, we propose a framework to deal with the starvation (A condition that makes processes waits stagnantly and denied allocation to the CPU) problems to curtail the convoy (A long queue of waiting processes) problem through fairness to shorter processes.

This research will also be focusing on making the Longest Job First (LJF) the approach to test and suggest how best the Shorter Jobs gets fairer allocation to the CPU through backfilling and combination of shorter jobs through ageing and burst-times merging. The process will be gaining access through comparing the merged burst-time and the incoming longer jobs.

## 1.1 OBJECTIVES OF STUDY

The objectives of this work are to minimise the overall waiting time and minimise the numbers of context switching of processes in a multiprocessing system; thereby coming up with a framework that will make fair consideration to shorter jobs on queue and suggest efficient time closer to the Longer Jobs in execution to minimise starvation in LJF.

## 1.2 SIGNIFICANCE OF STUDY

The research hopes to contribute to the existing problem faced by the operating system by minimizing the starvation problem to achieve maximum efficiency, throughput, and CPU utilization by minimizing the overall waiting time of processes.

## 1.3 RESEARCH QUESTIONS

a. When does LJF compete with other algorithms?

b. Under what environment does LJF perform better than SJF, RR and FCFS?

c. Can the Starvation problem be minimised in a multiprocessor environment using LJF?

## 1.4 SCOPE

The research will be focusing on the scheduling algorithm for Longer Job processes and propose a framework for reducing long delays in queues. Shorter jobs will be merged up to make them a bit considerable to reduce starvation through fairness. The scope of this work is limited to reducing starvation problems and minimizing the overall waiting times and average turn-around time.

## 1.5 METHODOLOGY

These are approaches and series of steps to be taken in actualising our research objectives:

a. The first consideration of this work will be the generation of the processes using Random Number generators with an appropriate statistical distribution (Poisson and Exponential average).

b. The burst-time for each process will also be generated through a distribution.

c. Analysing the processes generated on Gantt charts and calculations of general process properties will be acquired and kept for comparison in the Final Chapter.

d. Conditions for merging processes will be stated and designed by some algorithm and tested as implementation using Java and later a dispatch and schedule of the merged short jobs will be moved into the CPU by our algorithm.

## 1.6 ORGANIZATION OF THESIS

The thesis will be focusing on proposing a framework that will minimise starvation of processes in the Longest Job First (LJF) scheduling algorithm through merging shorter jobs (Combinational Burst Time CBT) to maximise total utilization of the CPU to minimize the total waiting time of the processes in the system.

Chapter two will be discussing on the existing literature and researches conducted in the field of process scheduling.

Chapter three discusses the methodologies adopted to design the proposed framework for solving starvation problems in the Longest Job First (LJF) scheduling algorithm.

Chapter four will focus on the implementation and testing of the proposed algorithm.

Chapter five will summarise the work and propose areas for future work.

## References

Scheduling: Computer Scheduling. Retrieved October 27, 2011, from Scheduling: http://www.cs.sunysb.edu/~algorith/files/scheduling.shtml

Achim, S. (2005). On Performance Evaluation of Slackness option for the Self-tuning dynP scheduler. Central Institute for Applied Mathematics. Julich, Germany: RSJ.

Baptiste, P. (1994). Constraint-Based Scheduling: Two Extensions. The University of Strathclyde, Department of Manufacturing and Engineering. Scotland:

Boleslaw, S. K. (1990). Mutual Exclusion Revisited. Fifth Jerusalem Conference in Information Technology (pp. 110-117). Israel, Jerusalem: IEEE Computer Society Press.

Cheng, T., & Kahlbacher, H. (2006). A proof for the Longest Job First Policy in one machine Scheduling. CA: Naval Research Logistics.

Corbet. (2006, March 22). Corpet. Retrieved October 29, 2011

CS/CPE408. (2001, June 4). Projects. Retrieved October 29, 2011, from Bridge Port:

Dalibor, K., Rudova, H., Raneiri, B., Marco, P., & Capannini, G. (2005). Comparison of Multi-Criteria Scheduling. Inter,

Dong, H. (2005) MSc Thesis. Delaying Convoy. Naval Postgraduate School, Computer Science. California: Unpublished.

EE442. (2222, 2 121).[online]. Retrieved October 29, 2011, from Schoool web site:

www.eee.metu.edu.tr/~halici/courses/442/442index.html

Ernst, B. W., Schroeder, B., & Urvoykella, G. (2007). Scheduling in Practice. Journal of Parallel Processing, 34 (4), 2-7.

Fluhrer, S., Itsik, M., & Adi, S. (2001). Weakness in the Key Scheduling Algorithm of RC4.

Proceedings 01 SAC Revised papers from the 8th Annual workshop in Cryptography (pp. 1-24). London: Springer.

Galvin, P. B., Abrahm, S., & Gagne, G. (2004). Operating System Concepts (7th Edition ed.).

(B. Zobrist, K. Santor, & M. Lesure, Eds.) NJ, USA: John Wiley and Sons Inc.

Gerald, S., Garima, K., & P, S. (2004). Job Fairness in Non-preemptive Job Scheduling.

International Journal on Parallel Processing, 186-194.

Haziza, F. (2007). Uppsala University. Uppsala University, Department of Computer System. Sweden: Unpublished.