hyd it 3 1 os set 1

8
S .1 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 Code No: 09A50507/R09 III B.Tech. I Semester Examinations  May/June - 2012 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 . (a) Ex pla in i n d etail a bout d omain s tru cture . (Unit-VIII, Topic No. 8.3) (b) Explai n in detai l how crypto graphy is us ed as a se curity tool. [8+7] (Unit-VIII, Topic No. 8.13) 2 . (a ) Expl ai n th e di ff er ence b et we en i nter na l and ex te rnal f ra gmen ta ti on. (Unit-IV, Topic No. 4.2) (b) Consider the follo wing refe rence s tring for a memory for a me mory 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) (c) What is bela dys a nomaly . [15] (Unit-IV, Topic No. 4.7) 3. (a) State and explain different types of OS. (Unit-I, Topic No. 1.2) (b) What i s the d iffere nce be tween user view an d syst em vie w of an operat ing sy stem? [15] (Unit-I, Topic No. 1.7) 4 . (a) Expl ai n t he foll owing t er ms wi th their definition wit h r es pe ct to a magne ti c dis k, ( i ) Seek t ime (i i ) La tency (i i i) Bandwidth. (Unit-VII, Topic No. 7.4) (b) Expl ai n RAI D level 2 a nd 3. (Unit-VII, Topic No. 7.6) (c) Explai n with neat block diagr am the life c ycle of a typic al I/O reque st. [15] (Unit-VII, Topic No. 7.12) 5. (a) What is free space list? (Unit-VI, Topic No. 6.1.1) (b) Explai n the four app roache s to fre e spa ce man age ment. (Unit-VI, Topic No. 6.11) (c) Explai n how acc ess cont rol is ac complis hed in UNIX sys tem. [5+5+5] (Unit-VI, Topic No. 6.6) 6. (a) With the hel p of neat e xample s, exp lai n a ny thre e t ype s of e rror s (usi ng signal and wait) that can be gen era ted easily when programmers use semaphores in correctly to solve the critical-section problem. (Unit-III, Topic No. 3.4) (b) Explai n how you ca n impl eme nt a moni tor us ing se map hor es. [8+7] (Unit-III, Topic No. 3.7) 7 . (a ) Desc ri be the differenc es among s hort- term, medium-t er m and long-term sc he duli ng. (Unit-I, Topic No. 1.2) (b) Consi der the fol lowing s et of proc esses , assumed to have a rrived a t time ‘0’, in t he order gi ven with t he lengt h of the CPU burst time in milliseconds. 12 P 5 7 P 4 3 P 3 29 P 2 10 P 1 Burst time Process 12 P 5 7 P 4 3 P 3 29 P 2 10 P 1 Burst time Process 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) Set-1 Solutions

Upload: raju-raju

Post on 02-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 1/8

S.1

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

Code No: 09A50507/R09

III B.Tech. I Semester Examinations

 May/June - 2012OPERATING 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. (a) Explain in detail about domain structure. (Unit-VIII, Topic No. 8.3)

(b) Explain in detail how cryptography is used as a security tool. [8+7] (Unit-VIII, Topic No. 8.13)

2. (a) Explain the difference between internal and external fragmentation. (Unit-IV, Topic No. 4.2)

(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. (Unit-IV, Topic No. 4.8)

(c) What is belady’s anomaly. [15] (Unit-IV, Topic No. 4.7)

3. (a) State and explain different types of OS. (Unit-I, Topic No. 1.2)

(b) What is the difference between user view and system view of an operating system? [15] (Unit-I, Topic No. 1.7)

4. (a) 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)

(b) Explain RAID level 2 and 3. (Unit-VII, Topic No. 7.6)

(c) Explain with neat block diagram the life cycle of a typical I/O request. [15] (Unit-VII, Topic No. 7.12)

5. (a) What is free space list? (Unit-VI, Topic No. 6.1.1)

(b) Explain the four approaches to free space management. (Unit-VI, Topic No. 6.11)

(c) Explain how access control is accomplished in UNIX system. [5+5+5] (Unit-VI, Topic No. 6.6)

