Transcript
Page 1: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 1

CSS430 IntroductionCSS430 IntroductionTextbook Ch1 – Ch2Textbook Ch1 – Ch2

These slides were compiled from the OSC textbook slides (Silberschatz, Galvin, and Gagne) and the instructor’s class materials.

Page 2: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 2

Course Objectives You will:

Study the fundamental concepts of operating systems

Practice the logical design using Java But not:

Learn how to use/hack Windows and Linux If this is your main objective, you should take

R140/145/R708 of UW Computing Training http://www.washington.edu/computing/training

Skill up system programming with C++ Program 1 will deal with several system calls, but if this is

your main interest, you should take CSS432, CSS434 or other C++ programming courses.

Page 3: CSS430 Introduction Textbook Ch1 – Ch2

Other Noteworthy OSes Distributed OSes All blends of *NIX Any windows competitor

IBM PS/2 NeXT OS Commodore 64 Embedded OSes Low-power OSes

CSS430 Introduction 3

Page 4: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 4

Important Time Lines Program 1: System calls and shell Program 2: Scheduler Midterm: Process Management Program 3: Synchronization Program 4: Paging Final: Memory/File Management Project: Unix-like file system(Check the syllabus for their due dates.)

Page 5: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 5

Important Web Pages and Email Addresses

Our class web:http://courses.washington.edu/css430/index.html

Java:http://java.sun.com/j2se/1.4/docs/api/index.html

Instructor’s email:{mfukuda, ksung, or rynn}@u.washington.edu

Class discussion mailing list:Use the message board.

Assignment submission:Use Catalyst drop box.

Page 6: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 6

What is an Operating System Goals

Making the computer system convenient to use Using computer hardware in an efficient

manner Definitions

Resource allocator – manages and allocates resources

Control program – controls the execution of user programs and operations of I/O devices

Kernel – the one program running at all times (all else being application programs)

Page 7: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 7

Computer System Components

Page 8: CSS430 Introduction Textbook Ch1 – Ch2

OS - Intermediary The OS acts on our behalf as a micro-

manager An OS acts as an intermediary

between the computer and the user It should use resources fairly and

efficiently; ease of use It should protect users from one

another, and from the kernelCSS430 Introduction 8

Page 9: CSS430 Introduction Textbook Ch1 – Ch2

From the Text “an OS is similar to a government”

CSS430 Introduction 9

Page 10: CSS430 Introduction Textbook Ch1 – Ch2

More from the Dino Book “Like a government, the OS

performs no useful function by itself”

CSS430 Introduction 10

Page 11: CSS430 Introduction Textbook Ch1 – Ch2

O.S. & Computer Architecture As hardware is introduced, Oses are

built to make the hardware useable As Oses evolve, it becomes obvious

that certain hardware elements could simplify the operation of the kernel

So, a back-and-forth cycle exists.

CSS430 Introduction 11

Page 12: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 12

Operating Systems History Batch systems: Multiprogramming: IBM360 Time-sharing systems: Multics, Unix Personal-computer systems: Windows,

Linux Distributed systems: Amoeba, Mach

Page 13: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 13

Batch Systems A job is assembled of the program,

the data, and some control information (in control cards).

Programmers pass their jobs to an operator.

The operator batched together jobs.

OS transfers control from one job to another.

Each job output is sent back to the programmer.

Page 14: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 14

Multiprogramming Several jobs are kept in main

memory at the same time. OS picks one of them to execute. The job may have to wait for a slow

I/O operation to complete. OS switches to and executes

another job. To facilitate multiprogramming, OS

needs: Job scheduling Memory management

Page 15: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 15

Time-Sharing Systems This is a logical extension of

multiprogramming. Each user has at least one

separate program in memory. A program in execution is referred

to as a process. Process switch occur so

frequently that the users can interact with each program while it is running.

File system allows users to access data and program interactively.

Page 16: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 16

Personal-Computer Systems

Personal computers – computer system dedicated to a single user.

User convenience and responsiveness Can adopt technology developed for larger

operating systems’ some features. At its beginning, a single user system didn’t not

need advanced CPU utilization and protection. Later, file protection is necessary to avoid virus. Overall, the same OS concepts are appropriate

for the various different classes of computers.

Page 17: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 17

