Comsci 2101 Chapter 4 Part 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Xhage.

COMSCI 2101: OPERATING SYSTEM


Genalyn Sebbey

Chapter 4 Part 1
PROCESSOR MANAGEMENT

This is how the computer runs multiple processes simultaneously … you do a few steps on one
process, get interrupted, work on other processes, then return to the first process, remembering
where you left off from, and continue on.

Pre-emptive Scheduling Policy - swapping of processes

What is a process?
 The basic unit of execution in the operating system.
 “Process” is the name we give to a program when it is running in memory
 The application may be a program written by a user, or a system application.
 Users may run many instances of the same application at the same time, or run many
different applications.
 The process only exists for the duration of executing the application.

The Processor Manager is made up of two sub-managers:

 Job Scheduler (High level scheduler)


 Process Scheduler (Low level Scheduler)

JOB SCHEDULER
 We describe a collection of processes as a “job”.
 When the operating systems is presented with a queue of jobs or processes to run, the
Job Scheduler has the task of deciding which order to run the jobs in.
 The Job Scheduler wants to ensure that all components of the operating system are
busy, and there is no component that is idle.

I/O-bound process  spends more time doing I/O than computations, many short CPU bursts
CPU-bound process  spends more time doing computations; few very long CPU bursts

If the job scheduler gets job like this:


I/O Heavy CPU Heavy

So the job scheduler will take these jobs and swap


them around, and pass them onto Process
Scheduler

Sevile.
Xhage.

So, in this case the Job Scheduler wants to balance the jobs coming in, so that the components of the
operating system are all kept busy.

 If we don’t change the order of job, the CPU will be very busy, but the I/O component will be
idle, and then vice versa.
 This is not an optimal use of resources, so we swap them around.

Process Status  Every process has a field that records their current status

When the process is first passed to the Job Scheduler from the operating system, its status is always
set as HOLD.

When the Job Scheduler passes the process onto the Process Scheduler, its status is always
changed to READY.

PROCESS SCHEDULER
 assigns the CPU to execute processes of those jobs placed on ready queue by Job
Scheduler

After a job has been placed on the READY queue by Job Scheduler, Process Scheduler takes over.

 Determines which jobs will get CPU, when, and for how long.
 Decides when processing should be interrupted.
 Determines queues job should be moved to during execution.
 Recognizes when a job has concluded and should be terminated.

CPU Cycles and I/O Cycles


 To schedule CPU, Process Scheduler uses common trait among most computer
programs: they alternate between CPU cycles and I/O cycles.

Processor Manager: Middle-Level Scheduler


 In a highly interactive environment, there’s a third layer called middle-level scheduler.
 Removes active jobs from memory to reduce degree of multiprogramming and allows
jobs to be completed faster.
 The jobs that are swapped out and eventually swapped back in are managed by the
middle-level scheduler.

Job Status - one of the 5 status


that a job takes as it moves
through the system.

HOLD
READY
WAITING
RUNNING
FINISHED

Sevile.
Xhage.

Process Control Block (PCB)  data structure that contains basic info about the job

 Process identification
 Process status (HOLD, READY, RUNNING, WAITING)
 Process state (process status word, register contents, main memory info, resources, process
priority)
 Accounting (CPU time, total amount of time, I/O operations, number input records read, etc.)

PCBs and Queuing

PCB of job created when Job Scheduler accepts it updated as job goes from beginning to
termination.

Queues use PCBs to track jobs.


 PCBs, not jobs, are linked to form queues.
 E.g., PCBs for every ready job are linked on READY queue; all PCBs for jobs just entering
system are linked on HOLD queue.
 Queues must be managed by process scheduling policies and algorithms.

Sevile.

You might also like