Вы находитесь на странице: 1из 34

Slide 1

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

CECS 326
Professor: Mr. Ratana Ngo Textbook Title: Operating Systems, 3rd edition Author: Gary Nutt ISBN: 0-201-77344-9 Assignments and Grading Programs and homework packets: 25% Quizzes and Exams: 50% Final exam: 25%

Purpose and Benefits


1. Sharing computing resources 2. Management of computing resources CPU, memory, other devices, and software 3. Speed of computation 4. Uniformity and portability Hardware interface Software interface 5. Mask system complexity 6. Internetworking 7. Protection, security, and reliability

System Software
Application Programmer

Slide 4

Software SoftwareAPI API

System Software

Command Command Line Line Interpreter Interpreter Compiler Compiler Database Database Management Management System System

Loader Loader Libraries Libraries Libraries Libraries

Window Window System System

OS OS
Hardware

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 5

Sharing a CPU
Efficiency: time multiplexing the CPU enables more than one application and more than one user to use the computer system Throughput: multiprogramming reduces the time to execute all computing tasks Responsiveness: multiprogramming minimizes computational delay Multi-tasking raises productivity Multi-threading improves software
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Time and space multiplexing


Process 1 Process 2 Process 3 Process 4

Slide 6

Time-multiplexed CPU

Space-multiplexed Memory

Time Using the processor I/O operation


