410 likes | 671 Vues
Principles of Operating Systems: Design & Applications. Chapter 1 Introduction to Operating Systems. Objectives. be able to discuss ways of defining the operating system understand the different roles the OS plays have a general picture of the areas of OS responsibility
E N D
Principles of Operating Systems: Design & Applications Chapter 1 Introduction to Operating Systems
Objectives • be able to discuss ways of defining the operating system • understand the different roles the OS plays • have a general picture of the areas of OS responsibility • have a general understanding of the evolution of operating systems
Objectives (cont.) • understand some of the general trends in OS development • be able to describe the bootstrapping process • understand how system calls work
What is an Operating System? • Everything in the distribution? • Just the kernel? • Our working definition: The kernel and any programs necessary to provide services to applications Principles of Operating Systems: Design & Applications 4
What is an Operating System? • Manages the hardware resources among competing entities • Provides common services to applications • Interfaces applications to hardware Principles of Operating Systems: Design & Applications 5
Resource Manager • Allocates scarce resources • Protects entities from interfering with each other • Protects itself and the overall system from both malicious and accidental damage • Programs run at the pleasure of the OS Principles of Operating Systems: Design & Applications 6
Service Provider • Provides common functionality, simplifying applications • Provides standard interfaces, making applications more consistent Principles of Operating Systems: Design & Applications 7
Virtual Machine • Defines a number of characteristics not found on the hardware • Presents a cleaner and easier “machine” for applications to run on • Hides the boundary between OS and hardware, allowing flexibility in hardware design while still running the same programs Principles of Operating Systems: Design & Applications 8
Areas of OS Responsibility • Hardware • CPU • Memory • I/O Devices • File Systems • Security Principles of Operating Systems: Design & Applications 9
Areas of OS Responsibility • Others not covered here • Networking • User Interfaces Principles of Operating Systems: Design & Applications 10
Process Management • Manages CPU in terms of running programs, called processes • Schedules processes, picking the next one to get the CPU • Switches between processes, called context switching Principles of Operating Systems: Design & Applications 11
Process-Related Services • Creating processes • Terminating processes • Changing process parameters (e.g. priority) • Providing interprocess communication • Providing process synchronization Principles of Operating Systems: Design & Applications 12
Memory Management • Assigns areas of memory belonging to processes to areas of physical memory • Manages requests that exceed available physical memory • Controls sharing of memory Principles of Operating Systems: Design & Applications 13
Memory-Related Services • Direct allocation requests • Direct freeing of memory • Serving memory needs implicit in other services • Managing sharing of areas of memory Principles of Operating Systems: Design & Applications 14
I/O Device Management • Provides common device interface tasks • Manages exclusive access • Hides device details Principles of Operating Systems: Design & Applications 15
I/O-Related Services • Establish access to a device • Release a device • Read from a device • Write to a device • Grant exclusive access to a device • Provide special device operations Principles of Operating Systems: Design & Applications 16
File System Management • Provides translation from names to resources • Manages persistent storage of data • Presents a device-independent interface • Protects resources from unauthorized access Principles of Operating Systems: Design & Applications 17
File System-Related Services • Open a file • Close a file • Read from a file • Write to a file • Seek within a file • Query and modify file parameters Principles of Operating Systems: Design & Applications 18
Security • Part of other management responsibilities • Authenticates the identity of a requester • Authorizes access according to a security policy Principles of Operating Systems: Design & Applications 19
Networking • Implements protocol stacks • Provides services for: • Establishing connections to remote systems • Listening for connections from remote systems • Exchanging data with remote systems Principles of Operating Systems: Design & Applications 20
Early OS History • No OS on earliest machines • Collections of useful routines: • First code reuse • Foreshadowed the service provider aspect of operating systems • Machines scheduled with sign-up sheets Principles of Operating Systems: Design & Applications 21
Batch Operating Systems • Most CPU time wasted during time slots • Separate users from the CPU for more efficient CPU usage • Take programs, run them to completion, and produce results • Trade off efficient CPU usage for loss of user effectiveness • Potentially long time between submitting a job and getting results Principles of Operating Systems: Design & Applications 22
Time-Sharing Operaing Systems • Shorter time slots mean more efficient CPU usage • Take short time slots to the limit • Rapidly switch among running programs and provide multiple user interfaces • Useful even with a single user Principles of Operating Systems: Design & Applications 23
Distributed Operating Systems • After allowing multiple users and programs, multiple machines comes next • Manage multiple computing systems as a single pool of computing resources • Share file systems • Support multiple CPUs cooperating on a single task Principles of Operating Systems: Design & Applications 24
Key Trends • Move away from one user, one program, one computer-break the triangle of “ones” • Make interfaces more uniform • Trade off CPU cycles for user convenience: • CPU time gets less expensive • Human time gets more expensive Principles of Operating Systems: Design & Applications 25
The Triangle of Ones Principles of Operating Systems: Design & Applications 26
Operating System Structure • Monolithic • Kernel structured as a single program • Usual design techniques • Often criticized Principles of Operating Systems: Design & Applications 27
Operating System Structure (cont.) • Layered Design • Dependency on only lower layers • Tricky to structure • Often requires splitting subsystems into multiple layers Principles of Operating Systems: Design & Applications 28
Layered Design Example Principles of Operating Systems: Design & Applications 29
Microkernels • Move much of the traditional kernel functionality into separate programs • Reduce the size of the kernel • Components communicate with messages passed through the microkernel Principles of Operating Systems: Design & Applications 30
Microkernel Example Principles of Operating Systems: Design & Applications 31
Virtual Machine OS • Virtualize the hardware • Create the illusion of multiple machines • Each guest believes it has the hardware to itself • Allows different OSs to run at the same time Principles of Operating Systems: Design & Applications 32
Virtual Machine Example Principles of Operating Systems: Design & Applications 33
Bootstrapping • Load the kernel into memory and transfer control to it • Loaders are like miniOSs • Understand enough memory management to put kernel into memory • Understand enough I/O and file systems to locate kernel and read it into memory Principles of Operating Systems: Design & Applications 34
PC Bootstrapping Sequence • BIOS loads Master Boot Record (MBR) from first block on the disk • MBR load first block from active partition • Partition boot block: • Some load the kernel directly • Some load a secondary loader which loads the kernel Principles of Operating Systems: Design & Applications 35
System Calls • Interface between apps and kernel • Looks like a function call in high-level languages • Usually implemented with a software interrupt • Processed in a higher-privilege processor mode Principles of Operating Systems: Design & Applications 36
Summary • OS roles • Resource manager, service provider, virtual machine • OS responsibilities • CPU, memory, I/O devices, file systems, security, networking • Historical evolution • No OS→Batch→Time-sharing→Distributed • Increased concurrency at each step Principles of Operating Systems: Design & Applications 37
Summary (cont.) • OS organizations • Monolithic, layered, microkernel, virtual machine • Bootstrapping • OS-like loaders • Locate the kernel, load it, and run it • System Calls • Key to service provider role • Application/OS interface Principles of Operating Systems: Design & Applications 38