Vous êtes sur la page 1sur 9


This document contains some basic definitions in Operating Systems. I

have referred Operating System Concepts by Galvin et al. Please read the
boo once and have a glance at this. !ou "ill have a good understanding only
"hen you read the boo once or t"ice. I have covered Process management and
#emory management only. I "ould say this "ould do for Campus placements.
OS Components
Process management
#ain$memory management
%ile #anagement
I&O management
Secondary storage management
Protection management
Command$Interpreter system
The interface bet"een the user and the operating system.
System call
The interface bet"een the process and the operating system.
In this type of ernel( all the non$essential components are removed from
the ernel and they are implemented as system and the user level programs.
Thus resulting to a S#)**+, -+,'+*( that typically provides minimal process
and memory management in addition to communication facility.
It is a program in e.ecution.
It is an instance of a program.
It is an active entity( "hile the program is a passive entity. /i.e.( activation
of a program becomes a process0
It is a unit of "or in a system.
Process States
Context Switch
Saving the state of old process and loading the saved state of the ne"
Cooperatin! Process
) process is co$operating if it can affect or be affected by the other
processes e.ecuting in the system.
It is a called a light"eight process and is a basic unit of CP1 utili2ation.
#i$$erences %etween Process an" Threa"s
The basic difference is that every process has its o"n process id( code
section( data section( stac and a register set and. 3hile a thread has its o"n
thread id( stac and a register set( but it shares the data and code section "ith all
the others threads of the process it belongs to.
It is used in 1'I4 system to notify a process that a particular event has
Metho"s $or IPC &InterProcess Comm'nication(
Shared buffer
)ren"e*+o's, con"ition
In message passing( it is the condition in "hich both the sender and the
receiver are bloced until the message is delivered.
-on!term Sche"'ler &.o% Sche"'ler(
This loads the process into the memory for e.ecution.
Shortterm Sche"'ler &CP/ Sche"'ler(
This selects the process from the ready 5ueue and allocates CP1 to it.
#e!ree o$ M'ltipro!rammin!
It is the number of processes currently present in memory.
Me"i'mterm Sche"'ler
It does s"apping of processes( to control the degree of multiprogramming
and to have a good process mi. /the mi.ture of CP1$bound and I&O$bound
Nonpreempti+e Sche"'lin!
1nder this( once the CP1 has been allocated to a process( the process
eeps the CP1 until it releases the CP1 either by terminating or by s"itching to
the "aiting state.
Preempti+e Sche"'lin!
6ere( the process releases the CP1 under the compulsion of other
The module that gives the control of CP1 to the process selected by the
CP1 scheduler.
#ispatch -atency
The time taen for the dispatcher to stop one process and to start another
T'rnaro'n" Time
The interval from the time of submission of a process to the time of
completion is the turnaround time.
0aitin! Time
It is the sum of the periods spent "aiting in the ready 5ueue.
CP/ Sche"'lin! Al!orithms
1irst Come 1irst Ser+e" &1C1S(
o This is 7ust a %I%O 5ueue.
Shortest .o% 1irst &S.1(
o This is also called shortest ne.t CP1 burst scheduling.
o It can be both preemptive and non$preemptive.
o The other name for preemptive S8% is called shortest$remaining
time first scheduling.
Priority Sche"'lin!
o This can also be both preemptive and non$preemptive.
o Preemptive priority scheduling suffers from the starvation
problem. This problem can be avoided using aging. )ging is the
method used to increase the priority of a process.
Ro'n" Ro%in &RR( sche"'lin!
o Generally( it is %C%S scheduling "ith preemptive added to it.
o ) time 5uantum /time slice0 is defined and one by one the process
in the ready 5ueue is allo"ed to use the CP1 only for this time
5uantum. )fter a process has finished its time 5uantum( it is
preempted and the ne.t process in the 5ueue is given the CP1.
o The ready 5ueue used here is a circular 5ueue.
M'ltile+el Sche"'lin!
o This scheduling partitions the ready 5ueue into several separate
o The processes are assigned permanently to one 5ueue( generally
based on some property of the process( such process type /lie
bacground or foreground processes0( process memory si2e(
process priority and etc.
o +ach 5ueue has it o"n scheduling algorithm. In addition( there
must be scheduling among the 5ueues( no" as fi.ed$priority
preemptive scheduling.
M'ltile+el 1ee"%ack 2'e'e Sche"'lin!
o The setup is same as that of the multilevel 5ueue scheduling. 9ut
here( the processes are allo"ed to move bet"een 5ueues. /i.e.0 If a
process uses too much of CP1 time( it "ill be moved to a lo"er
priority 5ueue and if a process "aits too long in a lo"er priority
5ueue( it may be moved to a higher priority 5ueue.
o This scheduling is the most general scheme and is also the most
0in"ows Sche"'lin! Scheme
3indo"s uses priority scheduling. It has some nearly : priorities for
processes. The priorities are as follo"s in the descending priority order(
o ,+)*;TI#+;P,IO,IT!;C*)SS
o 6IG6;P,IO,IT!;C*)SS
o )9O<+;'O,#)*;P,IO,IT!;C*)SS
o 'O,#)*;P,IO,IT!;C*)SS
o 9+*O3;'O,#)*;P,IO,IT!;C*)SS
o I=*+;P,IO,IT!;C*)SS
-in'x Sche"'lin! Scheme /,efer the boo0
*inu. uses credit based algorithm. +very process has its o"n priority and
a >nice? value. It uses this t"o to find the credit and thus the credit based
scheduling. *inu. uses %C%S and ,, to support Soft$,eal time scheduling.
Priority In+ersion
The situation "hen a high$priority process "ould be "aiting for a lo"er$
priority one to finish.
Critical Section
The segment of code in "hich the process may be changing common
variables( updating a table( "riting a file and so on.
Re3'irements to %e satis$ie" %y the sol'tion $or Critical Section pro%lem
o #utual +.clusion
o Progress
o 9ounded 3aiting
4akery Al!orithm /,efer the boo for code and e.planation0
) multiple process solution for critical section problem.
5ar"ware sol'tions $or Critical Section pro%lem /,efer the boo for code0
o Testandset /0
o S"ap /0
It is a synchroni2ation tool used to solve critical section problem. It is an
integer variable and can be accessed only through t"o standard atomic
operations( "ait/0 and signal/0.
4inary Semaphore
This is a type of semaphore and it can tae values @ and A only.
Spin locks
It is a semaphore variable that puts the process to busy "aiting state.
4'sy 0aitin! state
The repeated e.ecution of a loop of code "hile "aiting for an event to
occur is called busy "aiting. The CP1 is not engaged in any real productive
activity during this period.
3e say that a set of process is in deadloc state "hen every process in
the set is "aiting for an event that can be caused only by another process in the
Indefinite blocage for a process to e.ecute.
Classic pro%lems o$ synchroni*ation
/6ave the implementation code ready for these problems0
9ounded 9uffer problem
,eaders$3riters problem
=ining Philosophers problem /most important of these0
o B philosophers( B chopstics and a bo"l of food.
o =eadloc is possible here.
o #onitors are used to prevent deadlocs. /,ead the code0
Necessary con"itions $or #ea"lock sit'ation
o #utual +.clusion
o 6old and "ait
o 'o Preemption
o Circular 3ait
#ea"lock Pre+ention
It is a set of methods for ensuring that at least one of the necessary
conditions cannot hold.
#ea"lock A+oi"ance
It re5uires that the OS be given in advance additional information
concerning "hich resources a process "ill re5uest and use during its lifetime.
3ith this no"ledge( "e can decide for each re5uest "hether or not the process
should "ait( thus avoiding deadlocs.
-o!ical A""ress &6irt'al A""ress(
)ddress generated by the CP1.
Physical A""ress
)ddress seen by the memory unit.
-o!ical A""ress space
The set of all logical addresses generated by a program.
Physical A""ress space
The set of all physical address corresponding to these logical addresses.
Overlays are piece of programs that are dynamically loaded by the OS
"hen needed. The splitting of the programs to overlays /pieces0 is done by the
) bloc of available memory.
#i$$erent #ynamic Stora!e Allocation schemes
o 1irst $it $ )llocate the first hole that is big enough.
o 4est $it $ )llocate the smallest hole that is big enough.
o 0orst $it $ )llocate the largest hole.
External 1ra!mentation
It e.ists "hen enough total memory space e.ists to satisfy a re5uest( but it
is not contiguous( i.e.( the storage is fragmented to large number of small holes.
One of the solutions to e.ternal fragmentation. The goal is to shuffle the
memory contents to place all free memory together in one bloc. This is can be
used only if the relocation is dynamic.
Internal 1ra!mentation
Physical memory is broen do"n to fi.ed si2ed blocs. The processes are
allocated memory in unit of bloc si2es. 3ith this approach( the memory allocated
may be slightly greater than the re5uired one. This difference in memory is called
internal fragmentation.
1rames an" Pa!es
o 1rames $ Physical memory is broen into fi.ed si2ed blocs called
o Pa!es $ *ogical memory is broen into blocs of same si2e called
It is a memory management scheme that permits the physical address
space of a process to be non$contiguous. 6ere "e have no e.ternal
fragmentation and may have some internal fragmentation.
Pa!e a""ress calc'lation
If the si2e of logical address space is CDm and a page si2e is CDn( then the
high order /m$n0 bits of a logical address designate the page number and the lo"
order /n0 bits designate the page offset.
Page Table 9ase ,egister. It points to the page table of the current
Translation *oo$aside 9uffer. 1sed in the paging mechanism.
Reentrant Co"e
It is non$self modifying code. The code never changes during e.ecution.
'o global variables are used here.
Page Number (m-n bits) Page Offset (n bits)
Se!mentation /,efer the boo0
6irt'al Memory
<irtual memory is the separation of user logical memory from physical
memory. This separation allo"s an e.tremely large memory to be provided to the
programmers "hen only a smaller physical memory is available.
<irtual memory can be implemented using demand paging or demand
#eman" Pa!in!
) demand paging system is similar to paging system "ith s"apping added
to it.
Pa!e 1a'lt
3hen a process tries to access a page that "as not brought into memory
by the pager( i.e.( the page is available in the secondary storage and not in the
#irty 4it
=uring page replacement( every page is checed for this bit. If this bit is
set( then that page has been modified since it is read from the dis.
Pa!e Replacement Al!orithms
1I1O Pa!e Replacement
o This is easiest to implement( but less efficient.
o It suffers from 9elady?s )nomaly.
Optimal Pa!e Replacement
o This is the most efficient "ith lo"est page faults.
o 9ut this cannot be implemented in real( co2( it re5uires for the
information of pages that are to come in future.
o So this algorithm is used only for the analysis purpose and not for
the real page replacement.
-east Recently /se" &-R/( Pa!e Replacement
o This can be implemented using
,eference bits
)dditional reference bits
-east 1re3'ently /ser &-1/( Pa!e Replacement
Most 1re3'ently /ser &M1/( Pa!e Replacement
4ela"y,s Anomaly
The situation in some page replacement algorithms "here the page fault
rate increases as the number of allocated frames increases.
) process is thrashing if it is spending more time on paging then
e.ecuting. If a process has less number of frames allocated than needed( then
that process thrashes.