You are on page 1of 8

Operating Systems (May/June-2012, Set-1) JNTU-Hyderabad

Code No: 09A50507/R09


III B.Tech. I Semester Examinations

May/June - 2012

S.1

Set-1
Solutions

OPERATING SYSTEMS
( Common to Information Technology, Computer Science and Engineering )

Time: 3 Hours

Max. Marks: 75
Answer any FIVE Questions
All Questions carry equal marks
---

1.
2.

3.
4.

5.

6.

7.

(a)
(b)
(a)
(b)

(c)
(a)
(b)
(a)

(b)
(c)
(a)
(b)
(c)
(a)

(b)
(a)
(b)

Explain in detail about domain structure. (Unit-VIII, Topic No. 8.3)


Explain in detail how cryptography is used as a security tool. [8+7] (Unit-VIII, Topic No. 8.13)
Explain the difference between internal and external fragmentation. (Unit-IV, Topic No. 4.2)
Consider the following reference string for a memory for a memory with three frames 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0,
3, 2, 1, 2, 0, 1, 7, 0, 1.
Illustrate the FIFO page replacement algorithm for the above string. (Unit-IV, Topic No. 4.8)
What is beladys anomaly. [15] (Unit-IV, Topic No. 4.7)
State and explain different types of OS. (Unit-I, Topic No. 1.2)
What is the difference between user view and system view of an operating system? [15] (Unit-I, Topic No. 1.7)
Explain the following terms with their definition with respect to a magnetic disk,
(i) Seek time
(ii) Latency
(iii) Bandwidth. (Unit-VII, Topic No. 7.4)
Explain RAID level 2 and 3. (Unit-VII, Topic No. 7.6)
Explain with neat block diagram the life cycle of a typical I/O request. [15] (Unit-VII, Topic No. 7.12)
What is free space list? (Unit-VI, Topic No. 6.1.1)
Explain the four approaches to free space management. (Unit-VI, Topic No. 6.11)
Explain how access control is accomplished in UNIX system. [5+5+5] (Unit-VI, Topic No. 6.6)
With the help of neat examples, explain any three types of errors (using signal and wait) that can be generated
easily when programmers use semaphores in correctly to solve the critical-section problem.

(Unit-III, Topic No. 3.4)


Explain how you can implement a monitor using semaphores. [8+7] (Unit-III, Topic No. 3.7)
Describe the differences among short-term, medium-term and long-term scheduling. (Unit-I, Topic No. 1.2)
Consider the following set of processes, assumed to have arrived at time 0, in the order given with the length
of the CPU burst time in milliseconds.
Process

Burst time

P1

10

P2

29

P3

P4

P5

12

Consider the FCFS and RR(quantum = 10 milliseconds) scheduling algorithms for this set of processes and
schedule them. Find the average waiting time for each algorithm provide Gnatt charts. Find which algorithm
would give the minimum average waiting time. [15] (Unit-II, Topic No. 2.4)
WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.2
8.

Spectrum ALL-IN-ONE Journal for Engineering Students, 2012


(a)

Explain resource allocation graph algorithm for deadlock detection with relevant diagrams.

(Unit-V, Topic No. 5.4)


(b)

Enumerate the methods for handling a deadlock. (Unit-V, Topic No. 5.5)

(c)

Explain how to ensure the condition circular wait does not hold to prevent deadlock for occuring.
[15] (Unit-V, Topic No. 5.3)

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

Operating Systems (May/June-2012, Set-1) JNTU-Hyderabad

S.3

SOLUTIONS TO MAY/JUNE-2012, SET-1, QP


Q1.

(a)

Explain in detail about domain structure.

Answer :

May/June-12, Set-1, Q1(a) M[8]

A domain is a set of access rights that an object


possess. Access rights is defined as the ability of executing
an operation on a particular object.
A domain is an ordered pair,
<object_name, access_right(s)>
For remaining answer refer Unit-VIII, Q5, Topic:
Example.
(b)

Explain in detail how cryptography is


used as a security tool.
May/June-12, Set-1, Q1(b) M[7]

