Process Management in Operating Systems: Scheduling, Policies, and Algorithms, Exercises of Operating Systems

A lecture note from University of Bedfordshire covering the topic of process management in operating systems. It includes an introduction to the concept of a process, process status, process control block, multithreading, and process scheduling policies and algorithms. The document also discusses various scheduling algorithms such as First-Come-First-Served (FCFS), Shortest Job First (SJF), and Round Robin.

Typology: Exercises

2021/2022

Uploaded on 09/27/2022

journalyyy
journalyyy 🇬🇧

4.6

(13)

215 documents

1 / 35

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Operating Systems
Lecture #6:Process Management
Written by David Goodwin
based on the lecture series of Dr. Dayou Li
and the book Understanding Operating Systems 4th ed.
by I.M.Flynn and A.McIver McHoes (2006)
Department of Computer Science and Technology,
University of Bedfordshire.
Operating Systems, 2013
04th March 2013
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23

Partial preview of the text

Download Process Management in Operating Systems: Scheduling, Policies, and Algorithms and more Exercises Operating Systems in PDF only on Docsity!

Operating Systems

Lecture #6: Process Management

Written by David Goodwin

based on the lecture series of Dr. Dayou Li

and the book Understanding Operating Systems 4 thed.

by I.M.Flynn and A.McIver McHoes (2006)

Department of Computer Science and Technology,

University of Bedfordshire.

Operating Systems, 2013

04 th^ March 2013

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Outline

1 Introduction

2 Scheduling

3 Process status

4 Process control block

5 Multithreading

6 Process scheduling policies

7 Process scheduling algorithms

8 summary

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction 4 Scheduling Process status Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

PROCESS MANAGEMENT CONCEPTS

ˆ Concept of a process

ˆ Terminology ˆ Job (also known as program) is an inactive unit such as a file in disk ˆ This entity contains at least two types of elements: program code and a set of data ˆ Process (also called task) is an executed program code on the processor, that is, a part of an active entity ˆ a Thread is a portion of a process that can be run independently ˆ (^) In multiprogramming environment, the processor is used by multiple programs/processes ˆ (^) Process manager needs to arrange the execution of the programs/processes (to make a schedule for them) to promote the most efficient use of resources (including hardware and software) and to avoid competition and deadlock

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling 5 Process status Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Scheduling

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling 7 Process status Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Process Sheduler

ˆ Common trait among most computer programs: they

alternate between CPU cycles and IO cycles

ˆ Process scheduler is a low-level scheduler that assigns CPU

the execute the processes of those jobs placed in the ready

queue by the job scheduler.

ˆ Although CPU cycles vary from program to program, there

are some general types of jobs:

ˆ (^) IO-Bound jobs e.g. printing a series of documents. Many brief CPU cycles and long IO cycles. ˆ (^) CPU-Bound jobs e.g. finding the first 300 prime numbers. Long CPU cycles and shorter IO cycles. ˆ Total statistical effect approximates a Poisson distribution.

ˆ Highly interactive environment has a third level - begin a

middle-level scheduler - finding it advantagious to remove

active jobs from memory; allowing jobs to complete faster.

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status 8 Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Process status

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status 10 Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

PROCESS STATUS

ˆ Five-state model

ˆ States ˆ (^) Running: the process is currently executed on the processor ˆ Ready: a process is prepared to execute ˆ (^) Waiting: a process waits for resources ˆ Hold: a process is just created ˆ (^) Exit: a process is released from pool of executable programs by OS

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status 11 Process control block Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

PROCESS STATUS

ˆ State transitions:

1 HOLD to READY: ˆ When OS is prepared to take an additional process. Initiated by job scheduler; availability of memory and devices checked. 2 READY to RUNNING: ˆ Process scheduler chooses a ready process to execute. 3 RUNNING to EXIT: ˆ Currently executed process has completed or a run time error. Initiated by job or process scheduler. 4 RUNNING to WAIT: ˆ (^) Handled by process scheduler, initiated by job instruction for I/O or other resources request. 5 WAIT to READY: ˆ Handled by process scheduler, initiated when I/O or other resources become available. 6 RUNNING to READY: ˆ Handled by process scheduler; maximum allowable time is reached or other criterion e.g. a priority interrupt.

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block 13 Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Process Control Blocks

Process control block (PCB): Any process is uniquely characterised by a list of elements: ˆ Identifier: a unique identifier which distinguishes a process from others ˆ State: a process can have different states ˆ (^) Priority: this shows the priority level of a process relative to other process ˆ (^) Program counter: the address of the instruction to be executed next of a process (program code) ˆ (^) Memory pointers: include those point to program code and data associated of a process, plus any memory blocks shared with other processes ˆ (^) Context data: These are date that are presented in registers in the processor while a process is running ˆ (^) I/O status information: includes I/O requests and the availability of files and I/O devices ˆ Accounting information: includes time and number countered

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block 14 Multithreading Process scheduling policies Process scheduling algorithms summary

Operating Systems

Process State

ˆ This contains all of the information needed to indicate the

current state of the job such as:

process status word current instruction counter and register

contents when a job isn’t running.

register contents if the job has been interrupted and is

waiting.

main memory information including the address where the

job is stored.

resources information about all resources allocated to

the job, being hardware units or files.

process priority used by systems with priority scheduling

algorithm.

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block Multithreading^16 Process scheduling policies Process scheduling algorithms summary

Operating Systems

Multithreading

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block Multithreading^17 Process scheduling policies Process scheduling algorithms summary

Operating Systems

PROCESS MANAGEMENT

Multithreading

ˆ Multithreading

ˆ A process can be divided into multiple threads ˆ (^) Multithreading is a “condition” for a processor manager to make a schedule for multi-processes ˆ (^) An example of a process and threads

ˆ Get input for Job A ˆ (^) Identify resources ˆ Execute the process ˆ (^) Interrupt ˆ Switch to Job B ˆ Get input for Job B ˆ (^) Identify resources ˆ Execute the process ˆ (^) Terminate Job B ˆ Switch back to Job A ˆ (^) Resume executing interrupted process ˆ (^) Terminate Job A

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block Multithreading Process scheduling 19 policies Process scheduling algorithms summary

Operating Systems

Process scheduling policies

ˆ A good process scheduling policy:

ˆ Maximise throughput - run as many jobs as possible in a given amount of time ˆ Minimise reponse time - quickly turn around interactive requests ˆ Minimise turnaround time - move entire jobs in and out of the system quickly ˆ (^) Minimise waiting time - move jobs out of the ready queue as quickly as possible ˆ (^) Maximise CPU efficiency - keep the CPU busy 100% of the time ˆ (^) Ensure fairness for all jobs - give every job an equal amount of CPU and IO time

ˆ A scheduling strategy that interrupts the processing of a job

and transfers the CPU to another job is preemptive

scheduling policy

ˆ The alternative is nonpreemptive scheduling policy which

functions without external interrupts

Lecture #6 Process Management David Goodwin University of Bedfordshire

Introduction Scheduling Process status Process control block Multithreading Process scheduling policies Process scheduling 20 algorithms summary

Operating Systems

Process scheduling

algorithms