49

Understand model of operation Easier to see how to use the system Enables you to write efficient code Learn to design an OS Even so, OS is pure

Embed Size (px)

Citation preview

Page 1: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure
Page 2: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Understand model of operation Easier to see how to use the system Enables you to write efficient code

Learn to design an OS Even so, OS is pure overhead of real work Application programs have the real value

to person who buys the computer

2

Page 3: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

A computer system consists of hardware and software that are combined to provide a tool to solve specific problems Hardware includes CPU, memory, disks,

printers, screen, keyboard, mouse ... Software includes

System software A general environment to create specific

applications Application software

A tool to solve a specific problem

3

Page 4: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

4

ApplicationSoftware

SystemSoftware

Hardware

(a) End UserView

(b) ApplicationProgrammer View

(c) OS ProgrammerView

ApplicationSoftware

ApplicationSoftware

SystemSoftware

SystemSoftware

Hardware Hardware

cutsave

printsend

malloc()fork()

open() read-disktrack-mouse

start-printer

Page 5: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Independent of applications, but common to all

Examples C library functions A window system A database management system Resource management functions

5

Page 6: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Process: An executing program Resource: Anything that is needed for

a process to run Memory Space on a disk The CPU

“An OS creates resource abstractions” “An OS manages resource sharing”

6

Page 7: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

7

Hardware Resources

OS

OS Resources (OS Interface)

Middleware

Abstract Resources (API)

Application

User Interface

Page 8: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Provides an abstract model of the operation of hardware components Like data abstraction in Object-Oriented

programming Interface functions Internal functions and status

Eliminates the tedious details that a programmer would otherwise have to handle

8

Page 9: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Processor: execute instructions Memory: store programs and data Input/output (I/O)controllers: transfer to

and from devices Disk devices: long-term storage Other devices: conversion between

internal and external data representations

9

Page 10: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

10

Page 11: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Everything that a programmer needs to know in order to write programs that perform desired operation on the hardware Disk drive is an example

Disk interface provides functions to move disk head, transfer data

Monitor Monitor interface provides functions to move the

cursor, display characters/graphics

11

Page 12: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

System software Provides a general programming environment

in which programmers can create specific applications

Application software Intended to solve a specific problem

12

Page 13: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

13

LoaderLoader

OSOSDatabaseManagement

System

DatabaseManagement

System

WindowSystem

WindowSystem

ApplicationProgrammer

Sys

tem

Sof

twar

e

LibrariesLibraries

CompilerCompiler

Hardware

CommandLine

Interpreter

CommandLine

Interpreter

LibrariesLibrariesLibrariesLibraries

Software APISoftware API

Page 14: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

The operating system is the part of the system software that manages the use of the hardware used by other system software and all application software It is the system program that acts between

the hardware and the user programs

14

Page 15: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

It provides services to user programs Through system calls / message passing

File system services Memory services I/O services

It hides hardware from user programs When your program shows a message on the

monitor, it does not need to know the details When your program generates a new file, it

does not need to where the free space is on your hard drive

15

Page 16: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Major differences between OS and general system software General system software relies on the

abstractions provided by OS OS abstracts the hardware directly OS provides the fundamental trusted

mechanisms for resource sharing A general purpose OS is domain-independent

16

Page 17: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

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

17

Page 18: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

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

18

Page 19: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Three interface functions load(block, length, device) seek(device, track) out(device, sector)

19

Page 20: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

An abstract function for writing

write(char *block, int len, int device,

int track, int sector)

{

...

load(block, length, device);

seek(device, 236);

out(device, 9);

...

}

20

Page 21: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

21

load(…);seek(…);out(…);

void write() { load(…); seek(…) out(…)}

int fprintf(…) { ... write(…) …}

(a) Direct Control (b) write() abstraction

(c) fprintf() abstraction

ApplicationProgrammer

OS Programmer

Page 22: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

The dark side … While simplifying the way application

programmers can control hardware, abstraction can limit the flexibility by which specific hardware can be manipulated

Certain operations may be impossible to achieve using the abstraction

22

Page 23: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Concurrent execution Two or more processes appear to be (or

actually are) executing at the same time Parallel execution

Two or more processing actually executing simultaneously

Processes which are concurrent, or parallel, must share the computer

23