Parallel Systems Multiprocessor systems with more than one CPU

in close communication (in one box). Tightly coupled system – processors share

memory and a clock; shared-memory-based communication.

Advantages of parallel system: Increased throughput Economical Increased reliability

Page 18: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 18

Distributed Systems Loosely coupled system – each processor has its

own local memory; message-based communication through various communications lines, such as SAN, LAN, WAN or telephone lines.

Advantages of distributed systems. Resources Sharing (Printer, DB, special devices) Performance (load sharing, process migration) Reliability Communications

http://directory.google.com/Top/Computers/Software/Operating_Systems/Network/Distributed/

Page 19: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 19

Real-Time Systems Dedicated to a single application: controlling

scientific experiments, medical imaging systems, industrial, and military control systems (ex. Dam control, nuclear reactor, missile guiding, etc.).

Hard deadline Hard real-time system.

Data stored in short-term memory or ROM Conflicts with time-sharing systems

Soft real-time system Best effort to meet the deadline Useful in applications (multimedia, virtual

reality, QoS)

Page 20: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 20

Computer Hardware

Page 21: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 21

Synchronous I/O During execution, each

program needs I/O operations to receive keyboard inputs, open files, and print out results.

At the early computer era, a program had to wait for an I/O operation to be completed. (Synchronous I/O)

This frequently causes CPU idle.

requesting processwaiting

device driver

Interrupt handler

Hardwaredata transfer

user

kernel

time

Page 22: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 22

Async I/O and Interrupts Asynchronous I/O

returns control to a user program without waiting for the I/O to complete.

When the I/O is completed, an interrupt occurs to CPU that temporarily suspends the user program and handles the I/O device.

requesting processcontinuing

device driver

Interrupt handler

Hardwaredata transfer

user

kernel

time

Page 23: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 23

Discussions 11. What tasks should OS perform in

order to suspend and resume a program? List them.

Program suspension

Program resumption

1.2...

1.2...

Page 24: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 24

Hardware Protection Purpose:

With resource sharing, many programs could be affected by a bug in one program.

Incorrect or malicious resource accesses cause a hardware trap to the operating system.

Dual-Mode Operation: User mode: no privileged instructions allowed. Kernel mode: Privileged instructions allowed.

I/O Protection: all privileged Memory Protection: A region from the base to the limit

register allowed to use CPU Protection: CPU allowed to use until the timer

gets 0.

Page 25: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 25

Dual-Mode Operations Provide hardware support to differentiate

between at least two modes of operations.1. User mode – execution done on behalf of a

user.2. Monitor mode (also supervisor mode,

system mode, or Kernel mode) – execution done on behalf of operating system.

Switching between two modes Device interrupts, hardware traps, system calls

cause a trap to the kernel mode The operating system returns to the user mode

after servicing requests.

Page 26: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 26

System Calls

Page 27: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 27

Discussions 2 Early computers did not have interrupts, timers,

and/or privileged instructions. What features was OS unable to facilitate?

Features not supported by HW

Features not facilitated by OS

Asynchronous I/O and interruptsTimers

Privileged instructions

Page 28: CSS430 Introduction Textbook Ch1 – Ch2

CSS430 Introduction 28

Discussions 3 List three distinct events upon which OS

can get back CPU from the current user program.

1.

2.

3.

Page 29: CSS430 Introduction Textbook Ch1 – Ch2

Project 1 – System Calls & Shells

This warmup exercise has two parts: A C/C++ app that makes direct

system calls to UNIX A Shell.java program that runs with

ThreadOS

CSS430 Introduction 29

Page 30: CSS430 Introduction Textbook Ch1 – Ch2

Part 1 Experiment with User-to-OS APIs System calls in C/C++ on Unix

See the list of system calls you are to use in the assignment

CSS430 Introduction 30

Page 31: CSS430 Introduction Textbook Ch1 – Ch2

Part 2 To get started, download the

ThreadOS files at /usr/apps/css430/ThreadOS/

Grab the class files, too! You’ll need these more than the src for

hw1

CSS430 Introduction 31

Page 32: CSS430 Introduction Textbook Ch1 – Ch2

Grading Guide See

http://courses.washington.edu/css430/prog/prog1.html

More on this Thursday

CSS430 Introduction 32


Recommended