Last OS
Last OS
Q.process synchronization :When two or more process co-operate with each other.There order of execution must
be preserve.Otherwise they are can be conflict in their execution and in appropriate output can be produced.The
procedure involves in-preserving the appropriate order of execution of co-operating process in knows as
synchronization .there are various synchronization mechanism exist that are used to synchronized the process.
Direct Communication:-In this method of communication the process wants to communicate explicitly.
In this scheme the send and receive primitives as defined as follows:Send(P,message)-send a message to process P.
Receive(Q,message)-Receive a message form process Q.
Indirect Communication:-with Indirect Communication,the messages are sent to and received from mailboxes.A
Mailbox can be viewed abstractly as,an object into which message can be placed by processes and from which
messages can be removed.The send and receive primitive are defined as follows: Send(A,,message)-send a message
to mailbox A. Receive(Q,message)-Receive a message form mailbox A.
Q.What is the purpose of paging map table in paging ?
Ans.The mapping between page number and frame number is done by page map table ,it helps to search to page
number and corresponding frame number ..and at the displacement obtain where the logical address is loaded in
physical memory.
Delady’s Anomaly:-The general principle of page replacement technique is if the number of frame increased the
page ,fault rate will be decreased.But when the number of frame as will also increased this fact is known belady’s
Anomaly. To illustrate the problem possible with FIFO page replacement algorithm.
Q. Consider the reference string 1 2 3 4 1 2 5 1 2 3 4 5 using three and four page frame.
RS 1 2 4 1 2 5 123 4 5
F 3
F-1 1 4 4 4 5 5 5
F-2 2 2 1 1 1 3 3
F-3 3 3 3 2 2 2 4
Total page fault=9 , Page ratio=9/12X100=75%
RS 1 2 3 125 1 2 3 4 5
F 4
F-1 1 5 5 5 5 4 4 Total page fault=10 ,Page fault ratio=10/20 X 100=83.3%
F-2 2 2 1 1 1 1 5 It is shown that if we increase the number of page frame the
F-3 3 3 3 2 2 2 2 page frame the page fault will not decrease I.e it is increased
F-4 4 4 4 4 3 3 3 by 1.This condition is known as Belady's Anomaly.
Semaphore:The solution of critical section problem is semaphore.This is a process synchronization tool.A
semaphore(1) is an integer variable that apart from initialization is access through two standard atomic
operation:wait and signal this operation originally termed as P and V operation.The wait operation decrement a
semaphore variable if the value becomes non negative the P operation on semaphore ‘s’ is written as p(s) and
operates as -P(S):if(s ≥0)then do-operation ,
S=S-1;
else
Wait on S.
Similarly the operation increment the semaphore value if the value is non positive the V operation of semaphore is
written as V(s) and operates as follows-
V(s):If(One or more processes are waiting on’ s’) then one of these processes are proceed.
else
S=S+1;
Binary Counting
Semaphore Semaphore
Synchronization Yes Yes
Mutual Exclusion Yes No
Access Units One Multiple
Internal value Range [0;1] [o;n]
(n>1)
Dead Lock:”A process request”the resources are not available at that time,so the process enter into the waiting
state.The requesting resources are held by another waiting process,both are in waiting state ,this situation is said to
be “Dead lock”Example:-Let us assume that there are three processes P1, P2 and P3. There are three different
resources R1, R2 and R3…. R1 is assigned to P1, and P1 is requesting to R2 which is held by P2 and P2 requesting to
R3 which is held by p3 and p3 is requesting to R1 which is held by P1 .
In this scenario, a cycle is being formed among the three processes. None of the process is progressing and they are
all waiting. The computer becomes unresponsive since all the processes got blocked
The deadlock System must satisfy the 4 condition this are-
1) Mutual exclusion 2)Hold and wait 2) No-Preemption 4)Circular wait
1) Mutual Exclusion:-It means resources are in non shareable mode.Here only one process at a time can use a one
resources/single resource if same other process request that resources the requesting process must wait until the
resource has been released.
2) Hold and Wait:-A process holding at least one resources and is waiting for additional resources that are
currently being held by other process.
3) No preemption:-No preemption means resources are not released in the middle of the work they released only
after the process has completed its task.
4) Circular wait:- In the above figure P1 is waiting for a resources R1,it is held by P2,P2 is waiting for R2,R2 held by
P3,P3 waiting for R4,R4 held by P2,P2 waiting for resources R3 it is held by P1.
P1 →R1→ P2→ R2→ P3 →R4→ P2→ R3
It is said to be Circular wait.
1.What do you mean by resource allocation graph(Deadlock can be represented by resource allocation graph) ?
Ans:-A resources allocation graph is a directed graph.It is used to represent the deadlock.it consist two type of node -
-One is for process denoted as circle and another is for resources denoted as square and the graph consist two types
of edges.One is for requesting edge another is for assignment edge. Fig:
An edge from process to resources is said to be requesting edge and An edge from resources to process is said to be
assigning edge. If resources allocation graph consisting of cycle then the cycle may or may not be deadlock but
if the system is in deadlock the resources allocation graph must consist of cycle.
***Dead lock prevention:-We can prevent the occurrence of deadlock by ensuring that at least one of the following
condition can’t hold- 1) Mutual Exclusion:-…It means one process can use resources at a time.we can’t prevent
this by doing all the non shareable resources to shareable resources.
2) Hold & wait:-…It means a process hold one resources and wait for other we can prevent this by applying two
protocols-I)A process request the resources only when the process has none. ii)Allocate all the resources to the
requesting process before it begin its execution.
3)No preemption:-..It means execution of process cannot be preemption.We can prevent this method if we preempt
to desire resources from the waiting process and allocate them to the requesting process.
4)circular wait:-..We ensure that circle wait must not happened.Here we apply a simple solution---,numbering all
resources type in an increasing order of counting provide two Method-
1)F(Ri)>F(Rj): A process release the resources (Ri) and requesting for (Rj).
2) F(Rj)>F(Ri): A process release the resources (Rj) and requesting for (Ri).
Assume logical address space 40K and page frame size is 8K.So it is divided into 5 frame that is 0 to 4 and the
available memory space is 24k.That is 3 frames are available and remaining two pages are loaded into the
secondary memory.When we need this pages Swap in this pages from the secondary memory.
Q.How does Demand paging differ form swapping ?
Ans-Demand paging is a method for loading only the necessary parts of a program into RAM as needed,while
swapping involves moving entire processes in and out of RAM.Demand paging is more granular.
Definition of Disk scheduling:-A process needs to type of time.CPU time and I/o time.For I/o it request to the OS
to access the disk.However the OS must be fair enough the satisfy each request and at the same time,OS must
maintain the efficiency and speed of process execution.The technique that OS uses to determine the request.Which is
to be satisfied next is called scheduling.
Describe Sector,track and Cylinder:-
Sector:-It is the smallest block on track that can be read or written on a disk.
Track:-It is the collection of sector of a same circumference on single surface.
Cylinder:-It is a collection of all tracks of some radius on multiple disk.
All PCB is the central state of the information that allows the OS to located the queue of information about the
process.PCB contains many piece of information associated with specific process include the following-
1. :-The process state may be in -new,ready,running,waiting,terminated.
2. :-it indicates that the address of the next instruction to be executed in the process.
3. :-The shows the number of the particular process.
4. :-Used to store the process state information when an Interrupt occur.
5. :-CPU scheduling information contains the process priority,pointer scheduling
parameter etc. The PCB also contains the following information- -Memory management information.
-According information -IO information(List of open files and drivers)
Swapping: moving a process from main memory to backing store(secondary memory) and swap a process backing
store to main memory is called swapping. Here a partial execute a process are temporarily removed process can be
enters into the system in a later stage. When a process remove from the main memory is called swap out and the
process which brought from the secondary memory to main memory is called Swap in.
Dirty Bit:-A dirty bit is a bit that is associated with a block of computer memory and indicates weather or not the
corresponding block of memory has been modified. The dirty bit is set when the processor writes to this bit is set
when the processor writes to this memory.
Locality of reference:- Locality of reference also known as the principle of locality is a term for the phenomenon in
which the same values,or related storage locations are frequently accessed,depending on the memory access pattern.
There are two basic type of reference locality -temporal and spatial locality.
Internal fragmentation:-The memory wastage inside a allocated block is called internal Fragmentation.it occur
when process needs ‘m’ word of memory may be run in a partition of ‘n’ words where n>m therefore internal
fragmentation is (n-m) words which is not used.
External Fragmentation:-External fragmentation exist when enough free total space is available to satisfy the
request but it is not singly enough.It occur when a partition is unused and available by too small for any waiting
process.
Critical section:Each process has a segment of code called critical section.Critical section is used to avoid race
condition on share data item.In critical section the process may be changing common writing a file and so
an.Obtaining physical address using the content of relocation register leads to a critical section problem.Here
physical address is not generated properly.
Limit Register Relocating Register
Thrashing.If the number of process submitted to the CPU for execution are increased the CPU utilization will also
increased,but increasing the process continuously at a certain time CPU utilization falls sharply(The CPU treated
this Overload)and after sometimes it reaches to 0.This situation is said to be thrashing.
Degree of multiprogramming
0 5 10 15 20 25
Number of jobs
Suppose the main memory consisting of 5 jobs initially. At that time page fault rate is 0.6.After few second add
more 5 jobs in the memory than the rate will increase 0.8 after some time add another 5 Jobs than the page
fault rate drop soddenly 0.2.Some time it may be reaches to zero(0).This unexpected situation is said to be
thrashing.
Mathematics
Q.State that Fundamental theorem of classical algebra.
Ans.Every polynomial equation of degree n with complex number coefficient has n roots in the complex numbers.
Cayley Hamilton theorem : Every square matrix satisfies its own characteristic equation.The theorem state that if
+ . . . .Cn then C0A - C1 A =0
n n-1 n n-1
A be an n X n matrix and the characteristic polynomial of A be-C0X - C1 X
Reciprocal Equation:-A polynomial equation is said to be reciprocal equation ,if the reciprocal of each of its root is
n n-1 n
also a root of it Let a0 X + a 1 X + . . . . a =0 be a reciprocal equation when it is identical with the equation-
n n-1
a n X + a n-1 X + . . . a 0=0
Define characteristic polynomial of a square matrix A :-Let A be an n x n matrix over a field F than det(A-xIn) is
said to be the characteristic polynomial of A and is denoted by Ψ A(x).
Prove that an invertible matrix has a unique inverse.:-Let A be an invertible matrix of order n.if possible let B
and C be t o inverse of A then,AB=BA=In, AC=CA=In , we have, C(AB)=(CA)B
CIn=InB =>C=B this proves that A has unique inverse
Chain rule:- The chain rule state that the derivative of f(g(x) is f ‘(g(x)) .g ‘(x))
Example sin x^2 or, f(x)=sin x
f(x) g(x) f ‘ (g(x))
f(g(x))=sin x^2 = f ‘ (g(x).g ‘(x)
g(x)=x^2 =cos(x^2).2x
Ho do we find the Taylor series of f(x)=sinx Ho do we find the Taylor series of f(x)=cos x
Ho do we find the Taylor series of f(x)=e x If y=sin -1 x then show that (1-x 2)y2-xy1=0
If y=emsin−1x then show that (1−x2)yn+2−(2n+1)xyn+1−(n2+m2)yn=0.
If y = sin–1x, then prove (i) (1 – x2)y2 – xy1 = 0 Q)if λ is an eigan value of A then show that 1/λ
(ii) (1 – x2)yn+2 – (2n + 1)xyn+1 – n2yn = 0 is an eigan value of A-1 prove A is non singular λ≠0
Q. Find the total differentiate at (0,0) for f(x,y)=√|xy|