0% found this document useful (0 votes)
30 views17 pages

Process Management

Uploaded by

dc1901020
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)
30 views17 pages

Process Management

Uploaded by

dc1901020
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/ 17

Process Management

16.1 Purpose of an operating system


Multitasking
• Multitasking – function which allows a computer to process more than
one task or process at a time
Multitasking
How a computer multitasks:
• In order for multitasking to function smoothly scheduling is used to
decide which process is carried out first using various types of methods
• This allows to computer resources to give the illusion that it is
multitasking however in reality each process is being run stage by stage
by monitoring the state of each process
• There are 2 types of multitasking in the operating systems:
- preemptive
-non-preemtive
The Process States
• Process: a program in memory with an associated process control
block
• Process control block (PBC) : a complex data structure containing all
data relevant to the running of a process
• Thread: part of a program that is handled as an individual process
when being executed
Process states
The transitions between the states is described as follows.
• A new process arrives in memory and a PCB is created; it changes to the ready
state.
• A process in the ready state is given access to the CPU by the dispatcher; it changes
to the running state.
• A process in the running state is halted by an interrupt; it returns to the ready state
and cannot progress until some event has occurred (like Input /Output); it changes
to the waiting state aka the ‘suspended’ or ‘blocked’ state.
• A process in the waiting state is notified that an event is completed; it returns to the
ready state.
• A process in the running state completes execution; it changes to the terminated
state.
The Process States
A new process arrives in memory and a PCB is
created; it changes to the ready state.
A process in the ready state is given access to
the CPU by the dispatcher; it changes to the
running state.
A process in the running state is halted by an
interrupt; it returns to the ready state and
cannot progress until some event has occurred
(like Input /Output); it changes to the waiting
state aka the ‘suspended’ or ‘blocked’ state.
A process in the waiting state is notified that
an event is completed; it returns to the ready
state.
A process in the running state completes
execution; it changes to the terminated state.
Multitasking Types
Preemptive Non-preemptive
• Resources are allocated to a • The process retains each process
process for a limited time until it has completed it burst time
• The process can be interrupted • The process cannot be interrupted
(must finish or switch to waiting
• Frequent high priority processes state)
tend to starve low priority
• If a process with a long burts time
processes of resources runs in the CPU, those with shorter
• Has a more flexible form of burst times are starved of resources
scheduling • More rigid form of scheduling
Scheduling
Scheduling: a process manager which handles the removal of running
programs from the CPU and the selection off new processes
High level scheduling: makes decisions about which program stored on the
disk should be moved into memory
Low level scheduling: makes decisions about which process stored in memory
should have access to the CPU

Purpose of scheduling:
• Ensures efficient usage of the CPU4
Scheduling
• A high level scheduler program controls the selection of a program to
be moved to onto the main memory
• When a program is installed in memory the low level scheduler
controls when it has access to the CPU
• Its objective is to maximise the system and maintain a stable
performance of the operating system
Scheduling Methods
• There are 4 types of scheduling methods:

1. Round Robin
2. Shortest job first
3. First come first serve
4. Shortest remaining time
Robin Round
• allocates a time slice to each process and is therefore preemptive,
because a process will be halted when its time slice has run out. It can
be implemented as a FIFO queue.
• It normally does not involve prioritising processes.
• If separate queues are created for processes of different priorities then
each queue could be scheduled using a round-robin algorithm.
Shortest Job first
• This is a non-preemptive algorithm and can be implemented by
placing the processes in a first-in first-out (FIFO) queue.
• The algorithm will be very inefficient if it is the only algorithm
employed but it can be used as part of a more complex algorithm.
• It was made to aim at reducing the time wasted in waiting . Therefore
in order to do this the shortest job is placed first in ore to be processed
and completed
First Come first Served
• The data is added to the queue structure using the FIFO(First in First
Out) Principle.
• The first process to enter the queue is processed first regardless of the
priority or the burst time (time taken to complete the task)
• In such cases the average waiting time is longer.
Shortest remaining time first
• With the shortest remaining time the processes are placed in a ready
queue as they arrive however if a process with a shorter burst time(a
shorter time of completion) than the one being processed then the
current process is preempted
• This makes the SRTF a preemptive algoritm (it allows interruption of
processes midway)
Scheduling methods
• The First come first serve algorithm generally takes the longest
• Followed by the robin round
• Then shortest job first
• With Shortest remaining time first
Kernel
• This is a part of the operating system.
• It acts as an interrupt handler and hides the complexities of the Operating
system from the users.
Interrupt handling is used to manage low-level scheduling.
• The CPU will check for interrupt signals if there is one the CPU will
enter kernel mode.
• In this mode the kernel will check the interrupt dispatch table to find an
appropriate interrupt handling routine
• The kernel then dispatches this IHR and save the state of the interrupt
processes in a stack
• These interrupts are prioritised using interrupt prioritised levels
Thank You!!!
By Avril Mukanyangi

You might also like