Overview CSE120 Principles of Operating Systems Prof Yuanyuan YY Zhou Midterm Review Oct 19th 2010 The midterm Architectural support for OSes OS modules interfaces and structures Processes Threads Synchronization Scheduling Deadlock 2 10 19 2010 Midterm Please do not cheat Do not copy from your neighbor No one involved will be happy particularly the teaching staff 3 Arch Support for OSes Covers material through scheduling Based upon lecture material optional homeworks and projects No cheat sheets CSE 120 Midterm Review Types of architecture support Manipulating privileged machine state Generating and handling events Events Interrupts exceptions system calls etc You will be noticed 10 19 2010 CSE 120 Midterm Review 4 10 19 2010 CSE 120 Midterm Review 1 Privileged Instructions What are privileged instructions Events Who gets to execute them How does the CPU know whether they can be executed Difference between user and kernel mode Why do they need to be privileged What do they manipulate 10 19 2010 CSE 120 Midterm Review 6 OS services and abstractions Interfaces Operations supported by components 7 10 19 2010 CSE 120 Midterm Review What is the difference between exceptions and interrupts CSE 120 Midterm Review Modules Modules How do I O devices use interrupts 10 19 2010 OS Modules and Interfaces Synchronous fault exceptions system calls Asynchronous interrupts software interrupt What are faults and how are they handled What are system calls and how are they handled What are interrupts and how are they handled Protected control registers Memory management I O devices 5 Events 8 Processors Memory I O Secondary storage Files Protection Account Command interpreter shell 10 19 2010 CSE 120 Midterm Review 2 Processes Process Data Structures What is a process What is the difference between a process and a program What is contained in a process Process Control Blocks PCBs State queues 9 10 19 2010 CSE 120 Midterm Review What information does it contain How is it used in a context switch 10 What are process states What is the process state graph When does a process change state How does the OS use queues to keep track of processes 10 19 2010 Process Manipulation What does it mean for it to return twice What is a thread What does exec on Unix do Threads What does fork on Unix do How is it different from fork How are fork and exec used to implement shells 10 19 2010 CSE 120 Midterm Review 12 What is the difference between a thread and a process How are they related Why are threads useful What is the difference between user level and kernel level threads 11 CSE 120 Midterm Review What are the advantages disadvantages of one over another 10 19 2010 CSE 120 Midterm Review 3 Thread Implementation How are threads managed by the run time system Thread control blocks thread queues How is this different from process management Fork yield sleep etc What does thread yield do 13 10 19 2010 CSE 120 Midterm Review 14 What guarantees do critical sections provide What are the requirements of critical sections Mutual exclusion safety Progress liveness Bounded waiting no starvation liveness Performance What does Acquire do What does Release do What does it mean for Acquire Release to be atomic How can locks be implemented How does mutual exclusion relate to critical sections What are the mechanisms for building critical sections How does test and set swap work What are the limitations of using spinlocks interrupts Locks semaphores monitors condition variables 10 19 2010 CSE 120 Midterm Review 16 Spinlocks Disable enable interrupts Blocking Nachos 15 CSE 120 Midterm Review Locks What is mutual exclusion What is a critical section Global variables static objects Heap objects 10 19 2010 Mutual Exclusion Race condition Corruption Bank account example When are resources shared Voluntary and involuntary context switches Coordinate access to shared data structures Coordinate thread process execution What can happen to shared data structures if synchronization is not used What is a context switch What is the difference between non preemptive scheduling and preemptive thread scheduling Why do we need synchronization What operations do threads support Synchronization What kind of lock does it implement Inefficient interrupts turned off too long 10 19 2010 CSE 120 Midterm Review 4 Semaphores What is a semaphore Monitors What does P Decrement do What does V Increment do How does a semaphore differ from a lock What is the difference between a binary semaphore and a counting semaphore In what way does a monitor provide mutual exclusion How does a monitor differ from a semaphore How does a monitor differ from a lock What kind of support do monitors require Readers Writers problem Bounded Buffers problem 17 10 19 2010 CSE 120 Midterm Review 18 Coordinating the execution of threads Not mutual exclusion What are the semantics of Wait What are the semantics of Signal What are the semantics of Broadcast How are condition variables different from semaphores 10 19 2010 CSE 120 Midterm Review 20 Shared data Procedures A lock for mutual exclusion to procedures w a queue Queues for the condition variables What is the difference between Hoare and Mesa monitors 19 CSE 120 Midterm Review What does the implementation of a monitor look like Operations Language run time support Implementing Monitors What is a condition variable used for To what extent is it provided 10 19 2010 Condition Variables Shared data Procedures Synchronization When do threads block on semaphores When are they woken up again Using semaphores to solve synchronization problems What is a monitor Semantics of signal whether the woken up waiter gets to run immediately or not What are their tradeoffs What does Java provide 10 19 2010 CSE 120 Midterm Review 5 Locks and Condition Vars Scheduling In Nachos we don t have monitors But we want to be able to use condition variables So we isolate condition variables and make them independent not associated with a monitor Instead we have to associate them with a lock mutex Now to use a condition variable Components When does scheduling happen Scheduler dispatcher Job changes state e g waiting to running Interrupt exception Job creation termination Threads must first acquire the lock mutex CV Wait releases the lock before blocking acquires it after waking up 21 10 19 2010 CSE 120 Midterm Review 22 10 19 2010 Scheduling Goals 23 Starvation Goals CSE 120 Midterm Review Maximize CPU utilization Maximize job throughput Minimize
View Full Document
Unlocking...