Menu Close

Operating Systems s2 Solution

 

Sessional 2 – Spring 2014

Course Title: Operating Systems Course Code:

CSC322

Credit Hours:

3(3,0)

Course Instructor/s: Muhammad Usman Akram Programme Name: BS Computer Science
Semester: 6th Batch: FA12-BSCS Section: C Date:
Time Allowed:

1.5 Hours

Maximum Marks:

40

Student’s Name: Reg. No. CIIT/ – – /LHR
Important Instructions / Guidelines:

  • Give Precise Answers
  • Avoid Writing Long Stories

 

Question No 1: [12 Marks]

  1. What is the difference between Paging and Segmentation?             (2 Marks)
  2. What is the role of page table?                             (2 Marks)
  3. Consider the page reference sequence and calculate the page faults for optimal and FIFO page replacement algorithms for three page frames. (8 Marks)

     

References

0

4

2

3

0

2

3

 

Question No 2: [6+6+6=18 Marks]

  1. What are different ways for directory structure implementation, explain any two. (6)
  2. What is BitMap Table? Also calculate the bitmap table size if (3+3)
    block size = 218 bytes
    disk size = 231 bytes (2 gigabyte)
  3. Explain the concept of interrupt handler. (6 Marks)

     

Question No 3: [10 Marks]

  1. What is thrashing and what are its causes explain in details?

Solution

Table – 1

Question No.

Learning Objective/s

Critical Analysis

1

The students should be able to demonstrate the

understanding of memory management issues in modern operating systems.

Knowledge , Application

2

The students should be able to demonstrate the

understanding of the storage management issues

Knowledge, Analysis

3

The students should be able to demonstrate the

understanding of memory management issues in modern operating systems.

Knowledge

 

 

Question No1:

A: Paging – Computer memory is divided into small partitions that are all the same size and referred to as, frames. Then when a process is loaded it gets divided into pages which are the same size as those previous frames. The process pages are then loaded into the frames.
Segmentation – Computer memory is allocated in various sizes (segments) depending on the need for space by the process. These segments may be individually protected or shared between processes.

 

B: A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses and physical addresses.

 

C:

References

0

4

2

3

0

2

3

Optimal

0

0

0

0

 

 

 

4

4

3

 

 

 

 

2

2

 

 

F

F

F

F

 

 

 

 

 

 

 

 

 

 

Fifo

0

0

0

3

3

 

 

 

4

4

4

0

 

 

 

 

2

2

2

 

 

F

F

F

F

F

 

 

 

 

Question No 2

A
Linear list of file names with pointer to the data blocks.

simple to program

time-consuming to execute

Hash Table – linear list with hash data structure.

decreases directory search time

collisions – situations where two file names hash to the same location

fixed size

 

 

B

        block size = 218 bytes

        disk size = 231 bytes (2 gigabyte)

        n = 231/218 = 213 bits

 

C

An interrupt handler, also known as an Interrupt Service Routine (ISR), is a callback subroutine in microcontroller firmware, operating system or device driver whose execution is triggered by the reception of an interrupt. Interrupt handlers have a multitude of functions, which vary based on the reason the interrupt was generated and the speed at which the interrupt handler completes its task.

An interrupt handler is a low-level counterpart of event handlers. These handlers are initiated by either hardware interrupts or interrupt instructions in software, and are used for servicing hardware devices and transitions between protected modes of operation such as system calls.

 

Q3

Thrashing:

In computer science, thrashing occurs when a computer’s virtual memory subsystem is in a constant state of paging, rapidly exchanging data in memory for data on disk, to the exclusion of most application-level processing. This causes the performance of the computer to degrade or collapse. The situation may continue indefinitely until the underlying cause is addressed.

 

Causes

In virtual memory systems, thrashing may be caused by programs or workloads that present insufficient locality of reference: if the working set of a program or a workload cannot be effectively held within physical memory, then constant data swapping, i.e., thrashing, may occur. The term was first used during the tape operating system days to describe the sound the tapes made when data was being rapidly written to and read from them. Many older low-end computers have insufficient RAM (memory) for modern usage patterns and increasing the amount of memory can often cause the computer to run noticeably faster. This speed increase is due to the reduced amount of paging necessary.

 

An example of this sort of situation occurred on the IBM System/370 series mainframe computer, in which a particular instruction could consist of an execute instruction (which crosses a page boundary) that points to a move instruction (which itself also crosses a page boundary), targeting a move of data from a source that crosses a page boundary, to a target of data that also crosses a page boundary. The total number of pages thus being used by this particular instruction is eight, and all eight pages must be present in memory at the same time. If the operating system allocates fewer than eight pages of actual memory, when it attempts to swap out some part of the instruction or data to bring in the remainder, the instruction will again page fault, and it will thrash on every attempt to restart the failing instruction.

Leave a Reply

Your email address will not be published. Required fields are marked *