6. (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.

(Unit-III, Topic No. 3.4)

(b) Explain how you can implement a monitor using semaphores. [8+7] (Unit-III, Topic No. 3.7)

7. (a) Describe the differences among short-term, medium-term and long-term scheduling. (Unit-I, Topic No. 1.2)

(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.

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

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)

S e t - 1S o l u t i o n s

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 2/8

S.2 Spectrum ALL-IN-ONE Journal for Engineering Students, 2012

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

8. (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)

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 3/8

S.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

Q1. (a) Explain in detail about domain struc-ture.

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 isused as a security tool.

Answer : May/June-12, Set-1, Q1(b) M[7]

For answer refer Unit-VIII, Q24.

Q2. (a) Explain the difference between inter-nal and external fragmentation.

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

For answer refer Unit-IV, Q10.

(b) Consider the following reference string

for a memory for a memory with threeframes 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1,2, 0, 1, 7, 0, 1.Illustrate the FIFO page replacementalgorithm for the above string.

Answer : May/June-12, Set-1, Q2(b)

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

(c) What is Belady’s anomaly.

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

For answer refer Unit-IV, Q25, Topic: Belady’s

Anomaly.

Q3. (a) State and explain different types of OS.

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

The following different types of operating systems

(OS) are,

1. Batch processing

2. Multiprogramming

3. Time sharing

4. Real time

5. Distributed.

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

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 userview and system view of an operatingsystem?

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,

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 4/8

S.4 Spectrum ALL-IN-ONE Journal for Engineering Students, 2012

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

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 canbe 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 theirdefinition 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.

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

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 lifecycle of a typical I/O request.

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

For answer refer Unit-III, Q38.

Q5. (a) What is free space list?

Answer : 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 directoryFor remaining answer refer Unit-VI, Q28, Topic: Free

Space Management.

(b) Explain the four approaches to freespace management.

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

For answer refer Unit-VI, Q28.

(c) Explain how access control is accom-plished in UNIX system.

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

Access control in UNIX system is accomplished byclassifying 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, explainany three types of errors (using signaland wait) that can be generated easilywhen programmers use semaphores incorrectly to solve the critical-sectionproblem.

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

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 5/8

S.5

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

Answer :

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 ex-

ecuting 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)

M

Critical section

M

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.

ExampleConsider the following code

Wait (mutex)

M

Critical section

M

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.

Example

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. Wait (mutex)

M

Critical section

M

 //omitted signal (mutex)

2. //omitted wait (mutex)

M

Critical section

M

Signal (mutex)

3. //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 amonitor using semaphores.

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

For answer refer Unit-III, Q28.

Q7. (a) Describe the differences among short-term medium-term and long-termscheduling.

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

Long-term (job) Scheduling

In operating system the number of processessubmitted 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.

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 6/8

S.6 Spectrum ALL-IN-ONE Journal for Engineering Students, 2012

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

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 statewhere 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.

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

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.

Answer : May/June-12, Set-1, Q7(b)

Given that,

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

12P5

7P4

3P3

29P2

10P1

Burst timeProcess

The order for process arrival is P1, P

2, P

3, P

4 and P

5 at time ‘0’.

FCFS Scheduling Algorithm

The Gantt chart for the schedule (FCFS) is,

P1 P2 P3 P4 P5

0 10 39 42 49 61

P1 P2 P3 P4 P5

0 10 39 42 49 61

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 7/8

S.7

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

Waiting Time For

P1 = 0, P

2 = 10, P

3 = 39, P

4, 42, P

5 = 61

∴ Average waiting time =processof Number

processallfortimewaitingof Sum

=5

614239100   ++++

=5

152

 Average waiting time = 30.4 milliseconds

SJF Scheduling Algorithm

The Gantt chart for the schedule (SJF) is,

P3 P4 P1 P5 P2

0 3 10 20 32 61

P3 P4 P1 P5 P2

0 3 10 20 32 61

Waiting Time For

P1 = 10, P

2 = 32, P

3 = 0, P

4 = 3, P

5 = 20

∴  Average waiting time =processof Number

processallfortimewaitingof Sum

=5

20303210   ++++

 =5

65

= 13Round Robin (RR)

Given that time quantum is 10 millisecond

The Gantt chart for the schedule ( RR) is,

P1 P2 P3 P4 P5 P2 P5 P2

0 10 20 23 30 40 50 52 61

P1 P2 P3 P4 P5 P2 P5 P2

0 10 20 23 30 40 50 52 61

Waiting Time For

  P1

= 0

  P2

= 10 + 20 + 2 = 32

  P3 = 20  P

4= 23

  P5

= 30 + 10 = 40

Average waiting time =processesof Number

processesfortimewaitingof Sum

=5

402320320   ++++

 =5

115

= 23

Therefore, SJF scheduling algorithm would give the minimum average waiting time (i.e., 13).

8/10/2019 Hyd It 3 1 Os Set 1

http://slidepdf.com/reader/full/hyd-it-3-1-os-set-1 8/8