Download presentation
Presentation is loading. Please wait.
Published byDinah Shields Modified over 8 years ago
1
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1
2
Review Chapters 1 ~ 6 in your textbook Lecture slides In-class exercises (on the course website) Review slides 2
3
Review 5 questions (100 points) + 1 bonus question (20 points) Question types – Q/A 3
4
Time & Place & Event 9:25am ~ 10:40am, Feb. 18, Thursday ENGR 1.272 Closed-book exam 4
5
Chapter 1: Introduction and Overview of Operating Systems Computer system – Hardware – Software Application software System software – Operating system Operating system – resource abstraction: software & hardware abstraction – resource sharing: time & space multiplexing Operating Systems Strategies 5
6
Chapter 1: Software Classification 6 Loader OS Database Management System Database Management System Window System Window System Application Programmer System Software Libraries Compiler Hardware Command Line Interpreter Command Line Interpreter Libraries Software API
7
Chapter 1: Purpose of an OS (What is Resource Management?) “An OS creates resource abstractions” “An OS manages resource sharing” 7
8
Chapter 1: Operating System Functions Resource manager – manage hardware and software resources – Resource abstraction and sharing A nicer environment – implement a virtual machine for processes to run in A program in execution is called a process – a nicer environment than the bare hardware 8
9
Chapter 1: Abstract Resources 9 Hardware Resources OS OS Resources (OS Interface) Middleware Abstract Resources (API) Application User Interface
10
Chapter 1: Resource Management Functions Transform physical resources to logical resources – Resource abstraction Make the hardware resources easier to use Multiplex one physical resource to several logical resources – Create multiple, logical copies of resources Schedule physical and logical resources – Decide who gets to use the resources 10
11
Chapter 1: Resource Sharing Two types of sharing – Time multiplexed sharing time-sharing schedule a serially-reusable resource among several users – Space multiplexed sharing space-sharing divide a multiple-use resource up among several users 11
12
Chapter 1: Operating Systems Strategies Several different strategies have been used – Earliest computers were dedicated to a single program and there was no multiprogramming and no OS – Batch systems – Timesharing systems – There are a few other recent strategies Personal computers and workstations Embedded systems Small, communicating computers Network technology 12
13
Chapter 2: Using the Operating System Operating systems provide a virtual computing environment for application programmers – Functions provided by O.S. – Abstract resources by O.S. Files Processes and threads Objects – Programmers can develop applications more efficiently 13
14
Chapter 2: Using the Operating System (cont'd) Process – an infrastructure in which execution takes place – address space + resources Thread – a program in execution within a process context – each thread has its own stack – Components program counter register set stack space 14
15
Chapter 2: Using the Operating System (cont'd) UNIX fork() creates a process – Creates a new address space – Copies text, data, & stack into new address space – Provides child with access to open files UNIX wait() allows a parent to wait for a child to terminate UNIX execve() allows a child to run a new program UNIX sleep() allows a process to suspend itself for some time Windows CreateProcess() and CreateThread() Examples of using functions above (see lecture slides) 15
16
Chapter 2: Processes vs. Threads Benefits of multithreading – Improve application responsiveness Netscape uses multithreaded programming – Use multiprocessors efficiently – Improve program structure – Use fewer system resources – Faster to switch between threads than processes 16
17
Chapter 2: Algorithms, Programs, and Processes 17 Data Files Other Resources Algorithm Idea Source Program Source Program Binary Program Execution Engine Process Stack Status
18
Chapter 2: Process Abstraction 18 Hardware Data Process Stack Processor Executable Memory Program Operating System
19
Chapter 2: A Process with Multiple Threads 19 Data Files Other Resources Binary Program Process Stack Status Stack Status Stack Status Thread (Execution Engine)
20
Chapter 2: The File Abstraction 20 Hardware Data Process Stack Processor Executable Memory Program Operating System Storage Device File Descriptor File Descriptor
21
Chapter 3: OS Organization Basic OS Responsibilities Basic OS Functions Three basic implementation mechanisms – Processor modes What are Supervisor & user modes? How to switch between them? What are privileged instructions? – I/O instructions, and instructions to change the mode or set the halt flag – Kernels What is trap instruction for? How to use it? – Method of invoking system service How to perform a system call or message passing? 21
22
Chapter 3: Basic OS Organization 22 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager
23
Chapter 3: Device Management OS uses policies chosen by designer or system administrator to manage – Allocation – Isolation – Sharing Device manager in two parts – Device independent – provides unified interface – Device dependent – device driver: handles those aspects unique to a device 23
24
Chapter 3: Process Management 24 Protection Deadlock Synchronization Process Description Process Description Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Process Mgr Scheduler CPU Other H/W
25
Chapter 3: Memory Management 25 Primary Memory Process Manager Process Manager Block Allocation Block Allocation Virtual Memory Virtual Memory Isolation & Sharing Isolation & Sharing Storage Devices
26
Chapter 3: File System Management 26
27
Chapter 3: Processor Modes Mode bit: Supervisor or User mode – Some processors may have more than one mode Supervisor mode (privileged, protected) – Can execute all machine instructions – Can reference all memory locations User mode – Can only execute a subset of instructions – Can only reference a subset of memory locations 27
28
Chapter 3: Trap Instruction 28 … fork(); … fork() { … trapN_SYS_FORK() … } sys_fork() sys_fork() { /* system function */ … return; } Kernel Trap Table
29
Chapter 3: How to Make a System Call For the system – through a trap instruction which causes an interrupt Hardware saves PC and current status information Hardware changes mode to system mode Hardware loads PC from system call interrupt vector location. Execute the system call interrupt handler return from the handler, restores PC and other saved status information User process continues. 29
30
Chapter 3: Message Passing 30 send(…, A, …); receive(…, B, …); receive(…A, …); … send(…, B, …); send/receive
31
Chapter 4: Device Management Abstract all devices (and files) to a few interfaces Device management strategies – Direct I/O with polling – Direct I/O with interrupts – DMA I/O with interrupts – How to use the above strategies to perform I/O? Buffering & Spooling Access time of disk device* – FCFS, SSTF, Scan/Look, Circular Scan/Look – See examples in Exercise (2) 31
32
Chapter 4: Device Management Organization 32 Application Process Application Process File Manager File Manager Device Controller Command Status Data Hardware Interface System Interface Device-Independent Device-Dependent
33
Chapter 4: Direct-Memory Access 33
34
Chapter 5: Implementing Processes, Threads, and Resources Modern process Address space Context switching State diagram 34
35
Chapter 5: Classic Processes New abstraction divides aspects of classic process into two parts – Modern process: the part that defines a customized computational framework in which a program executes – Thread: the part that keeps track of code executions within this framework Classic process = modern process with 1 thread 35
36
Chapter 5: The Address Space 36 Process Address Space Address Binding Executable Memory Other objects Files
37
Chapter 5: Modern Process Composed of: Address space Program to define behavior of process Data used by process Resources needed for thread execution – Process created with a minimal set of resources – Additional resources allocated as needed 37
38
Chapter 5: Context Switching 38 CPU New Thread Descriptor Old Thread Descriptor
39
Chapter 5: Simple State Diagram 39 Ready Blocked Running Start Schedule Request Done Request Allocate
40
Chapter 5: A Generic Resource Manager 40 Process Resource Manager Process Blocked Processes Resource Pool request() release() Policy
41
Good Luck! Q/A 41
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.