CS 570 Hour Test 2: I/O Systems and File Management, Exams of Operating Systems

A closed-book exam for a university-level computer science course, cs 570, focusing on input/output systems and file management. The exam includes multiple-choice questions and problems related to dma transfers, i/o requests, disk geometry, disk scheduling algorithms, and file organization. Students are required to write neatly and legibly, and only a half letter-size page cheat-sheet is allowed.

Typology: Exams

Pre 2010

Uploaded on 03/28/2010

koofers-user-3sx-2
koofers-user-3sx-2 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1 of 4
CS 570 HOUR TEST #2 July 12, 2001
Name (Last, First):________________________________________SSN:___________________
ROW: ________ COL: ________
IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY.
ILLEGIBLE ANSWERS WILL NOT BE GRADED.
This is a closed-book exam. Only a half letter-size page cheat-sheet is allowed. (The cheat sheet must be
one-of-a-kind, hand written by the student who is taking the exam and must be signed and turned in
along with the exam paper.
1. [8 POINTS] Draw two block diagrams of an I/O system in which DMA steals (a) one, and (b) two bus cycles
per word transfer from/to memory. (The block diagram should have blocks labeled: "CPU", "Controller", "DMA",
"Device".)
2. [14 POINTS] Consider two threads TM and TD which are transferring data from a modem to a file on hard
drive. The block size on disc is 4 K bytes, and the system I/O buffer has size of 16 K bytes. Suppose that the file
to be transferred has size 2 M bytes. Answer the following:
How many I/O requests will make the modem thread TM : _______________________
How many interrupts will generate the modem controller: _______________________
How many I/O requests will make the disk thread TD: _______________________
How many interrupts will generate the disk controller: _______________________
pf3
pf4

Partial preview of the text

Download CS 570 Hour Test 2: I/O Systems and File Management and more Exams Operating Systems in PDF only on Docsity!

CS 570 HOUR TEST #2 July 12, 2001

Name (Last, First):________________________________________SSN:___________________

ROW: ________ COL: ________

IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY.

ILLEGIBLE ANSWERS WILL NOT BE GRADED.

This is a closed-book exam. Only a half letter-size page cheat-sheet is allowed. (The cheat sheet must be

one-of-a-kind, hand written by the student who is taking the exam and must be signed and turned in

along with the exam paper.

  1. [8 POINTS] Draw two block diagrams of an I/O system in which DMA steals (a) one, and (b) two bus cycles per word transfer from/to memory. (The block diagram should have blocks labeled: "CPU", "Controller", "DMA", "Device".)
  2. [14 POINTS] Consider two threads TM and TD which are transferring data from a modem to a file on hard drive. The block size on disc is 4 K bytes, and the system I/O buffer has size of 16 K bytes. Suppose that the file to be transferred has size 2 M bytes. Answer the following:

How many I/O requests will make the modem thread TM : _______________________

How many interrupts will generate the modem controller: _______________________

How many I/O requests will make the disk thread TD : _______________________

How many interrupts will generate the disk controller: _______________________

  1. [5 POINTS] Find the capacity of a formatted disk, which has the following geometry: four heads, 500 cylinders, 200 sectors per track. Suppose that the number of sectors per track is the same for all cylinders. Also suppose that a sector has 512 bytes for data.

__________________________________________________________________________________

4. [14 POINTS] Given is the following sequence of disk requests (numbers represent cylinder numbers):

101 (first request), 12, 55, 50, 43, 122, 5, 160, 180, 14 (last request)

Suppose the disk has 200 cylinders and the initial position of the head is at 100 (head is moving from lower to higher cylinder numbers; in C-SCAN algorithm the head is picking up the requests while moving in that direction). Write the sequence of requests served for the following disk scheduling algorithms:

(a) FCFS: _____________________________________________________

(b) SSTF: _____________________________________________________

(c) SCAN: ____________________________________________________

(d) C-SCAN: __________________________________________________

__________________________________________________________________________________

  1. [14 POINTS] Suppose a combined multilevel indexing with a 15-entry file address (i.e. the file address supports 12 direct blocks). Also suppose that the disk blocks have size of 4 Kbytes, while the index block entries have size of four bytes. Fill-in the following table (you may use entries "N/A" as "not applicable"):

File of size How many data blocks are necessary for this file

Does this file require direct allocation, or one-, two-, or three-level indexing)

How many index blocks are used for this file

12 Kbytes

49154 bytes

5000 Kbytes

5 Gbytes

  1. [17 POINTS] In the skeleton code below insert all necessary Win32 system calls, which will make that the thread T executes statement 6 only after thread T1 has executed statement1 and thread T2 has executed statement3. Use Win32 events.

// File p.cpp

#include <stdio.h> #include <iostream.h> #include <windows.h>

void T1(void) {

........... statement1; ........... statement2; ........... }

void T2(void) {

........... statement3; ........... statement4; ........... }

void T3(void) {

........... statement5; ........... statement6; ........... }

int main() { HANDLE h1 = CreateThread(0,0, (LPTHREAD_START_ROUTINE)T1,0,0,0); HANDLE h2 = CreateThread(0,0, (LPTHREAD_START_ROUTINE)T2,0,0,0); HANDLE h3 = CreateThread(0,0, (LPTHREAD_START_ROUTINE)T3,0,0,0);

......... ........................

// End of file p.cpp