(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Some considerations
CPU versus I/O (using rough estimates) CPU clock: 1 GHz (or 1 nsec/cycle) Keyboard: 100 wpm < 3000 char/min < 1 char/sec (or 1000 msec per char) Hard disk operation: 10 msec

Conclusion: I/O bound processes User takes hundreds of seconds to enter some data, CPU uses nanoseconds to process it. More than 90% of CPU capacity is wasted. Question: Why are users obsessed with faster CPU? Homework: Consider a DSL line at 1 Mbps! Estimate the difference in speed. Where is the bottleneck?

Slide 8

Supporting multiprogramming
OS features needed for multiprogramming: Interface with input/output devices Management of devices Memory management CPU scheduling

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 9

Using the operating system

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 10

Client-server example

(server) loop forever listen for client connection spawn new child server pass connection to child endloop

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 11

The Shell Strategy


% grep first f3 read keyboard
Shell ShellProcess Process

fork a process Process Process to toexecute execute command command

f3

read file

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

OS Design Constraints
Performance reliability Protection and security Correctness Maintainability Commercial factors Standards and open systems
-- Operating Systems: A Modern Perspective, Chapter 1

Slide 12

(revised) Copyright 2004 Pearson Education, Inc.

Reliability
layout view save print User Interface Application Abstract Resources (API) Middleware OS Resources (OS Interface) OS Hardware Resources
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 13

fwrite cout

write

Slide 14

Performance
The OS is an overhead function should not use too much of machines resources Minimum functionality is to implement generic services Additional function must be traded off against performance
DOS: single process UNIX: command line interface and stream of bytes

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 15

OS services
Program execution system capability to load a program and to run it I/O operations user programs are not allowed to execute I/O operations directly; hence, the OS must provide some means to use I/O devices File system manipulation program capability to read, write, create, and delete files Communications exchange of information between processes executing either on the same computer or on different systems connected together by a network
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 16

OS services
Error detection ensure correct computing by detecting errors in the CPU and memory hardware, I/O devices, or in user programs Additionally:
Resource allocation allocating resources to multiple users or multiple jobs executing concurrently Accounting keep track of and record which users use how much and what kinds of computer resources Protection ensuring that all access to system resources is controlled
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 17

System calls
A system call is an OS function provided by the operating system Applications use system calls to interface/request services from the OS Abstract all devices to a few interfaces: read, write, seek, ioctl, etc. Benefits: security, reliability, stability, uniformity/portability
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

System calls

Slide 18

Process control create, terminate, load, execute, allocate/deallocate memory, suspend, resume, etc. Device management request, release, read, write, seek, mount/unmount, get/set attributes File management create, delete, open, close, read, write, seek, get/set attributes Networking/communications create/delete resources, send/receive data, attach/detach resources Information maintenance get/set time/date, get/set system data, get/set process/file/device attribute, etc.
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 19

Common OS components
Process management Main memory management Secondary management File management Device management Networking/communications Protection and security

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 20

Process management - overview


A process is a program in execution. A process needs resources: CPU time, memory, files, I/O devices, etc. to complete its task. The OS is responsible for:
Process creation and deletion Process suspension and resumption Mechanism for
Process synchronism Process communication
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 21

Main memory management - overview


Memory is a large array of bytes/words, each with its own address. It stores data shared by the CPU and I/O devices. Main memory is volatile. The OS is responsible for:
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
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 22

Secondary storage management - overview Since main memory is too small to accommodate all data and programs, the computer system provides secondary storage to back up main memory Modern computer systems use disks as primary on-line storage medium of data and programs The OS is responsible for:
Free space management Storage allocation Disk scheduling
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 23

File management - overview


A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data. The OS is responsible for:
File creation and deletion Directory creation and deletion Support of primitives for manipulating files and directories Mapping files onto secondary storage File backup on stable storage media
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 24

Device management - overview


The OS abstracts devices to a few common interfaces (see system calls) The I/O device system consists of:
Device allocation Data buffering Data caching Device drivers

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 25

Networking/communications - overview
A distributed system is a collection of processors that do not share memory or a clock. The computers in the system are connected through a communication network Communication takes place via a protocol A distributed system provides users access to various resources
Computational speed up Increased data availability Enhanced reliability
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 26

Protection and security - overview


Protecting directory and file, CPU, I/O devices, memory, etc. Protection refers to a mechanism for controlling access by programs, processes, or users to both system and user resources The protection mechanism must:
Distinguish between authorized and unauthorized usage Specify the controls to be imposed Provide a means of enforcement

Security policy defines strategies for sharing resources and is separate from mechanism
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Basic Operating System Organization


Process, Thread & Resource Manager File Manager

Slide 27

Memory Manager

Device Manager

Processor(s)
(revised) Copyright 2004 Pearson Education, Inc.

Main Memory

Devices

-- Operating Systems: A Modern Perspective, Chapter 1

CPU Modes
Mode bit: Supervisor/monitor or User mode Supervisor mode
Can execute all machine instructions Can reference all memory locations

Slide 28

User mode
Can only execute a subset of instructions Can only reference a subset of memory locations
(revised) Copyright 2004 Pearson Education, Inc. -- Operating Systems: A Modern Perspective, Chapter 1

Slide 29

Kernels
The critical part of the OS trusted code that executes without any constraints essential that the kernel is correct Executes in supervisor mode

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

The UNIX Architecture


Interactive User Application Application Libraries Commands Libraries Commands Programs Programs OS System Call Interface
Device DeviceDriver Driver Device DeviceDriver Driver

Slide 30

DriverInterface Interface Driver

Trap Table

Monolithic Kernel Module


Process Management Memory Management File Management Device Mgmt Infrastructure

Device DeviceDriver Driver

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Linux architecture

Slide 31

monolithic design to minimize the overhead of message passing Linux kernel services include: CPU scheduling, process management, memory management, interprocess communication loadable kernel modules can be loaded or unloaded as needed. these modules include file systems, device drivers, networking, etc. non-kernel OS services are implemented as system library functions

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Slide 32

Microkernel Organization
Process Process Libraries Libraries
User Supervisor

Process Process Process Process

File Filesystem system

Scheduler Scheduler Microkernel Microkernel

Networking Networking

Device Devicemanager manager

Processor(s)
(revised) Copyright 2004 Pearson Education, Inc.

Main Memory

Devices

-- Operating Systems: A Modern Perspective, Chapter 1

Windows NT Organization
T

Slide 33

Process Process
T

T T

Libraries Libraries
User Supervisor

Subsystem Subsystem

Process Management Memory Management File Management Subsystem Subsystem Subsystem Subsystem Device Mgmt Infrastructure

Process Process

Process Process
T T

NT Executive NT Kernel Hardware HardwareAbstraction AbstractionLayer Layer


Processor(s)
(revised) Copyright 2004 Pearson Education, Inc.

I/O I/OSubsystem Subsystem

Main Memory

Devices

-- Operating Systems: A Modern Perspective, Chapter 1

Virtual Machines
Each virtual machine is isolated from all other virtual machines CPU scheduling can create the appearance that users have their own processor Spooling and a file system can provide virtual card readers and virtual line printers A normal user time sharing terminal servers as the virtual machine operators console

Slide 34

(revised) Copyright 2004 Pearson Education, Inc.

-- Operating Systems: A Modern Perspective, Chapter 1

Вам также может понравиться