CSS430: Introduction - UW Faculty Web Server

Download Report

Transcript CSS430: Introduction - UW Faculty Web Server

CSS430 Introduction
Textbook Ch1 – Ch2
These slides were compiled from the OSC textbook slides (Silberschatz, Galvin,
and Gagne) and the instructor’s class materials.
CSS430 Introduction
1
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.
CSS430 Introduction
2
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
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.)

CSS430 Introduction
4
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.
CSS430 Introduction
5
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)
CSS430 Introduction
6
Computer System Components
CSS430 Introduction
7
OS - Intermediary




The OS acts on our behalf as a micromanager
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 kernel
CSS430 Introduction
8
From the Text

“an OS is similar to a government”
CSS430 Introduction
9
More from the Dino Book

“Like a government, the OS performs
no useful function by itself”
CSS430 Introduction
10
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
Operating Systems History





Batch systems:
Multiprogramming: IBM360
Time-sharing systems: Multics, Unix
Personal-computer systems: Windows, Linux
Distributed systems: Amoeba, Mach
CSS430 Introduction
12
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.
CSS430 Introduction
13
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
CSS430 Introduction
14
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.
CSS430 Introduction
15
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.
CSS430 Introduction
16
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
CSS430 Introduction
17
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/
CSS430 Introduction
18
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)
CSS430 Introduction
19
Computer Hardware
CSS430 Introduction
20
Synchronous I/O

requesting process
waiting
user
device driver
kernel

Interrupt handler
Hardware
data transfer

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.
time
CSS430 Introduction
21
Async I/O and Interrupts
requesting process
continuing
user

device driver
kernel

Interrupt handler
Hardware
data transfer
time
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.
CSS430 Introduction
22
Discussions 1
1.
What tasks should OS perform in order
to suspend and resume a program? List
them.
Program suspension
Program resumption
1.
2.
..
1.
2.
..
CSS430 Introduction
23
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.
CSS430 Introduction
24
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.
CSS430 Introduction
25
System Calls
CSS430 Introduction
26
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
interrupts
Timers
Privileged instructions
CSS430 Introduction
27
Discussions 3

List three distinct events upon which OS can
get back CPU from the current user program.
1.
2.
3.
CSS430 Introduction
28
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
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
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
Grading Guide


See
http://courses.washington.edu/css430/
prog/prog1.html
More on this Thursday
CSS430 Introduction
32