Homework12-sol - Homework #12 (Solution) 4/29/2003 8:20 AM...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2003 Page 1 of 6 Homework #12 (Solution) 4/29/2003 8:20 AM Semaphores 1. Consider the following two concurrent processes: Process 1: P1; Signal(Sem); P2; P3; Signal(Sem); Wait(Sem); P4; Process 2: Wait(Sem); P5; Wait(Sem); P6; P7; Signal(Sem); P8; Assume that the value of the semaphore Sem is 0 at the beginning. 1a. (10 points) Which of the following sequences of execution are feasible? Circle yes/no for each item below. P5 P1 P2 P3 P6 P7 P8 P4 YES NO P1 P2 P3 P4 P5 P6 P7 P8 YES NO P1 P2 P5 P6 P3 P7 P4 P8 YES NO P5 P1 P2 P3 P6 P7 P4 P8 YES NO P1 P2 P5 P3 P6 P7 P4 P8 YES NO Grading: 2 points for each correct entry. 1b. (5 points) What is the value of the semaphore after the two programs have finished their execution? The last value of Sem will be 0, since there are equal number of Wait() and Signal() calls both processes combined. Grading: 5 points for correct answer, 1 for incorrect. File Systems 2. (20 points) Consider a file currently consisting of 200 blocks. Calculate how many disk I/O operations are required to perform the following file modifications for contiguous, linked, and indexed (single-level) allocation strategies. For each block, the following conditions hold. The file control block for contiguous allocation, and the index block for indexed allocation, is in main memory. For contiguous allocation, assume that there is room to grow only at the end of the file. For linked allocation, the pointer to the next block is stored in each block. Each operation is performed on the original 200-block file. Case Contiguous Linked Indexed The block is added at the end. 1 202 1 The block is removed from the end. 0 200 0 Block #100 is removed. 200 100 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2003 Page 2 of 6 The block is added after block #100. 201 102 1 The block is added at the beginning. 401 1 1 The block is removed from the beginning. 00 0 With linked allocation, all blocks preceding a modified must be read, and the block preceding a new entry must be rewritten with the new pointer. With contiguous allocation, all blocks following a deleted or added block must be read and rewritten (unless the block is deleted at the beginning, in which case only the start address is changed).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course ECSE ecse-2340 taught by Professor Wozny during the Spring '09 term at Rensselaer Polytechnic Institute.

Page1 / 6

Homework12-sol - Homework #12 (Solution) 4/29/2003 8:20 AM...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online