CSC 4103: Operating Systems Spring 2013 Bijaya B Karki and Coretta Douglas Wednesday 5:00 PM to 7:50 PM 1116 Patrick Taylor Hall CSC 4103: Operating Systems 0.1 B. B. Karki, LSU Office Hours n Instructor: Bijaya B. Karki or Coretta Douglas F 1:00 PM to 3:00 PM, Monday and Wednesday Any time by appointment F 3127B or 3118 Patrick Taylor F karki@csc.lsu.edu or douglas@csc.lsu.edu n Teaching Assistant: F Any time by appointment F bbohar1@lsu.edu CSC 4103: Operating Systems 0.2 B. B. Karki, LSU Reading Materials & Resources Textbooks (Required): A. Silberschatz, P.B. Galvin and G. Gagne, “Operating System Concepts,” (7th or Newer Edition), Wiley: ISBN 0-471-69466-5 or A. Silberschatz, P.B. Galvin and G. Gagne, “Operating System Concepts with JAVA,” (7th or Newer Edition), Wiley: ISBN 978-0-471-76907-1 M. Kiefer and S.A. Smolka, “Introduction to Operating System Design and Implementation: The OSP 2 Approach,” 2007 (Java version) or M. Kiefer and S.A. Smolka, “OSP: An Environment for Operating System Projects,” Addison-Wesley, 1991 (C version) Lecture Notes: Posted regularly on moodle http://moodle2.lsu.edu Resources: Will be provided with an UNIX account (in classes) to work in project. CSC 4103: Operating Systems 0.3 B. B. Karki, LSU Grading Policy Grading Scale: A = 90 % or more B = 78 to 89 % C = 65 to 77 % D = 50 to 64 % F = below 50 %. Grading Items: Quiz (pop) (10 %) Homework (15 %) Programming (15 %) Midterm Exam (30 %) Final Exam (30 %) CSC 4103: Operating Systems 0.4 B. B. Karki, LSU Rules/Recommendation Late submission of homework/programming assignments will be penalized. Excuse can be granted in special circumstances. No books, lecture notes, laptops and other materials will be allowed in quizzes and exams. Academic dishonesty will be treated seriously. CSC 4103: Operating Systems 0.5 B. B. Karki, LSU Homework and Programming Assignments Homework: 15 % of total grading Assigned at the rate of approximately 3 weeks. Also useful in preparation for the mid-term and final exams. Programming: 15 % of total grading OSP: Operating System Project Implementation and exploration of key OS features and algorithms OSP manual and textbook. Other programming Implementation outside OSP. Working on Unix machine. Java or C/C++. CSC 4103: Operating Systems 0.6 B. B. Karki, LSU Topics To Be Covered Overview Operating Systems CSC 4103: Operating Systems 0.7 B. B. Karki, LSU Overview Introduction Computer System Structures Operating System Structures CSC 4103: Operating Systems 0.8 B. B. Karki, LSU Process Management Processes Threads CPU Scheduling Process Synchronization Deadlocks CSC 4103: Operating Systems 0.9 B. B. Karki, LSU Memory Management Main Memory Virtual Memory CSC 4103: Operating Systems 0.10 B. B. Karki, LSU Mass Storage Management File-System Interface File-System Implementation I/O Systems Mass-Storage Structure CSC 4103: Operating Systems 0.11 B. B. Karki, LSU Protection and Security Protection Security CSC 4103: Operating Systems 0.12 B. B. Karki, LSU Sample Exam Questions The questions in midterm and final exams will be of three types. Type A: True or false statements Type B: Short answer (descriptive or numerical) questions Type C: Long answer (multi-part) questions The list of the sample questions given here is not complete but it gives you an idea about what the exam would look like. The number of questions and the order they appear in the actual exams will vary. Closed-book exams: Books, notes and computers are not allowed. Six (or more) quizzes (10 % + 5 % bonus), midterm (30 %) and final (30 %). CSC 4103: Operating Systems 0.13 B. B. Karki, LSU Type A Questions (Each = 1 Point) Answer “True” or “False” to the following statements. Desktop system is mainly concerned with convenience. The FCFS scheduling can never be preemptive. In a pure demand paging, some pages of a process are kept in the main memory prior to the process execution. DMA transfers data between devices and memory byte by byte. A counting semaphore can be implemented with binary semaphores. The N-step disk-scheduling algorithm suffers from starvation. CSC 4103: Operating Systems 0.14 B. B. Karki, LSU Type B Questions (Each = 2 or 3 Points) 1. Define CPU bound and I/O bound processes. What would be the problem if all processes were CPU bound? 2. Describe how the hardware supports segmentation. 3. A single-lane bridge connects the north and south parts of a town. The bridge can become deadlocked if both a northbound and a southbound vehicle get on the bridge at the same time. The drivers are stubborn and are not willing to back up. Using semaphores, design an algorithm that prevents the deadlock. 4. Consider a 20-block long file on a disk. If you are currently at the 10th logical block and want to access logical block 15, how many physical blocks must be read from the disk according to the index allocation scheme? Justify your answer. Assume that the information about the file is already in memory. 5. If the average waiting time is 30 ms for the queue of average number of 8 processes, calculate the average arrival rate. CSC 4103: Operating Systems 0.15 B. B. Karki, LSU Type C Questions (Each = 6 Points) 1. Consider five processes, P1, P2, P3, P4 and P5, with CPU burst times of 10, 29, 3, 7, and 12 milliseconds, respectively. a) Draw Gantt charts for the FCFS, SJF and RR scheduling algorithms (time quantum of 10 ms) b) Find out which of these algorithms would give the minimum average waiting time. c) Compare the average turnaround time between SJF and RR scheduling algorithms. 2. Consider the following page-reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6 How many page faults would occur for the following replacement algorithms, assuming four frames which all are initially free. a) FIFO replacement b) LRU replacement c) Optimal replacement CSC 4103: Operating Systems 0.16 B. B. Karki, LSU Type C Questions (Contd.) 3. A barbershop consists of 5 chairs for the customers to wait and one barber chair for the haircut. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Use the following semaphores to coordinate the barber and customers. semaphore mutex, customers, barber; int waiting; Here, mutex is initialized to 1. The semaphores customers and barber, each of which is initialized to 0, track the availability of customers and barber. The variable waiting, which is initialized to 0 gives a count of waiting customers. a) b) c) d) Explain the meaning of mutex. Determine the type (binary or counting) of the three semaphores. Write the structure of a barber process. Write the structure of a customer process. CSC 4103: Operating Systems 0.17 B. B. Karki, LSU