Opereting System
Opereting System
INTRODUCTION
An Operating System (OS) is an interface between
a computer user and computer hardware. An
operating system is a software which performs all
the basic tasks like file management, memory
management, process management, handling input
and output, and controlling peripheral devices
such as disk drives and printers.
Some popular Operating Systems include Linux
Operating System, Windows Operating System.
Memory Management
Process Management
Device Management
File Management
Security
Coordination between other software and
users
The first operating system was introduced in the
early 1950's, it was called GMOS and was created
by General Motors for IBM's machine.
Disadvantages
1. symmetric
2. asymmetric multiprocessors.
1. Symmetric Multiprocessors
2. Asymmetric Multiprocessors
In asymmetric systems, each processor is given a
predefined task. There is a master processor that
gives instruction to all the other processors.
Asymmetric multiprocessor system contains a
master slave relationship..
Reliable
Enhanced throughput
Disadvantage
IncreasedExpense
Complicated Operating System Required
Large Main Memory Required
Spooling is an acronym for simultaneous peripheral operations
on line.
TAIL HEAD
CPU takes
New
process
process
from here
added
here
It is simple scheduling algorithm.
Disadvantages
The average waiting time is often long.
Not suitable for time sharing system.
It may cause of convoy effect, where all other processes
wait for a long process to get off the CPU.
Let all the process arrive at the time 0.
averageturn around
time=(21+24+30+32)/4=26.75 ms
Waiting time for process P1=0
Waiting time for process P2=21
Waiting time for process P3=24
Waiting time for process P4=30
Averagewaiting
time=(0+21+24+30)/4=18.75 ms
This is very good CPU Scheduling algorithm.
The idea is that the job that has the smallest next cpu
burst is allocated to the CPU for execution first.
Where more than one jobs have same length of next
CPU burst the FCFS scheduling is used.
This scheduling should be known as shortest next
CPU burst rather than shortest job first.
Itis optimal cpu scheduling algorithm in connection
with waiting time.
Disadvantage
It can not be implemented for the short term scheduler
since there is no way to find the length of the next
CPU burst.
Process CPU Burst Time
P1 7
P2 5
P3 2
P3 P2 P1
0 2 7 14
Turn around time for process P1=14-0
Turn around time for process P2=7-0
Turn around time for process P3=2-0
Average turn around time =(14+7+2)/3=7.6 ms
Waiting time for process P1=14-7=7
Waiting time for process P2=7-5=2
Waiting time for process P3=2-2=0
Average waiting time=(7+2+0)/3=3 ms
In the Non Preemptive Priority scheduling, The
Processes are scheduled according to the priority
number assigned to them. Once the process gets
scheduled, it will run till the completion. Generally,
the lower the priority number, the higher is the
priority of the process. Priority can be decided based
on memory requirements, time requirements or any
other resource requirement.
If processes have equal priority then FCFS is used.
There may be a number of criteria for the priority
scheduling . It is very useful scheduling.
Disadvantage
Starvation is the major problem with priority
scheduling ie some low priority processes are waiting
indefinitely for the cpu.
Process Arrival time Burst time Priority
P1 0 5 2
P2 0 2 3
P3 0 6 1
P3 P1 P2
0 6 11 13
Turn Around time for P1=11-0
Turn Around time for P2=13-0
Turn Around time for P3=6-0
P1 P2 P3 P4 P1 P5 P6 P2 P5 P6
0 3 6 9 10 12 15 18 21 23 24
Turn Around time for P1=12-0 ie 12
Turn Around time for P2=21-1 ie 20
Turn Around time for P3=9-2 ie 7
Turn Around time for P4=10-3 ie 7
Turn Around time for P5=23-4 ie 19
Turn Around time for P6=24-6 ie 18
Average turn around time=
(12+20+7+7+19+18)/6=>13.8 ms
Waiting time for P1=12-5 => 7
Waiting time for P2= 20-6 => 14
Waiting time for P3= 7-3 =>4
Waiting time for P4= 7-1 => 6
Waiting time for P5= 19-5 => 14
Waiting time for P6= 18-4 => 14
P1 P2 P4 P1 P3
0 2 7 10 16 25
Turn Around time for P1=16-0 ie 16
Turn Around time for P2=7-2 ie 5
Turn Around time for P3=25-3 ie 22
Turn Around time for P4=10-4 ie 6
Average
Turn Around time=
(16+5+22+6)/4=>12.25 ms
Waiting time for P1=16-8 => 8
Waiting time for P2= 5-5=> 0
Waiting time for P3= 22-9 =>13
Waiting time for P4= 6-3 => 3
Disadvantages
The process can not move between queues that
provide inflexibility.
If a process that waits too long time in a lower priority
queue may cause starvation.
One of the major disadvantage of multilevel queue
scheduling is indefinite postponement of lower
priority processes. To eliminate this problem the
multilevel feedback queue allows to move processes
between queues.
Here idea is that processes are prioritized according to
the CPU time, so that I/O bound processes found
higher priority than CPU bound processes. So I/O
bound processes are put in upper queues and CPU
bound processes are put in lower queues.
Processes that wait to much time in lower
queue may be moved to higher priority
queue . This is called aging.
Aging is solution of starvation problem
Process Burst time Arrival time
P1 0 0
P2 29 19 9 0 0
P3 0 0
P4 0 0
P5 12 2 0 0
TQ=10
READY QUEUE P1 P2 P3 P4 P5 P2 P5 P2
P1 P2 P3 P4 P5 P2 P5 P2
0 10 20 23 30 40 50 52 61
UNIT-3
Memory Management
Memory management is the functionality of an
operating system which handles or manages primary
memory and moves processes back and forth between
main memory and disk during execution. Memory
management keeps track of each and every memory
location, regardless of either it is allocated to some
process or it is free. It checks how much memory is
to be allocated to processes. It decides which process
will get memory at what time. It tracks whenever
s om e m e m o r y g e t s fre e d o r u n a l l o c a t e d a n d
correspondingly it updates the status.
Each process has a separate memory space. Separate
per process memory space protects the process from
each other and is fundamental to having multiple
processes loaded in memory for concurrent execution.
To separate memory space we need the ability to
determine the range of legal addresses that the process
may access and to ensure that the process can access
only these legal addresses.
We can provide this protection by using two registers
– base register and limit register.
Base
register- holds the smallest legal physical
memory address.
M-n n