Page 24: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

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

24

Page 25: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

25

- Called multiprogramming

Page 26: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

26

- Resulted in concurrent execution or concurrency

Page 27: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

27

Time

Using the processorI/O operation / paused

0 ti

Pi’s Total Execution Time, ti

(a) Pi’s Use of Machine Resources

Time

P1

P2

Pi

PN

(a) All Processes’ Use of Machine Resources

• Improves performance

Page 28: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

28

Page 29: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

29

Page 30: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

30

Page 31: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Resource isolation and sharing Protection

Prevent unauthorized access of resources by one process when they are currently allocated to another

Sharing

Resource allocation Scheduling

31

Page 32: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Not always When resource abstraction or sharing is not

needed Some programs run “stand-alone” Early computers did not have a sophisticated

OS OS was evolved along the hardware

technology But they are very useful

Reusable functions Easier to use than the bare hardware

32

Page 33: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

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

33

Page 34: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Reduce setup time by batching similar jobs

Automatic job sequencing – automatically transfers control from one job to another. First rudimentary operating system.

Resident monitor initial control in monitor control transfers to job when job completes control transfers back to

monitor

34

Page 35: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

35

Job 19

Input Spooler Output Spooler

Job 3

Input Spool Output Spool

Page 36: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

36

Page 37: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Overlap I/O of one job with computation of another job. While executing one job, the OS Reads next job from card reader into a

storage area on the disk (job queue). Outputs printout of previous job from disk to

printer. Job pool – data structure that allows the

OS to select which job to run next in order to increase CPU utilization

37

Page 38: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

38

Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.

Page 39: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

I/O routine supplied by the system Memory management – the system must

allocate the memory to several jobs CPU scheduling – the system must

choose among several jobs ready to run Allocation of devices

39

Page 40: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

The goal is to enable users to interact with the computer system Batch processing systems do not allow user

interactions On-line communication between the user

and the system is provided When the operating system finishes the execution

of one command, it seeks the next “control statement” not from a card reader, but rather from the user’s keyboard.

On-line system must be available for users to access data and code.

40

Page 41: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

41

PhysicalMachine

AbstractMachines

Command

Command

Command

Result

Result

Result

Page 42: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Personal computers – computer system dedicated to a single user.

I/O devices – keyboards, mice, display screens, small printers.

User convenience and responsiveness. Can adopt technology developed for larger

operating system often individuals have sole use of computer and

do not need advanced CPU utilization of protection features.

42

Page 43: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

43

Win32 APIWin32 API

Windows CE(Pocket PC)

Windows CE(Pocket PC)

Windows 95/98/MeWindows 95/98/Me

Windows NT/2000/XPWindows NT/2000/XP

Win32 API SubsetWin32 API Subset

Win32 API SubSetWin32 API SubSet

Page 44: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems.

Well-defined fixed-time constraints. Hard real-time system.

Secondary storage limited or absent, data stored in short-term memory, or read-only memory (ROM)

Conflicts with time-sharing systems, not supported by general-purpose operating systems.

Soft real-time system Limited utility in industrial control or robotics Useful in applications (multimedia, virtual reality)

requiring advanced operating-system features.

44

Page 45: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Multiprocessor systems with more than one CPU in close communication.

Tightly coupled system – processors share memory and a clock; communication usually takes place through the shared memory.

Advantages of parallel system: Increased throughput Economical Increased reliability

graceful degradation fail-soft systems

45

Page 46: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Distribute the computation among several physical processors

Loosely coupled system – each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines

Advantages of distributed systems Resources Sharing Computation speed up – load sharing Reliability Communications

46

Page 47: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

Network operating system provides file sharing provides communication scheme runs independently from other computers on

the network Distributed operating system

less autonomy between computers gives the impression there is a single

operating system controlling the network.

47

Page 48: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

48

Page 49: Understand model of operation  Easier to see how to use the system  Enables you to write efficient code  Learn to design an OS  Even so, OS is pure

49

Modern OS

Batch

Timesharing

PC & Wkstation

Network OS

Real-TimeMemory Mgmt

Protection

Scheduling

Files

Devices

Memory Mgmt

Protection

Scheduling

System software

Human-Computer Interface

Client-Server Model

Protocols

Scheduling

Small Computer

Network storage,Resource management