Answer :

For answer refer Unit-VIII, Q24.


Q2.

(a)

Explain the difference between internal and external fragmentation.


May/June-12, Set-1, Q2(a)

Answer :

For answer refer Unit-IV, Q10.


(b)

Consider the following reference string


for a memory for a memory with three
frames 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1,
2, 0, 1, 7, 0, 1.
Illustrate the FIFO page replacement
algorithm for the above string.
May/June-12, Set-1, Q2(b)

Answer :

For answer refer Dec.-11, Set-3, Q4(b).


(c)

What is Beladys anomaly.


May/June-12, Set-1, Q2(c)

Answer :

For answer refer Unit-IV, Q25, Topic: Beladys


Anomaly.
Q3.

(a)

State and explain different types of OS.


May/June-12, Set-1, Q3(a)

Answer :

The following different types of operating systems


(OS) are,
1.

Batch processing

2.

Multiprogramming

3.

Time sharing

4.

Real time

5.

Distributed.

1.

Batch Processing System (1960s)


A batch processing operating system reads a set of
separate jobs, each with its own control card. This control
card contains information about the task to be performed.
Once the job is completed its output is printed. The
processing in a batch system does not involve interaction
of user and the job during its execution. However, in there
systems the CPU was not utilized efficiently due to mismatch
in processing speed of mechanical card reader and electronic
computer.
2.
Multiprogramming (1970s)
For answer refer Unit-I, Q4(a).
3.
Time Sharing System (1970s)
For answer refer Unit-I, Q4(b), Topic: Time Sharing.
4.
Real Time System (1980s)
Real time operating systems are time bounded
systems, wherein the system must respond to perform a
specific task within predefined boundary. There are two types
of real time system.
Hard Real Time System
In this real time system, actions must be performed
on specified time which could otherwise lead to huge losses.
It is widely used in factories and production lines.
Example
In automobile, assembly line welding must be
performed on time. This is because a weld before or after the
specific instance can damage the product.
Soft Real Time System
In this real-time a specified deadline can be missed.
This because the level of loss is low compared to hard real
time system.
Example
A video game can has voice not synchronized to the
movie. This is still undesirable but does not causer huge
loss.
5.
Distributed System
For answer refer Unit-I, Q10.
(b) What is the difference between user
view and system view of an operating
system?
Answer :
May/June-12, Set-1, Q3(b)
1.
User View of an Operating System
The view of the users based upon the types of
computer interface being used is known as user view.
Different views of user are,

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.4

Spectrum ALL-IN-ONE Journal for Engineering Students, 2012

Ease of Use
Some users use Personal Computers (PC) for
performing general tasks such as word processing and emails.
A PC comprises CPU, monitor, keyboard and mouse. It can
be used by a single user at a time. The operating system in
PC is designed to allow ease in using the computers. Here,
there is no focus or very little performance parameters and
resource utilization.
Efficient Resource Utilization
Some users are connected to a mainframe or mini
computer through a terminal. Similar, other users can also
get connected to mini computer at the same time. This
connection is made by sharing resources and exchanging
information. The sharing of resources is done by operating
system ensuring efficient utilization of CPU timing, I/O
systems and memory for multiple users.
Individual Usability and Resource Utilization
Many users also use workstation connected in a
network. These workstation request for service from the
servers. In this client and servers environment the users of
a workstation have some exclusive resources as well as some
sharable resources such as printers and filer in the network.
Handled Computers
For answer refer Unit-I, Q11, Topic: Handheld and
Portable System.
Little or No User View
Few computers have very little or no user view. In
such operating system the interface is designed is such a
way that the computers is able to operate without the user
intervention.
Example
Embedded computers in parking garage.
2.
System View
The operating system is a resource manager
(allocator) and a control program from the system point of
view.
Resource Allocator
For answer refer Unit-I, Q1, Topic: Operating System
as a Resource Manager.
Control Program
For answer refer Unit-I, Q15, Topics: I/O Device
Support, File System Management, Error Detection,
Accounting, Protection and Security.
Q4. (a) Explain the following terms with their
definition with respect to a magnetic disk,
(i) Seek time
(ii) Latency
(iii) Bandwidth.
May/June-12, Set-1, Q4(a)

