0% found this document useful (0 votes)
27 views20 pages

Job Scheduling Group2-1

An algorithm in operating systems
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views20 pages

Job Scheduling Group2-1

An algorithm in operating systems
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

NATIONAL UNIVERSITY OF SCIENCE AND TECHNOLOGY

Program: B.Sc. Computer Science


Course Name: OPERATING SYSTEMS
Course Code: SCS1103
GROUP ASSIGNMENT :2
Topic: JOB SCHEDULING
GROUP NUMBER 2
GROUP MEMBERS

Last Name First Name Student Number

Dhliwayo Floyd N02221175G


Nxumalo Gugulethu N02215112W
Mabobe Makanaka N02214549B
Nyalugwe Samson N02217671M
Chikowore Michael N02219398C

Sikhosana Mawethu N02221224B


Tadhuvana Cynthia N02219780P
Siziba Bridget N02221244D
Mhlope Nkosikhona N02218747F
Manyengura Batsirai N02220241T
Compilers
1. Floyd Dhliwayo
2. Batsirai Manyengura

Researchers
3. Gugulethu Nxumalo
4. Makanaka Mabobe
5. Micheal Chikowore

Presenters
6. Samson Nyalungwe
7. Mawethu Sikhosana
8. Cynthia Tadhuvana
9. Bridget Siziba
10.Nkosikhona Mhlope
JOB SCHEDULING
What Does Job Scheduling Mean?

Job scheduling is the process of allocating system resources to


many different tasks by an operating system (OS). The system
handles prioritized job queues that are awaiting CPU time and it
should determine which job to be taken from which queue and the
amount of time to be allocated for the job. This type of scheduling
makes sure that all jobs are carried out fairly and on time.
Most OSs like Unix, Windows, etc., include standard job-scheduling
abilities. A number of programs including database management
systems (DBMS), backup, enterprise resource planning (ERP) and
business process management (BPM) feature specific job-
scheduling capabilities as well.
Explaining Job Scheduling
Job scheduling is performed using job schedulers. Job schedulers are programs that enable
scheduling and, at times, track computer "batch" jobs, or units of work like the operation of a
payroll program. Job schedulers have the ability to start and control jobs automatically by
running prepared job-control-language statements or by means of similar communication with
a human operator. Generally, the present-day job schedulers include a graphical user interface
(GUI) along with a single point of control.
Organizations wishing to automate unrelated IT workload could also use more sophisticated
attributes from a job scheduler, for example:
 Real-time scheduling in accordance with external, unforeseen events
 Automated restart and recovery in case of failures
 Notifying the operations personnel
 Generating reports of incidents
 Audit trails meant for regulation compliance purposes
In-house developers can write these advanced capabilities; however, these are usually offered
by providers who are experts in systems-management software.
In scheduling, many different schemes are used to determine which specific job to run. Some
parameters that may be considered are as follows:
 Job priority
 Availability of computing resource
 License key if the job is utilizing a licensed software
 Execution time assigned to the user
 Number of parallel jobs permitted for a user
 Projected execution time
 Elapsed execution time
 Presence of peripheral devices
 Number of cases of prescribed events
Types of job scheduling
Companies schedule jobs or batches through multiple types of scheduling processes. Below are three
common job scheduling types that IT teams use to optimize their environment.
 Long-term scheduling: A long list of items is ready for processing when new processes are created.
This requires substantial processing power and adds to overhead on the operating system. The OS
maintains a long list, and there’s an increase in context switching and dispatching. This type caters to
managing such a long list of processes. A long-term scheduler decides jobs that go into short-term or
medium-term schedulers' processing queue. It limits the processes that go into the queue based on
different processing algorithms.
 Medium-term scheduling: For some operating systems, a new process begins in a swapped-out
condition. A swap-out happens when a process is removed from the random-access memory (RAM)
and is added to the hard disk. This type is a part of the swapping function. When there’s free space in
the main memory, the scheduler decides which process can be swapped in. This depends on the
memory, priority, and other required resources. A medium-term scheduler often performs the swapping-
in function for swapped-out processes.
 Short-term scheduling: A short-term scheduler, also called a dispatcher, starts when a new event
occurs. This occurs more frequently and might interrupt a running process. Short-term schedulers are
fast and select new processes ready for execution, allocating CPU to one of them, which happens very
frequently.
Job scheduling algorithms

Short-term scheduling primarily uses job scheduling algorithms to allocate


processes and optimize system behaviour. Below are some common scheduling
algorithms or policies that impact which processes should be assigned to the
CPU.
FCFS scheduling algorithm
The first-come, first-serve (FCFS) job scheduling algorithm follows the first-in,
first-out method. As processes join the ready queue, the scheduler picks the
oldest job in the queue and sends it for processing. The average processing time
for these jobs is comparatively long.
 Jobs are executed on first come, first serve basis.
 It is a non-pre-emptive, pre-emptive scheduling algorithm.
 Easy to understand and implement.
 Its implementation is based on FIFO queue.
 Poor in performance as average wait time is high.

Below are the advantages and disadvantages of FCFS algorithms.


 Advantage: FCFS adds minimum overhead on the processor and is better
for lengthy processes.
 Disadvantage: Convoy effects occur when even a tiny job waits for a long
time to move into processing, resulting in lower CPU utilization.
Wait time of each process is as follows −

Average Wait Time: (0+4+6+13) / 4 = 5.75

Process Wait Time: Service Time - Arrival Time

P0 0-0=0

P1 5-1=4

P2 8-2=6

