1、斯坦福大学操作系统期末考试题英文FINAL EXAM INTRODUCTION TO OPERATING SYSTEMS CSE421May 2, 2003 (Spring 2003)NAME : _STUDENT NUMBER : _-_ INSTRUCTIONSThis is a closed book but you are allowed two sheets of information to refer to. You have 180 minutes to complete 10 questions. Please write neatly and clearly. To rec
2、eive partial credit, you must show all work for your answers. You should have 11 pages in this exam book, some of which are blank to allow room for your answers.QuestionGrade1 _/202_/203_/104_/145_/206 _/167_/108_/109_/1010_/10Total_/140Raw Score : _/ 140 = _/ 1001) 20 Points DeadlockConsider the fo
3、llowing snapshot of a system (P=Process, R=Resource) :AvailableRARBRCRD8597Maximum DemandRARBRCRDP03214P10252P25105P31530P43033Current AllocationRARBRCRDP01011P10121P24003P31210P41030Answer the following questions using bankers algorithm:a) Calculate the Needs matrix:NeedsRARBRCRDP0P1P2P3P4b) Is the
4、 system in a safe state? If so, show a safe order in which the processes can run.c) Can a request of one instance of RA by Process P0 be granted safely according to Bankers algorithm?2) 20 points Logical and Physical Address SpacesThe Kiwi memory architecture design team has a dilemma. The team is c
5、onsidering several different memory configuration variations for an upcoming machine design. Consider the following designs (All memory accesses are in terms of bytes, and all are using paging techniques):CharacteristicDesign 1Design 2Design 3Physical Memory Address Width8 bit16 bit32 bitLogical Add
6、ress Width12 bit20 bit24 bitPage/Frame size in bytes16 bytes32 bytes64 bytesPage Table TypeSingleSingleDouble a) 6 points For each design, list the maximum number of pages each process can access in logical address space.b) 6 points For each design, list the maximum number of frames in physical memo
7、ry.c) 6 points For design 3, if the outermost page table holds 32 entries, how many bits are needed in the logical address to represent the outer page table? How many bits are used for representing the offset within a page? How many bits are needed in the logical address in order to represent the in
8、ner page table?3) 4+4+2= 10 points Page Replacement Given the following reference string:0 2 1 3 0 1 4 0 1 2 3 4 showa) Page faults occur during the processing of the reference scheme?b) The hit ratio is for each of the following policies in a pure demand paging system?c) What do you observe when yo
9、u move from Scheme 1 to Scheme 2? Explain.Scheme 1: FIFO with three pages of main memoryScheme 2: FIFO with four pages of main memory4) 6+4+4= 14 points Address TranslationConsider a system where the virtual memory page size is 2K (2048 bytes), and main memory consists of 4 page frames. Now consider
10、 a process which requires 8 pages of storage. At some point during its execution, the page table is as shown below:Virtual pageValid Physical page0No1No2Yes13No4Yes35No6Yes07Yes21. List the virtual address ranges for each virtual page.2. List the virtual address ranges that will result in a page fau
11、lt.3. Give the main memory (physical) addresses for each of the following virtual addresses (all numbers decimal): (i) 8500, (ii) 14000, (iii) 5000, (iv) 2100.Policy : _5) 20 points File System ImplementationSuppose a file system is constructed using blocks of 8 words each. In this system, a word ha
12、s a length of 4 bytes. The disk pack used to hold the file system consists of 32 blocks. The initial block (block 0) contains a directory entry. The directory entry contains the filename of a single file in this file system, and a pointer to the first I-node in block 1. The I-node structure is as fo
13、llows (word, value): 0Permission word1File Size2Direct block3Direct block4Direct block5Direct block6Single-indirect7Double-indirectThe file contains 16 words of data: the first direct index points at block 31, and the second direct index points at block 29. Blocks 4,7,10,and 15 are marked bad. Assum
14、e that free blocks are allocated in logical order starting with block 0 and that write operations modify the file system 1 block at a time. What will the state of the system look like after 100 additional words are appended to the file (draw a block diagram showing the structure of the I-node and th
15、e blocks that are allocated)6) 16 points Disk SchedulingDisk requests come into the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in that order. Assume that the disk has 100 cylinders.A seek takes 6msec per cylinder moved. Compute the average seek time for the request sequence given above
16、for 1. First-come, First-served2. Shortest Seek Time First (SSTF)3. LOOK (with the disk-arm initially moving towards higher number cylinders from lower number cylinders)4. C-SCANIn all the cases, the arm is initially at cylinder 20. 7) 10 points Security: Public Key EncryptionConsider the public key
17、 encryption defined by the RSA (Rivest, Shamir, Adelman) scheme. Assume that the two starting primes are p and q are 3 and 7 respectively and determine the (nontrivial) private key and public key pairs according to the RSA scheme.8) 10 Points Networking: TCP/IPThe following flowchart shows the clien
18、t and server portions of a TCP communication session. Fill in the empty bubbles/boxes with the appropriate socket system call names. CLIENT SERVER9) 10 points Enduring Principles in System Design1. When a system gets complex in design what is a common solution to manage the complexity? Give an examp
19、le.2. When you experience incompatibilities between system modules, how will you solve this problem? Give an example.3. What is a common data structure used to manage (the slots for) n resources? Give an example.4. The data items such as inodes and files are typically located in external memory that
20、 is sluggish relative to the local main memory. How are the effective access times of these structures minimized?5. When a table maintaining a list of pointers grows unmanageably large how will you solve this problem so that (i) search times of the table is reasonable and (ii) only the region of int
21、erest in the table need to be in the memory?10) 10 points Nachos Operating Systems1. List the two main operations (methods) that have the potential for resulting in a page fault.2. Where is the address that caused the page fault stored?3. You incremented the PC after every system call you implemented? Why not for page fault system call?4. What is the purpose of Exec, Join and Exit system calls?5. Explain the above with an example.6. How would you control the access to a shared resource by multiple threads?
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1