520 likes | 721 Views
Operating Systems. Instructors David Browning Maggie Kirlakovsky Vishal Shah. Outline. Introduction Computer System Components Operating System Definition Process Management Process Concept Process Scheduling Memory Management Background Swapping, Paging, and Segmentation
E N D
Operating Systems Instructors David Browning Maggie Kirlakovsky Vishal Shah
Outline • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems
Outline • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems
What is an operating system? • Computer Hardware – basic computing resources (i.e.,CPU, memory, I/O devices) • Operating system – controls and coordinates the use of the hardware resources • Applications programs – controls how the system resources are used (i.e. compilers, video games) • Users (people, machines, other computers) Operating Systems
Operating System Services Program Execution File-system Manipulation I/O Operations Services Communications Error Detection Operating Systems
Outline Process Memory I/O • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems
Process Concept Process Memory I/O • Process Definition • Running program • Process state • new • running • waiting • ready • terminated Operating Systems
Process Concept Process Memory I/O The Process Control Block (PCB) • Process state • Program counter • CPU registers • CPU scheduling information • Memory-management information • I/O status information Operating Systems
Process Concept Process Memory I/O CPU switch from process to process • Process (Context) Switch Operating Systems
Process Scheduling Process Memory I/O • Scheduler: Processes execution decisions • Preemptive and Nonpreemptive Scheduling • Scheduling criterion • Fairness • Efficiency • Response time • Turnaround • Throughput Operating Systems
FIFO Scheduling P1 P2 P3 0 24 27 30 Process Memory I/O ProcessBurst (Completion) Time P1 24 P2 3 P3 3 • Suppose that the processes arrive in the order: P1 , P2 , P3 The Gantt Chart for the schedule is: • Waiting time for P1 = 0; P2 = 24; P3 = 27 • Average waiting time: (0 + 24 + 27)/3 = 17 Operating Systems
FIFO Scheduling P2 P3 P1 0 3 6 30 Process Memory I/O Suppose that the processes arrive in the order P2 , P3 , P1 . • The Gantt chart for the schedule is: • Waiting time for P1 = ?;P2 = ?; P3 = ? • Average waiting time: ? Operating Systems
Priority Scheduling Queue headers Runnable Processes Highest Priority Priority 4 Priority 3 Priority 2 Lowest Priority Priority 1 Process Memory I/O • A priority number (integer) is associated with each process • The CPU is allocated to the process with the highest priority (smallest integer highest priority). • Problem Starvation • Solution Aging Operating Systems
Round Robin Scheduling Current Process Next Process Current Process B F D G A F D G A B Process Memory I/O • Each process gets a small unit of CPU time – time quantum • At the end of time quantum: • process is preempted • added to the end of the ready queue. • Example Operating Systems
Multilevel Feedback Scheduling Process Memory I/O • A process can move between the various queues • Scheduler parameters: • number of queues • scheduling algorithms for each queue • method used to determine when to upgrade/demote a process • method used to determine which queue a process will enter when that process needs service Operating Systems
Outline Process Memory I/O • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems
Background Process Memory I/O • Program must be brought into memory and placed within a process for it to be run. • Input queue – collection of processes on the disk that are waiting to be brought into memory to run the program. • User programs go through several steps before being run. Operating Systems
Main Memory Process Memory I/O • Operating system responsibilities • Keep track of which parts of memory are currently being used and by whom. • Decide which processes to load when memory space becomes available. • Allocate and deallocate memory space as needed. Operating Systems
Instruction and Data Binding Process Memory I/O • Central idea of memory management • Concept: logical address bound to separate physical address • Three possible stages • Compile time • Load time • Execution time Operating Systems
Memory Management Unit (MMU) Process Memory I/O • Hardware device that maps virtual addresses to physical addresses • Implemented with relocation register • User programs deal with logical addresses only; they never see the real physical address Operating Systems
Swapping Process Memory I/O • Temporary process shifting • “old” processes out • “new” processes in • Backing store • Fast disk • Large enough to accommodate copies of all memory images for all users • Provides direct access to these images Operating Systems
Contiguous Allocation Process Memory I/O • Two partitions of main memory • Resident operating system in low memory • User processes in high memory • Single-partition • Relocation register • Protect user processes from each other • Protect operating system code and data • Limit register • Contains range of logical addresses • Multiple partition • Multiple blocks of available memory, or holes • Incoming processes allocated memory from hole large enough to accommodate them Operating Systems
Single Partition Hardware Process Memory I/O Operating Systems
Contiguous Allocation (cont.) Process Memory I/O • Operating system responsibility • Maintain partition information • Allocated partitions • Free partitions (holes) • Allocation Algorithms • First-fit • Best-Fit • Worst-Fit Operating Systems
Allocation Example Process Memory I/O OS OS OS OS process 5 process 5 process 5 process 5 process 9 process 9 process 8 process 10 process 2 process 2 process 2 process 2 Operating Systems
Paging and Address Translation Process Memory I/O Paging and Address Translation with TLB Paging and Address Translation Operating Systems
Page Faults and Replacement Process Memory I/O Page Replacement Process Page Fault Handling Operating Systems
Page Replacement Algorithms Process Memory I/O • First-In First-Out (FIFO) Algorithm • Optimal Algorithm • Least Recently Used (LRU) Algorithm • Second Chance (Clock) Algorithm Operating Systems
Example: FIFO Algorithm Process Memory I/O 6! • 3 Frame Memory • 3 pages can be in memory at a time per process • Reference String: 7,0,1,2,0,3,0 • How many page faults? Operating Systems
Thrashing Process Memory I/O • Thrashing a process is busy swapping pages in and out. Operating Systems
Segmentation Process Memory I/O • Memory-management scheme that supports user view of memory • Programs can be broken into logical segments, as follows: • Main program • Procedure • Method • Objects • Variables • Stack • Array • Etc. Operating Systems
Segmentation Architecture Process Memory I/O • Logical address two tuple • <segment #, offset> • Segment table • Maps two-dimensional physical addresses • Base starting physical address in memory • Limit specifies length of segment Operating Systems
Segmentation Example Process Memory I/O Operating Systems
Outline Process Memory I/O • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems
What Is I/O? Process Memory I/O I/O is one of the main functions of an OS • Issues commands • Catches interrupts • Handles errors • Interface Operating Systems
I/O Hardware Process Memory I/O • ECEs -> chips, wires, power supply … • CS -> commands that HW accepts, the functions it carries out, and errors reported • Two parts • Devices • Device controller • Communicates with OS • A model for connecting the CPU, memory, controllers and I/O devices Operating Systems
Life Cycle of An I/O Request Process Memory I/O Operating Systems
Outline Process Memory I/O • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplex Operating System Demo Operating Systems
Windows 2000 Windows Linux • 32-bit multitasking OS for Intel microprocessors • System goals • Portability • Security • POSIX compliance (IEEE 1003.3 standard) • Multiprocessor support • Extensibility • Compatibility with MS-DOS and ms-windows applications Operating Systems
Windows 2000 Architecture Windows Linux Operating Systems
Virtual Memory Manager Windows Linux • Page-base management scheme • Two step process to allocate memory • Reserves a portion of the processor’s address space • Commits the allocation by assigning space in the 2000 paging file • Automatically reclaims allocated memory when a process terminates Operating Systems
Virtual Memory Layout Windows Linux Operating Systems
I/O Manager Windows Linux • Responsible for • file systems • cache management • device drivers • network drivers • Works with VM Manager to provide memory-mapped file I/O • Controls the 2000 cache manager • Synchronous and asynchronous operations Operating Systems
Linux Basics Windows Linux • Main design goals are speed, efficiency, and standardization • Compliant with POSIX documents Operating Systems
Process Management Windows Linux • Process control block • Process properties fall into three groups • Identity • Environment • Context • Scheduling • Virtual memory Operating Systems
Scheduling Windows Linux • Running and interrupting of processes • Linux adds kernel tasks • Requested by a running process • Execute internally on behalf of a device driver. Operating Systems
Process Scheduling Windows Linux • FIFO and Round-robin real-time scheduling • Runs the process with the highest priority • Continue to run until they either exit or block Operating Systems
Memory Management Windows Linux Buddy-Heap Algorithm Operating Systems
Input/Output Windows Linux • Two caches disk access • Page cache • Buffer cache • Three device classes • Block • Character • Network Operating Systems
Outline Simplix • Introduction • Computer System Components • Operating System Definition • Process Management • Process Concept • Process Scheduling • Memory Management • Background • Swapping, Paging, and Segmentation • Virtual Memory • I/O Management • I/O Hardware • Transformation of requests to hardware • Case Studies • Simplix Operating System Demo Operating Systems