Answer :
(i)

Seek Time
For answer refer Unit-VII, Q8, Topic: Seek Time.

(ii)

Latency
For answer refer Unit-VII, Q8, Topic: Latency.

(iii)

Bandwidth

Bandwidth refers to the total number of bytes


transferred, divided by the time duration between the first
request for service and the completion of the last transfer.
(b)

Explain RAID level 2 and 3.


May/June-12, Set-1, Q4(b)

Answer :
RAID Level 2 and 3

For answer refer Unit-VII, Q20, Topics: RAID Level 2,


RAID Level 3.
(c)

Explain with neat block diagram the life


cycle of a typical I/O request.

Answer :

May/June-12, Set-1, Q4(c)

For answer refer Unit-III, Q38.


Q5.

(a)

Answer :

What is free space list?


May/June-12, Set-1, Q5(a) M[5]

Free space list is a repository that keeps record of all


the disk blocks that are free as they are not allocated to any
file or directory
For remaining answer refer Unit-VI, Q28, Topic: Free
Space Management.
(b)

Explain the four approaches to free


space management.

Answer :

May/June-12, Set-1, Q5(b) M[5]

For answer refer Unit-VI, Q28.


(c)

Explain how access control is accomplished in UNIX system.

Answer :

May/June-12, Set-1, Q5(c) M[5]

Access control in UNIX system is accomplished by


classifying users as owner, group and universe.
For remaining answer refer Unit-VI, Q17, Topics:
Owner, Group, Universe.
Q6.

(a)

With the help of neat examples, explain


any three types of errors (using signal
and wait) that can be generated easily
when programmers use semaphores in
correctly to solve the critical-section
problem.
May/June-12, Set-1, Q6(a) M[8]

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.5

Operating Systems (May/June-2012, Set-1) JNTU-Hyderabad


Answer :

Example

The three types of error (using signal and wait) that


can be generated easily when programmers use semaphores
incorrectly to solve the critical section problem are as follows,
1.
Error Generated by Interchanging the Execution
Order
This type of error occurs whenever the order of executing wait and signal operations (defined on semaphore
mutex) are being interchanged by process.
Example
Consider the following execution code, wherein the
signal operation is being executed prior to wait operation.
Signal (mutex)

Consider the following execution codes wherein the


signal operation is omitted or wait operation is omitted or
both (i.e., signal and wait operation) is omitted .
1.

Critical section
M

//omitted signal (mutex)


2.

Critical section
M

Signal (mutex)
3.

Signal (mutex)
Now, if the signal (mutex) is replaced by wait (mutex)
then, the code becomes,
Wait (mutex)
M

Critical section
M

Wait (mutex)
The execution of above code results in occurrence of
deadlock.
3.
Error Generated by Omitting the Execution of
Operation
This type of error occurs when execution of signal
(mutex) or wait (mutex) or both are omitted by the process.

//omitted wait (mutex)


M

Critical section
M

//omitted signal (mutex)


The execution of any of the above code result in
violating mutual exclusion requirement or inoccurrence of
deadlock.
(b)

Explain how you can implement a


monitor using semaphores.

Answer :

May/June-12, Set-1, Q6(b) M[7]

Critical section
M

//omitted wait (mutex)


M

M
Critical section
wait (mutex)
The execution of above code results in simultaneous
execution of multiple processes in their critical section , there
by violating the mutual exclusion requirement.
2.
Error Generated by Interchanging the Execution
Order
This type of error occurs when the signal operation
defined on semaphore mutex is replaced by wait operation.
Example
Consider the following code
Wait (mutex)

Wait (mutex)

For answer refer Unit-III, Q28.


Q7.

(a)

Describe the differences among shortterm medium-term and long-term


scheduling.

Answer :

May/June-12, Set-1, Q7(a)

Long-term (job) Scheduling


