FA17 OS Assignments

Assignment One

Assignment 1

Assignment Two

Write a one page note on any one of the following

  • QoS in Wireless Networks (e.g., 802.11e)
  • Real-Time Processing and Communication in Sensor Networks
  • Real-Time Aspects of Robotics
  • Case Study of a Real-Time Operating System
  • Dynamic Voltage Scaling
  • Real-Time in Ada

Assignment Three

Write a one page note on any one of the following

  • Real-Time Task Scheduling on Multiprocessors
  • Real-Time Databases
  • Worst-Case Execution Time Analysis
  • Multimedia Computing and Communication
  • Real-Time CORBA
  • Real-Time Programming Languages
  • Fault Tolerance
  • Resource Management
  • Real-Time Java
  • Testing, Debugging
  • Energy Management
  • Real-Time Cluster Computing

Assignemt Four

Write a one page note on any one of the following papers.

You can make a group of Max Three students and each student is required to submit his/her own copy separately. Each group’s copy can be same for all group members. Only Assignment four is a group task.

Submission Details

Assignment one is already submitted. Assignment two, three and four are to be submitted on turnitin

You are to submit your assignments to https://turnitin.com by using the following details.

Class ID : 17025721

EnrollmentKey: usmanakram

Create a new user account (student account) with the display name as your roll number like   SDP-FA17-BCS-009-YourNameHere

Submission Closes o n Friday 29th December 2017 at 2PM.

Turnitin would catch you if you copy paste from any resource, or even if you submit someone else’s copy resulting 0 marks for all parties involved. Write your own thoughts.

SE OS Q/A checking status

Class/Status Q1 Q2 Q3 A1 A2 A3
SE A  InProgress  InProgress  InProgress  InProgress  InProgress  InProgress
SE B  Completed  InProgress  InProgress  InProgress  InProgress  InProgress
OS  InProgress  InProgress  InProgress  InProgress  InProgress  InProgress

Assignment Three: Whole Course OS SP15

Q1:- Break the following monoalphabetic cipher. The plaintext, consisting of letters only, is
a well-known excerpt from a poem by Lewis Carroll.
kfd ktbd fzm eubd kfd pzyiom mztx ku kzyg ur bzha kfthcm
ur rnfudm zhx mftnm zhx mdzythc pzq ur ezsszcdm zhx gthcm
zhx pfa kfd mdz tm sutythc fuk zhx pfdkfdi ntcm fzld pthcm
sok pztk z stk kfd uamkdim eitdx sdruid pd fzld uoi efzk
rui mubd ur om zid uok ur sidzkf zhx zyy ur om zid rzk
hu foiia mztx kfd ezindhkdi kfda kfzhgdx ftb boef rui kfzk

Q2:-Are critical regions on code sections really necessary in an SMP operating system toavoid race conditions or will mutexes on data structures do the job as well?

Q3:-What happens if two CPUs in a multiprocessor attempt to access exactly the same
word of memory at exactly the same instant?

Q4:- RAID level 3 is able to correct single-bit errors using only one parity drive. What isthe point of RAID level 2? After all, it also can only correct one error and takes moredrives to do so.

Q5:- A computer whose processes have 1024 pages in their address spaces keeps its page tables in memory. The overhead required for reading a word from the page table is 5 nsec. To reduce this overhead, the computer has a TLB, which holds 32 (virtual page,physical page frame) pairs, and can do a look up in 1 nsec. What hit rate is needed toreduce the mean overhead to 2 nsec?

 

Note

  • Questions are taken from Modern Operating Systems book ed 3
  • Deadline Wed 10 June 1630 hours

Assignment Two: deadlocks OS SP15

Answer following questions

Q:1 The four conditions (mutual exclusion, hold and wait, no preemption and circular
wait) are necessary for a resource deadlock to occur. Give an example to show that
these conditions are not sufficient for a resource deadlock to occur. When are these
conditions sufficient for a resource deadlock to occur?

Q:2 Suppose that there is a resource deadlock in a system. Give an example to show that
the set of processes deadlocked can include processes that are not in the circular chain
in the corresponding resource allocation graph.

Q:3 In theory, resource trajectory graphs could be used to avoid deadlocks. By clever
scheduling, the operating system could avoid unsafe regions. Suggest a practical
problem with actually doing this.

Q:4 A computer has six tape drives, with n processes competing for them. Each process
may need two drives. For which values of n is the system deadlock free?

Q:5 In an electronic funds transfer system, there are hundreds of identical processes that
work as follows. Each process reads an input line specifying an amount of money, the
account to be credited, and the account to be debited. Then it locks both accounts and
transfers the money, releasing the locks when done. With many processes running in
parallel, there is a very real danger that having locked account x it will be unable to
lock y because y has been locked by a process now waiting for x. Devise a scheme
that avoids deadlocks. Do not release an account record until you have completed the
transact ions. (In other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)

Note

  • Questions are taken from Modern Operating Systems book ed 3
  • Deadline Wed 10 June 1630 hours

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.

Semaphore Practice

a semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment.

A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e., without race conditions) adjust that record as units are required or become free, and, if necessary, wait until a unit of the resource becomes available.

Below is the link of some good practice questions. Discussed in class.

http://6004.mit.edu/Fall14/tutprobs/semaphores.html

Assignment one Process Scheduling example

Consider the following five processes arriving at time 0

Process Burst Time Priority
P1 8 4
P2 6 1
P3 1 2
P4 9 2
P5 3 3

Calculate the average waiting time for FCFS, SJF, Priority based and RR, and figure out which algorithm gives the best average waiting time in the above scenario.

 

Deadline March 5 before class e.g. 1800 hrs 

Operating Systems Helping Material

10_distributed_shared_memory

Tenenbaum Slides

Chapter2

Chapter3

Chapter4

Chapter5

Chapter6

Chapter07

Chapter8

SilberChatz

Chapter 1 Introduction

Chapter 2 Processes and Threads

Chapter 3 Memory Management

Chapter 4 File Systems,

Chapter 5 Input/Output

Chapter 6 Deadlocks

 

Dietel Slides

Chapter 1 – Introduction to Operating Systems

Chapter 2 – Hardware and Software Concepts

Chapter 3 – Process Concepts

Chapter 4 – Thread Concepts

Chapter 5 – Asynchronous Concurrent Execution

Chapter 6 – Concurrent Programming

Chapter 7 – Deadlock and Indefinite Postponement

Chapter 8 – Processor Scheduling

Chapter 9 – Real Memory Organization and Management

Chapter 10 – Virtual Memory Organization

Chapter 11 – Virtual Memory Management

Chapter 12 – Disk Performance Optimization

Chapter 13 – File and Database Systems

Chapter 14 – Performance and Processor Design

Chapter 15 – Multiprocessor Management

Chapter 16 – Networking

Chapter 17 – Introduction to Distributed Systems

Chapter 18 – Distributed Systems and Web Services

Chapter 19 – Security

Chapter 20 – Case Study: Linux

Chapter 21 – Case Study: Windows XP

Miscellaneous

Paging.Examples

Dr_Ijaz_Handouts

InterprocessCommunication

memory management

Pagerep1

snoopycasche

time-clocks

vglina-lamport