* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download OSreviewS2004
Survey
Document related concepts
Transcript
Mid Term review CSC345 • What is an Operating System? • Various systems and their pros and cons – E.g. multi-tasking vs. Batch • OS definitions – Resource allocator – Control program – Kernel Abstract View of System Components Important OS Features/services • • • • • • • • Process Management (CPU scheduling) Main Memory Management File Management I/O System Management Secondary Management Networking Protection System Command-Interpreter System OS Control Structure Memory Tables Process Image Memory I/O Tables I/O File File Tables Processes Primary Table Process 1 Process 2 … Process N User data User program System stack PCB Process State Diagram dispatch admit New Ready Running time-out activate release event wait Suspend Blocked suspend Exit • System call vs. System program Chapter 2: Computer-System Structures • • • • • • Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture Two I/O Methods Synchronous Asynchronous Dual mode operation & why ? Use of A System Call to Perform I/O Use of A Base and Limit Register Hardware Address Protection OS structure & Layered Approach • The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. • With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers. UNIX System Structure Process Management • • • • Process vs. Thread creation Process scheduling Process Termination Unix process creation fork() & exec() – Identify parent vs. child • How to find out process infomation Process Control Block (PCB) Process vs. Thread creation Multithreading Models • Many-to-One • One-to-One • Many-to-Many ---------------------------------------------• Pthread, JAVA thread, Kernel vs. User thread CPU Switch From Process to Process Process Scheduling Queues • Job queue – set of all processes in the system. • Ready queue – set of all processes residing in main memory, ready and waiting to execute. • Device queues – set of processes waiting for an I/O device. • Process migration between the various queues. Representation of Process Scheduling Schedulers • Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. • Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU. • Midterm scheduler Addition of Medium Term Scheduling Scheduling Criteria • CPU utilization – keep the CPU as busy as possible • Throughput – # of processes that complete their execution per time unit • Turnaround time – amount of time to execute a particular process (finishing time – arrival time) • Waiting time – amount of time a process has been waiting in the ready queue • Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment) Class Exercise Each team works on finding an average turnaround time for a quantum time at 1, 2, 3, 4, 5, 6, 7 Process p1 P2 P3 p4 Time 6 3 7 1 First-Come, First-Served (FCFS) Scheduling ProcessBurst Time P1 24 P2 3 P3 3 P P Parrive in • Suppose that the processes the order: P1 , P2 , P24 3 0 27 30 The Gantt Chart for the schedule is: 1 2 3 Turnaround Time Varies With The Time Quantum Context Switch • When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process. • Context-switch time is overhead; the system does no useful work while switching. • Time dependent on hardware support. User program & Kernel interface Note: This picture is excerpted from Write a Linux Hardware Device Driver, Andrew O’Shauqhnessy, Unix world Two I/O Methods Synchronous Pooling or interrupt Asynchronous