In operating system the number of processes
submitted for execution is more than the number of processes
executed instantly. Therefore, some processor are spooled
(stored) in a storing device and executed later. The processor
from job pool are selected by long term scheduler and loaded
into the memory.
This scheduler executes process less frequently (in
minutes) as it can afford to take time for selecting processes
from the job pool.


It is invoked only when a process exits a system.

It also controls the level of multiprogramming.

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.6

Spectrum ALL-IN-ONE Journal for Engineering Students, 2012

Medium-term Scheduler
Medium-term scheduler reduces the degree of multiprogramming. This is done by temporary removal of some
processes from the memory. Which are reintroduced into the memory and their execution starts from the previous state
where they were taken out from the memory. This process of temporary removal and reassignment of the memory is quite
often seen in medium-term scheduler.
This scheduler utilizes the swapping mechanism is adopted in time sharing system.
Short-term(CPU) Scheduling
Short term scheduling chooser the processes which are ready to get executed and assigned to the CPU.


This schedules selects and submits a new process more frequently (in milliseconds).

(b)

Consider the following set of processes, assumed to have arrived at time 0, in the order
given with the length of the CPU burst time in milliseconds.

Process

Burst time

P1

10

P2

29

P3

P4

P5

12

Consider the FCFS and RR(quantum = 10 milliseconds) scheduling algorithms for this set of
processes, and schedule them. Find the average waiting time for each algorithm provide
Gnatt charts. Find which algorithm would give the minimum average waiting time.
May/June-12, Set-1, Q7(b)

Answer :
Given that,

Process

Burst time

P1

10

P2

29

P3

P4

P5

12

The order for process arrival is P1, P2, P3, P4 and P5 at time 0.
FCFS Scheduling Algorithm
The Gantt chart for the schedule (FCFS) is,

P1
0

P2
10

P3 P4
39 42

P5
49

61

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.7

Operating Systems (May/June-2012, Set-1) JNTU-Hyderabad


Waiting Time For
P1 = 0, P2 = 10, P3 = 39, P4, 42, P5 = 61

Average waiting time =

Sum of waiting time for all process


Number of process

0 + 10 + 39 + 42 + 61
5

152
5

Average waiting time = 30.4 milliseconds


SJF Scheduling Algorithm
The Gantt chart for the schedule (SJF) is,

P3
0

P4

P1

10

P5
20

P2
32

61

Waiting Time For


P1 = 10, P2 = 32, P3 = 0, P4 = 3, P5 = 20

Average waiting time =

Sum of waiting time for all process


Number of process
10 + 32 + 0 + 3 + 20
65
=
5
5

= 13
Round Robin (RR)
Given that time quantum is 10 millisecond
The Gantt chart for the schedule (RR) is,

P1
0

P2
10

P3
20

P4
23

P5
30

P2
40

P5
50

P2
52

61

Waiting Time For


P1 = 0
P2 = 10 + 20 + 2 = 32
P3 = 20
P4 = 23
P5 = 30 + 10 = 40
Average waiting time =

Sum of waiting time for processes


Number of processes
0 + 32 + 20 + 23 + 40 115
=
5
5

= 23
Therefore, SJF scheduling algorithm would give the minimum average waiting time (i.e., 13).
WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

S.8
Q8.

Spectrum ALL-IN-ONE Journal for Engineering Students, 2012


(a)

Explain resource allocation graph algorithm for deadlock detection with relevant diagrams.

Answer :

May/June-12, Set-1, Q8(a)

For answer refer Dec.-11, Set-1, Q5(a).


(b)

Enumerate the methods for handling a deadlock.


May/June-12, Set-1, Q8(b)

Answer :
Methods for Handling a Deadlock
Deadlock Prevention
For answer refer Unit-V, Q7.
Deadlock Avoidance
For answer refer Unit-V, 12.
Post Deadlock Recovery
For answer refer Unit-V, Q19.
(c)

Explain how to ensure the condition circular wait does not hold to prevent deadlock for
occuring.

Answer :

May/June-12, Set-1, Q8(c)

For answer refer Unit-V, Q7, Topic: Preventing Circular Wait.

WARNING : Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.

You might also like