Kud Notes
Kud Notes
Kud Notes
Chapter I
Introduction
hardware resources
Ex: Windows, Linux., OS
Software resources memory managemeni. process, file management etc
Hardware resources HDD, RAM, LO devices
Operating Systems
ii) Memory Management:- The major function operating system is to
resources of
computers. Out of which main
manage the
modern computers system memory plays key role in the operation of a
Main memory is
repOsitory of nun-time programs and the relevant data being accessed
and shared by CPU or processor l O devices
syslems as well
compuler communicalion network like IAN WAN and distribuled
Network opeiating sy>lcm (NOS) ulso munage networks rouling, control data tualtie
ii) Loaders and Linkers:- for program loading execution. The system programs such as
Absolute loaders, re-lockable loaders.
-Linkage, editors, linkers, overlay loaders help assets placing (loading) the assembled
and/or compiler code (object program) into main memory and transfer CPU control to the
first instructors at which the program execution has to begin.
ii) Text editors for file modification and file manipulation: A system programs such
as screen cditors, line editors, Morton editors and several other text editors
iv) Application program (system utilities for command user needs): A system
program has applications or utilities such as world processor (M.S world), web browser
(net scope navigators, internet explorer (1E) M.S Excel)
DBMS packages (ADD) for plotting
6) What are Loosely Coupled and Tightly Coupled systems (Parallel systems)"
2013
Ans:-i) Loosely Coupled:- In this system each & every processors has separate memory
(11s own memory). The processors can communicale with each other, but individually
processors can directly access its own 'Local Memory
- Loosely Coupled systems employs asymmetric muluprocessng which cach slave
processor (CPU) 1s assigned a speciflic lask and execule user job in parallel, where as a
sungle master processor (CPU) control & co-ordinate actuvities of the slave processor
- It is poss1ble to assign several slave processor (CPU) to execule single user job in
Parallel, in such case given job is broken into Modules
PU CPU CPU
Slave Slave Slave
processor procssor
processor
Man e t i o r
Mau euory Man ueuory Ma niemory
Fgure T Loosely-coupled Asymuneruc Multuprocessng archiecture of Paralel System
With Symmetric
muluprocessor
Master-slave relationsh1p among
ISs no
* * : : - = :
CPU
.---
MAIN MEMORY
architecture of Parallel System
Tightly Coupled System Multiprocessing
shares
-Even it can perform parallel execution of a single user job. Since processor
common memory and executes simultancously
have a max1mum of 16 pees CPU's acccssing
Tightly Coupled parallel system can
common memory, there are also know as shared memory parallel compulers
system
Muluprogramming cvents makes OS to take certain decisions for the benefits of users
and bring the visibility to end-users
Time Shariag - Itis the logical extension of the multiprogramming. It also reiers Multi
tasking lts goal is to provide good response time to inleractive sessions of users
A Lume shared OS offers interactuve access time to numbers of end-users,
sumultaneously
T ume Sharnng support on line data processing and provides mechanism for concurTent
execution of jobs
It cconomically feas1ble duc lo several users inleractive access and almst no waslage of
CPU ume
Functions Of timesharing
it uses CPU schedul1ng and multiprogramming to provide each user with small portal of
ime shared computer terminal on time slice priority basis.
-it provides Multitasking and provides rapid user interactive with their termi1nals
Effectivesharing and quick response
- High degree of user interaction
proceSses
processes
processes
programmin9
kernel kernel kernel
interface
VM1 VM2 VM3
virtual m a c h i n e
manager
hardware
Page 7 47
Operating Systems
Chapter 2
Process Management
1) Define a process. 12011, 2014, 20151
Ans- The process carn be defined program in execution. Sometimes it referred to as Task.
It represents user job.
The process corresponds to more synthesized
version ofjob in OS environment.
-
Since process is always active or dynamic as it represents running state of program or
user job.
-
Here an active entity resides inside the Main Memory and finite number of sequence of
steps in execution.
-
It can in any one of the Ready, Running and Block states
2) Explain the process states and operations of processes. 2011, 2014, 2015, 2016|
Process States:
new admitted interrupt exit terminated
ready running
VO or event completion scheduler dispatcnVO or event wait
waiting
1) Ready 2) Running 3) Terminated 4) Blocked or Waiting
1)Ready The process 1s on the toes control over the CPU or Processer. That is, a ready
process is wailung to be assigned to a processor for continuing its exeeution
2) Running:- The process actually execuling its instruction by CPU or processor
3) Terminated:- The process has completely executed all instructions
4) Blocked or Waiting: - The process must wait lor some event to occur
Written By: Mahesh, NItin, Sunil
Operating Systems
3) Explain in details about PCB (process control 2014, 2015, 2016
block).
Ans
pointer process
state
p r o c e s s number
program c o u n t e r
registers
memory limits
list of o p e n files
A process switches between the running, ready and blocked states, many times, well
before its formal termination.
Each time when a particular process leaves the nunning state and yet does not encounter
its flag end, then its current state of status must be saved for feature reference.
a) Process state:- indication of the process state as Ready, Running, blocked or waiting
etc
b) Process number:- Suggest finds this process distinctly as process ID
c)Program counter:- it is register containing address of next instruction to be executed
of this Process
d) Registers:- A group of registers viz accumulators (A or AC) index registers, stack
pointers general purpose registers and condition codes.
e) CPU Scheduling information: - It suggests the details about the priority of the
process, poinlers to ready queue scheduling
Memory Management Information: - It suggests the details about Memory Usage by
this process
g) Accounting Information:- il suggest the details such as, the allocated CPU time-slice
thereal-ume used, process numbers, time limits and account number etc.
b) VO device status information- it suggest the details about allocated devices for this
process, list of files opened for this process etc.
4) What is Scheduler? Explain different types of Schedulers.2013, 2014, 2015, 2016
Ans:- A processes Transit between various scheduling queues (job queue) while
switching across the running, rcady and wailing (blocked) states
s the job of process management component ofOS o select an appropriate process
from these queues (called seheduling) And ransler the CPU control to such selected
process (called Dispatchng)
Written By Mahesh, Nitin, Sun
Operating Systems
- The sole responsibility of selecting a process (for execution) in accordance with some
scheduling policy-is being assigned to an OS module or to a component of process
management called the Scheduler.
minimal 1/O
2) CPU-bound process V's 1/0-bound process: A CPU-bound process has
instructions, so that the process spends its allocated time-slice almost completely
request
in order to carry out the numerical computations.
with the physical prOcessor
instructions so that the
Where 1/0-bound process has maximum I/O request
as an
in doing 1/0 operations rather
than
more of ts allocated ume-slice
process spends
carry1ng out computations rarely with the physical processor
4)
UNIX OS based systems
tume-shar1ng systems l1ke hard disks) some
medum-term schedulers swaps-out (to
send back to
-Accordingly, partitions
partially execuled processes rom main memory and
Swapping clminalc overhcad introduced
due to high degreeof muluprogramming
I/0 bound processes in freed ma1n memory
a
allow for good mixture
of CPU-bound and
|2011, 2012, 2014, 2016
5) What Co-operating Process? Eaplain briefly. environment can be classilied
are
Pane 10 47
Operating Systems
-Cooperat1ng processes communicate each other via two communication schemes shared
memory and message systems.
b) Throughpu: Suggests that CPU must perium maximum computational tasks in the
shortest nterval of tume
Ifthe CPU bound process Is complex und ume-consumng then the system throughput
may be just I or 2 process completion per unit of iume
However, throughpul rale nmay increase up to 10 ur 20 process completion per unit of
ume. provided the pruc esses involvcd in execution must be sumple and short
e) Waiting Time Suggest the time spent while waiting for I/0,comp tion, waiting for
CPU in ready queue etc., The sum total of such time quantum's expended while waiting
for various subsidiary events to occur or to complete contribute towards increasing Turn
around time.
P P2 26 28
0 milliseconds
-So the gantt chart suggest that waiting ume is
12
Written By Mahesh, Nitin, Sunil.
c) Turn around Time:- Defines the time elapsed between the time of submission of a
process o job by a user and the time of completion of that process of job.
Turn arvumd time also inchudes waiting time in theready queue. time spent over 1/0
compietion. waiting to get into memory, waiting time for child process completion etc
d) Response Time: - Defines the time it takes to commence responding to a request ora
command t's not the time interval to complete the task from the point of submission
The best criterion for an interactive time-sharing system is to minimize
expected
response time.
e) Waiting Time Suggest the time spent while waiting for l/0 completion, waiting for
CPU in ready queuc etc.. The sum total of such time quantum's expended while
waiting
for varous subsidiary events to occur or to complete contribute towards increasing Turn
around tme
P
22 26 28
-So avciage
waiing lume s 16milliscconds
b) SJF Shoriest Job First Scheduling: - Name lseli mdicales, the process in eady
queue having the Shoriesl next CPU burst úme' will be allocated he CPU
12
WILten By. Mahesh, Nitin, Sun.
Operating Systems
P P Pa P2
16 26
be
c)PR-Priority Scheduling: -
Name itself indicates, the participating processes
will be allocated
will
CPU. to
assign prionty and each time process with highest priority
Assignment as per FCFS scheduling
Accordingly the respective waiting times for individual process in ready queue waiting
to get CPU assignment shown using Gantt chart as follows:-
PR1 PR:2 PR:3 PR:4 PR:5
P P P P
6 11 19
22
Now average waiting time is = 0+2+6+11+19/5 = 7.6 milliseconds
Conclusion
Prnoity scheduling can be implemented as either primitive or non-primitive algorithms
-
to go
round the rcady queue and allocatle CPU to each process on FIFO basis
Working of Round Robin
Scheduling The Round Robin Scheduling algorithm is pre
emptive Accord1ngly, if the curently running process has longer CPU burst tume
excceding time quantum
12-5-7 0 0
0
P P P P P
2 17 22
21
e)
MLO-Multilevel Qucuc Schcduling: 2013, 2015|
- MLO scheduling partitions are ready queue of processers into many different queues
hased on certain considerations, such as Foreground or Interactive processors and Batch
processors
MLO schedul1ng algorithms permits different scheduling schemes to be employed for
several different classes of processors
- Further MLO scheduling scheme permits among these ditferent ready queues and is
umplemented by 'Fixcd- priority preemptive' schecduling algorithm.
14
Written By Mahesh, Nitin, Suni
Operating Systems
Advantages of Threads
Responsiveness: Speedy response to users.
Resource sharing: hence allowing better utilization of resour
Economy: - Creating and managing threads becomeseasie
Scalability: One thread runs on one CPU. In Multithreaded processes, threads
-
Multithreading Models
The user threads must be mapped to kernel threads, by one of the tollowing strategies.
Lime-slice expires
hus, once afler saving the stalus of previously running process in ils coTespOnding
Process
PCB the dispalcher then switches the CPU control by execuling the LPS (Load
to the
Stale) load the status information saved in the PCB corresponding
instruclion Lo
Sunil
Witten by Maiesh, Nitan,
Operating Systems
Chapter 3
Process Synchronization and Deadlocks
renander
-
Progress:- Assuming that if proccsses arc not cxccutung both n cUucal and
to which one will enter ts cntical
secuon
sectons, then these processes can competc as
While(S0)
signal (S):- This operation is originally temed as V (for signal to increment) and can
be defined with followIng program segment
signal(s)
s-S+1; increment
do
wait (mulex)
CTitucal seclon
wait (mutex);
Plates
If all want to eat
at the sarrie tirme
Phiosophers take a deadlock ocurrs
the ieft chopstick
first then the right
chopstick and eat
Chopsticks Philosophers
Now the problem starts as when philosophers became hungry and would like to eat
rice
when philosophers are busy in thinking about ethics, research etc. they never interact
with cach other But they would attempt at least to pick-up two chopsticks or spoons that
arc adjacent to their plates
i n other words, synchronization problem exist and intern it may lead to deadlock
&Starvation
To
conclude, Dining Philosopher problem could be solved by employing semaphores
-
19
WIntten By Mahesi Nitn, Sunil
Operating System
Body of the monitor construct consist of shared variable declarations and a set of one or
more user-defined functions or procedures that represent various aperations to be
performed on these abstract data types (i.e., on shared variables).
-
7) is
What Deadlock?
Explain the
necessary for its occurrence.
12015, 2016
Ans: Deadiock is a situation in which two or more processors are waiting on same
resources that are held by each other, this stage is called Deadlock.
Deadiock situation can occur in a community of co-operating processes or among
competing processes that need exclusive access to one or more resources of a computer
system
-
more processes (P1, P2, P3, etc.) get in to a hanging state (hold or locked or blocked
state) such that each process is holding a resource that its adjacent or neigh buring
process is requestung the same.
processors.
At least one resource is held in a non-sharable mode that is only one process at a time
can use thc resource. f another process requests that resource, the requesting process
must be dclayed until the resource has been
released
b) Hold & wait:- One processor holding one resources. Another processor must wait
There must exist a process that is holding at least one resource and is waiting
toacquire
addilional resources thal are currently being held by other
processes
N o preemption:- It doesn't go back for scheduling, it will wait until gets complete.
Resouces cannot be preempted that is, a resource can only be released voluntarily by
process bolding after the process has completed its task
the it,
d) Circular wait:- Two or Muliple processor waiting for subscquent process, this
Siluation is called as 'Circular Wait
Therc must cxist a set tp0. pl paf of waiung processes such that p0 is waiting for a
teource which is held by pl. pl is waiting for a resource which is held by p2 pa-I is
wailing or a resourcec which is held by pa and pn is waiting for a resource which is held
by p
Dcadiuck Detection
Ihe deadlock avoidance approach avoid the 'Unsafe States' although systen nught
TCcOver Irom themn
request matrix R)
depends upon comparing these vectors with available resource vector A
-One altemative approach is to invoke detection algorithm every
request is to be processed. This method is expensive nterns of considerable overhead on
ime when a resource
CPU ume
Deadiock Presentation:
a) Elimination of Mutual Exclusion
b) Elimination Hold and wait
c) Elimination of No-preemption
d) Elimination circular wait.
5ankers algorithm
cach resource type.
is applicable to resource allocation systems with multuple instances of
The simple assumplion is such that bank must satisfy all of its customers by leading
money to each and every customer on the basis of a line of credit
We know that a bank can have a designated amount of cash at àny time subject to its
transacion load at thal particular town or city
A line of credit is an
agreement on max imum claim on resources by the processes In
banking environment a ine of credit 1s an agreement by the bank