Principles of Operating Systems: Design & Applications

39
Principles of Operating Systems: Design & Applications Chapter 1 Introduction to Operating Systems

description

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 - PowerPoint PPT Presentation

Transcript of Principles of Operating Systems: Design & Applications

Page 1: Principles of Operating Systems: Design & Applications

Principles of Operating Systems:Design & Applications

Chapter 1

Introduction to Operating Systems

Page 2: Principles of Operating Systems: Design & Applications

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

Page 3: Principles of Operating Systems: Design & Applications

Objectives (cont.)

understand some of the general trends in OS development

be able to describe the bootstrapping process understand how system calls work

Page 4: Principles of Operating Systems: Design & Applications

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

Page 5: Principles of Operating Systems: Design & Applications

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

Page 6: Principles of Operating Systems: Design & Applications

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

Page 7: Principles of Operating Systems: Design & Applications

Service Provider

Provides common functionality, simplifying applications

Provides standard interfaces, making applications more consistent

Principles of Operating Systems: Design & Applications 7

Page 8: Principles of Operating Systems: Design & Applications

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

Page 9: Principles of Operating Systems: Design & Applications

Areas of OS Responsibility

Hardware CPU Memory I/O Devices

File Systems Security

Principles of Operating Systems: Design & Applications 9

Page 10: Principles of Operating Systems: Design & Applications

Areas of OS Responsibility

Others not covered here Networking User Interfaces

Principles of Operating Systems: Design & Applications 10

Page 11: Principles of Operating Systems: Design & Applications

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

Page 12: Principles of Operating Systems: Design & Applications

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

Page 13: Principles of Operating Systems: Design & Applications

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

Page 14: Principles of Operating Systems: Design & Applications

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

Page 15: Principles of Operating Systems: Design & Applications

I/O Device Management Provides common device interface tasks Manages exclusive access Hides device details

Principles of Operating Systems: Design & Applications 15

Page 16: Principles of Operating Systems: Design & Applications

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

Page 17: Principles of Operating Systems: Design & Applications

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

Page 18: Principles of Operating Systems: Design & Applications

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

Page 19: Principles of Operating Systems: Design & Applications

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

Page 20: Principles of Operating Systems: Design & Applications

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

Page 21: Principles of Operating Systems: Design & Applications

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

Page 22: Principles of Operating Systems: Design & Applications

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

Page 23: Principles of Operating Systems: Design & Applications

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

Page 24: Principles of Operating Systems: Design & Applications

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

Page 25: Principles of Operating Systems: Design & Applications

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

Page 26: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 26

The Triangle of Ones

Page 27: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 27

Operating System Structure Monolithic

Kernel structured as a single program Usual design techniques Often criticized

Page 28: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 28

Operating System Structure (cont.) Layered Design

Dependency on only lower layers Tricky to structure Often requires splitting subsystems into multiple

layers

Page 29: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 29

Layered Design Example

Page 30: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 30

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

Page 31: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 31

Microkernel Example

Page 32: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 32

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

Page 33: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 33

Virtual Machine Example

Page 34: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 34

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

Page 35: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 35

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

Page 36: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 36

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

Page 37: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 37

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

Page 38: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 38

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

Page 39: Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications 39