120 likes | 333 Views
ecs150 Spring 2013 midterm. Name: Student ID: Email:. Open book and totally 7 questions (4% each, choose EXACTLY 4 to answer, if you answer more than 4 questions, we will only grade the first four answers), 12 pages.
E N D
ecs150 Spring 2013 midterm Name: Student ID: Email: Open book and totally 7 questions (4% each, choose EXACTLY 4 to answer, if you answer more than 4 questions, we will only grade the first four answers), 12 pages. Please write precise and clean answers (should be around half to one full page). But, please do not leave it blank there as I will give partial credits. Please READ the questions VERY CAREFULLY before putting down the final answer. And, also please mark your answer clearly. You can use the back of the pages. Every page of this exam book needs to be returned back. Also, while turning in your exam book, please make sure to SIGN the special sign-up sheet. If you do NOT sign up and in case WE LOSS your exam book, it will be hard to convince us that you actually turn in the exam book back to us. If we suspect any cheating behavior, we will pass the case to the academic committee immediately. Score: ___/16 ecs150 spring 2013, midterm exam
Q-01 • (System Calls 4%) Which of the following statements regarding Unix/FreeBSD system calls is INCORRECT and briefly describe why: • System calls enable user programs to access kernel services. • Under FreeBSD , you need to make system calls to fork/kill a child process. • C. You do NOT need system calls to create kernel-level threads within a user process. • D. "malloc" and "free" are NOT typical examples of system calls. • E. Under FreeBSD, software trap is being used a mechanism to invoke system calls. ecs150 spring 2013, midterm exam
Q-02 • (Scheduling 4%) Which of the following statements about CPU scheduling in FreeBSD is INCORRECT and please briefly explain why? • IO-bound applications (such as text editor) have many short IO- and CPU bursts, while CPU-bound applications such as (high-dimension matrix multiplication) have very long CPU bursts. With the 4BSD scheduling policy, CPU-bound processes, when they are in the READY state, will normally have relatively higher priority than IO-bound processes. • If there are a big number of processes in the READY queue, then the decaying of CPU cycles being charged to processes will happen relatively slower. • IO-bound applications (such as text editor) have many short IO- and CPU bursts, while CPU-bound applications such as (high-dimension matrix multiplication) have very long CPU bursts. With the 4BSD scheduling policy, CPU-bound processes, when they are in the READY state, will normally have relatively lower priority than IO-bound processes. • In FreeBSD 5.x, the “Nice” value (kg_nice) is between -20 and 20. Setting the right “Nice” value can dramatically promote the priority of an CPU-intensive process (i.e., a process with long CPU bursts) over other IO-intensive processes, especially when the overall system load is low. ecs150 spring 2013, midterm exam
Q-03 (Scheduling, 4%) This question is to compare the FreeBSD scheduling (implemented under sched_4bsd.c and kern_switch.c) and the lottery scheduling. Assuming that you are downloading a large file, a couple Terabyte, from the cloud to your local laptop (using tools such as Bit Torrent or other file transfer protocols), at the same time, watching a NBA play-off game online via Internet, and playing an online interactive video game, all on the same laptop. Which scheduler might work better? Please justify your answer. ecs150 spring 2013, midterm exam
Q-04 (Scheduler Activation/KSE, 4%) Please explain the advantage of Scheduler Activation over a pure UTS (User-level Thread Scheduler) system or a pure KTS (Kernel-level Thread Scheduler) system? Please also provide an EXAMPLE to demonstrate your point! ecs150 spring 2013, midterm exam
Q-05 (Priority Inversion, 4%) Please describe what “unbounded priority inversions” is? In particular, what are the necessary conditions for the unbounded priority inversion to occur? ecs150 spring 2013, midterm exam
Q-06 (Priority Ceiling Protocol versus Priority Ceiling Emulation, 4%) What is the difference between PCP (Priority Ceiling Protocol) and PCE (Priority Ceiling Emulation)? Which do you believe is better? Why? ecs150 spring 2013, midterm exam
Q-07 (Priority Inversion, Inheritance, and Ceiling, 4%) This question is regarding priority ceiling protocol. Somewhat similar to the example we went over in the class, the following diagram shows four tasks and their independent execution sequences, of course, assuming no contention of any resources: 1 L L S1 S3 L 2 L L S1 S2 L 3 L L 4 L S2 S2 S2 S2 L 0 2 4 6 8 10 12 14 16 18 The meanings of the labels are: L: Local execution, B: blocked, Si: Semaphore I, C: Ceiling-Driven blocking, F: Finishing, P: Preempted. Please use the charts in the next few pages to lay out the schedules (using the label characters above) for regular priority scheduling (i.e., without solutions like priority inheritance, ceiling, and emulation), basic priority inheritance, priority ceiling, and priority ceiling emulation. Please also put down the effective prioritywhen priority inheritance occurs. Also, if you encounter a deadlock, please point it out as well. ecs150 spring 2013, midterm exam
Regular Priority Scheduling 1 2 3 4 0 2 4 6 8 10 12 14 16 18 ecs150 spring 2013, midterm exam
Basic Priority Inheritance 1 2 3 4 0 2 4 6 8 10 12 14 16 18 ecs150 spring 2013, midterm exam
Priority Ceiling Protocol 1 2 3 4 0 2 4 6 8 10 12 14 16 18 ecs150 spring 2013, midterm exam
Priority Ceiling Emulation 1 2 3 4 0 2 4 6 8 10 12 14 16 18 ecs150 spring 2013, midterm exam