P3 16 - 3 = 13
SJF scheduling
Shortest job first (SJF), also known as shortest job next (SJN), selects a job that would require
the shortest processing time and allocates it to the CPU. This algorithm associates each
process with the length of the next CPU burst. A CPU burst is when processes utilize the CPU
before it’s no longer ready.
Suppose two jobs have the same CPU burst. The scheduler would then use the FCFS
algorithm to resolve the tie and move one of them to execution.

 This is also known as shortest job first, or SJF


 This is a non-pre-emptive, pre-emptive scheduling algorithm.
 Best approach to minimize waiting time.
 Easy to implement in Batch systems where required CPU time is known in advance.
 Impossible to implement in interactive systems where required CPU time is not known.
 The processer should know in advance how much time process will take.

Below are the advantages and disadvantages of the shortest job first scheduling.
 Advantage: The throughput is high as the shortest jobs are preferred over a long-run
process.
 Disadvantage: Records elapsed time that adds to additional overhead on the CPU.
Furthermore, it can result in starvation as long processes will be in the queue for a long
time.
Given: Table of processes, and their Arrival time, Execution time

Process Arrival Time Execution Time Service Time

P0 0 5 0

P1 1 3 5

P2 2 8 14

P3 3 6 8
Waiting time of each process is as follows −

Average Wait Time: (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25

Process Waiting Time

P0 0-0=0

P1 5-1=4

P2 14 - 2 = 12

P3 8-3=5
Priority scheduling

Priority scheduling associates a priority (an integer) to each process. The one with the highest
priority gets executed first. Usually, the smallest integer is assigned to a job with the highest
priority. If there are two jobs with similar priority, the algorithm uses FCFS to determine which
would move into processing.
 Priority scheduling is a non-pre-emptive algorithm and one of the most common scheduling
algorithms in batch systems.
 Each process is assigned a priority. Process with highest priority is to be executed first and so
on.
 Processes with same priority are executed on first come first served basis.
Priority can be decided based on memory requirements, time requirements or any other resource
requirement.

Below is an advantage and disadvantage of priority scheduling.


 Advantage: Priority jobs have a good response time.
 Disadvantage: Longer jobs may experience starvation.
Given: Table of processes, and their Arrival time, Execution time, and priority. Here we are
considering 1 is the lowest priority.

Process Arrival Time Execution Time Priority Service Time

P0 0 5 1 0

P1 1 3 2 11

P2 2 8 1 14

P3 3 6 3 5
Waiting time of each process is as follows −

Average Wait Time: (0 + 10 + 12 + 2)/4 = 24 / 4 = 6

Proces Waiting Time


s

P0 0-0=0

P1 11 - 1 = 10

P2 14 - 2 = 12

P3 5-3=2
Round robin scheduling
Round robin scheduling is designed for time-sharing systems. It’s a pre-emptive scheduler based on the clock and
is often called a time-slicing scheduler. Whenever a periodic clock interval occurs, the scheduler moves a currently
processing job to the ready queue. It takes the next job in the queue for processing on a first-come, first-serve
basis.
Deciding a time quantum or a time slice is tricky in this scheduling algorithm. If the time slice is short, small jobs get
processed faster.

 Round Robin is the pre-emptive process scheduling algorithm.


 Each process is provided a fix time to execute, it is called a quantum.
 Once a process is executed for a given time period, it is pre-empted and other process executes for a given time
period.
 Context switching is used to save states of pre-empted processes.

Below are some advantages and disadvantages of round-robin scheduling.


 Advantages: Provides fair treatment to all processes, and the processor overhead is low.
 Disadvantages: Throughput can be low if the time slice is concise.
Wait time of each process is as follows −

Average Wait Time: (9+2+12+11) / 4 = 8.5

Proces Wait Time: Service Time - Arrival Time


s

P0 (0 - 0) + (12 - 3) = 9

P1 (3 - 1) = 2

P2 (6 - 2) + (14 - 9) + (20 - 17) = 12

P3 (9 - 3) + (17 - 12) = 11
Shortest Remaining Time

 Shortest remaining time (SRT) is the pre-emptive version of the SJN algorithm.
 The processor is allocated to the job closest to completion but it can be pre-empted
by a newer ready job with shorter time to completion.
 Impossible to implement in interactive systems where required CPU time is not
known.
 It is often used in batch environments where short jobs need to give preference.
Advantages of Using a Job Scheduling Software

1. Makes tracking tasks easier


Tracking all of the tasks performed is a cumbersome task and almost impossible if one sets out to do it manually. A
job scheduling software works as a collaboration tool for employees, teams and managers alike as it helps
automate otherwise time taking tasks.
2. Saves resources
Manually assigning tasks, checking performance and gathering feedback from employees costs a lot of time and
money to a business which is cut down to almost zero by using a job scheduling software as everything is handled
by the software itself. The only cost you’ll incur is the cost of purchasing the job scheduling software.
3. Increases productivity
With a job scheduling software, you can create and assign new tasks to employees with the click of a button. This
helps eliminate the lag times when compared to doing it manually. Also, when tasks are assigned and completed
by employees or teams without unnecessary delay, the overall production of an organisation increases marginally.
4. Ensures Transparency
Once a task is assigned to an employee with a job scheduler, the employee is solely accountable for the
completion or failure of the task assigned to him. Also, as mentioned in the first benefit, the tasks assigned to a
person are totally transparent and anyone in the organisation can have a look at it using the job scheduling
software, which makes the system reliable and easy to monitor as well.

You might also like