Workshop 1 Slides - dhdurso.org index to available resources

Download Report

Transcript Workshop 1 Slides - dhdurso.org index to available resources

Workshop 1: Agenda
•
•
•
•
•
•
•
•
•
Introductions and discussion on course overview
Formation of study groups.
Discussion on the study group project.
Lecture and discussion on computer architecture evolution
Group activity on development of operating systems (1/2 hr)
Break
Lecture and discussion on components of a computer system.
Group activity on common classes of system services. (1/2 hr)
Workshop summary and preview of the next workshop.
Operating System Concepts
1.1
Silberschatz and Galvin 1999
CSS/420 Topics
•
•
•
•
•
•
•
•
•
Computer Components and Operation
Process management
Concurrency
Memory Management
File Systems
Input/Output
Distributed Systems & Networking
Security
Examples (Unix, Linux, Windows NT)
Operating System Concepts
1.2
Silberschatz and Galvin 1999
CSS/420 Schedule
•
•
•
•
Workshop 1: Introduction, O/S Evolution, Components
Workshop 2: Processes and resource allocation
– Homework
– Study group paper & presentations
Workshop 3: Memory management
– Homework
– Study group paper & presentations
Workshop 4: File systems
– Homework
– Study group paper only - no presentation!
– Exam # 1 (1 hr): ch’s 1-11
Operating System Concepts
1.3
Silberschatz and Galvin 1999
CSS/420 Schedule (cont’d)
•
•
•
•
Workshop 5: Input/Output
– Homework: ch’s 12-14
– Study group paper & presentation
Workshop 6: Distributed systems & networks
– Homework: ch’s 15-18
– Study group paper & presentation
Workshop 7: Security
– Homework: ch’s 19, 20
– Study group paper & presentation
Workshop 8: Final
– Study group final paper
– Study group final presentation
– Exam #2: ch’s 12-20
Operating System Concepts
1.4
Silberschatz and Galvin 1999
CSS/420 Study Group Project
•
•
•
•
•
•
•
•
•
•
Select an O/S (DOS, Linux, Unix, Windows NT, etc.)
Brief presentation weeks 2, 3, 5, 6, 7
Paper all weeks 2-7
Workshop2: Processes, Scheduling
Workshop 3: Memory Management
Workshop 4: File Systems
Workshop 5: Input/Output
Workshop 6: Distributed Systems
Workshop 7: Security
Workshop 8: Final Paper and Oral Presentation
Operating System Concepts
1.5
Silberschatz and Galvin 1999
Study Group Project (cont’d)
•
•
Final presentation
– All study group members
– ½ hour
– Visuals (demo if desired)
Final paper
– 12-15 pages (formed from interim papers)
– APA format
– Table of contents
– Introduction, Body, Conclusion
– References
– Spell, grammar checked
Operating System Concepts
1.6
Silberschatz and Galvin 1999
Study Group Project (Cont’d)
•
Topics
– Processes & concurrency
– Main & secondary storage management
– File system
– I/O control
– Distributed structures (lite)
– Security
Operating System Concepts
1.7
Silberschatz and Galvin 1999
Module 1: Introduction to O/S’s
•
•
•
•
•
•
•
•
What is an operating system?
Simple Batch Systems
Multiprogramming Batch Systems
Time-Sharing Systems
Personal-Computer Systems
Parallel Systems
Distributed Systems
Real -Time Systems
Operating System Concepts
1.8
Silberschatz and Galvin 1999
What is an Operating System?
•
•
•
A program that acts as an intermediary between a user of a
computer and the computer hardware.
Operating system goals:
– Execute user programs and make solving user problems
easier.
– Make the computer system convenient to use.
Use the computer hardware in an efficient manner.
Operating System Concepts
1.9
Silberschatz and Galvin 1999
Computer System Components
1. Hardware – provides basic computing resources (CPU, memory,
I/O devices).
2. Operating system – controls and coordinates the use of the
hardware among the various application programs for the various
users.
3. Applications programs – define the ways in which the system
resources are used to solve the computing problems of the users
(compilers, database systems, video games, business
programs).
4. Users (people, machines, other computers).
Operating System Concepts
1.10
Silberschatz and Galvin 1999
Abstract View of System Components
Operating System Concepts
1.11
Silberschatz and Galvin 1999
Operating System Definitions
•
•
Resource allocator – manages and allocates resources.
•
Kernel – the one program running at all times (all else being
application programs).
Control program – controls the execution of user programs and
operations of I/O devices .
Operating System Concepts
1.12
Silberschatz and Galvin 1999
Simple Batch Systems
•
•
•
•
•
•
Hire an operator
User  operator
Add a card reader
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 pack to monitor
Operating System Concepts
1.13
Silberschatz and Galvin 1999
Memory Layout for a Simple Batch System
Operating System Concepts
1.14
Silberschatz and Galvin 1999
Control Cards
•
•
Problems
1. How does the monitor know about the nature of the job
(e.g., Fortran versus Assembly) or which program to
execute?
2. How does the monitor distinguish
(a) job from job?
(b) data from program?
Solution
– Introduce control cards
– Special character in column 1
– Ex’s: $FTN, $JOB, $RUN
Operating System Concepts
1.15
Silberschatz and Galvin 1999
Spooling
•
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(queue) – data structure that allows the OS to select
which job to run next in order to increase CPU utilization. Basis
for short-term and long-term scheduling data structures.
Operating System Concepts
1.16
Silberschatz and Galvin 1999
Multiprogrammed Batch Systems
Several jobs are kept in main memory at the same time, and the
CPU is multiplexed among them.
Operating System Concepts
1.17
Silberschatz and Galvin 1999
OS Features Needed for Multiprogramming
•
•
•
•
•
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.
Key performance measure is throughput and turn-around time.
Operating System Concepts
1.18
Silberschatz and Galvin 1999
Time-Sharing Systems–Interactive Computing
•
•
•
•
•
The CPU is multiplexed among several jobs that are kept in
memory and on disk (the CPU is allocated to a job only if the job
is in memory).
A job swapped in and out of memory to the disk.
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.
Key performance measure is response time.
Operating System Concepts
1.19
Silberschatz and Galvin 1999
Personal-Computer Systems
•
Personal computers – computer system dedicated to a single
user.
•
•
•
I/O devices – keyboards, mice, monitors, printers, CD-ROM’s.
•
•
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 or protection features.
Commonly have graphics intensive user interfaces
Modern PC’s have a very sophisticated hardware architecture
designed to support both multi-tasking and graphics.
Operating System Concepts
1.20
Silberschatz and Galvin 1999
Migration of Operating-System Concepts and Features
Operating System Concepts
1.21
Silberschatz and Galvin 1999
Parallel Systems
•
•
•
•
Multiprocessor systems with more than on 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
Types of parallel systems:
– Symmetric
– Asymmetric
Operating System Concepts
1.22
Silberschatz and Galvin 1999
Real-Time Systems
•
•
•
•
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 shortterm memory, or read-only memory (ROM)
– Conflicts with time-sharing systems, not supported by
general-purpose operating systems.
– Mostly the province of special 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.
Operating System Concepts
1.23
Silberschatz and Galvin 1999
Distributed Systems
•
•
Network Operating System (NOS)
– provides file sharing
– provides communication scheme
– runs independently from other computers on the network
– Ex: NetWare
Distributed Operating System
– less autonomy between computers
– gives the impression there is a single operating system
controlling the network.
Operating System Concepts
1.24
Silberschatz and Galvin 1999
O/S Evolution
Group Activity
Select an O/S
subject
I/O structure
Storage
Memory
Hardware protection
Storage hierarchy
Prepare
"blackboard"
presentation
History
Key concepts
Etc.
Operating System Concepts
1.25
Silberschatz and Galvin 1999
Module 2: Computer-System Structures
•
•
•
•
•
•
Computer System Operation
I/O Structure
Storage Structure
Storage Hierarchy
Hardware Protection
General System Architecture
Operating System Concepts
1.26
Silberschatz and Galvin 1999
Computer-System Architecture
Registers
are here
Also called
RAM
Operating System Concepts
1.27
Silberschatz and Galvin 1999
Computer-System Operation
•
•
•
•
•
•
I/O devices and the CPU can execute concurrently.
Each device controller is in charge of a particular device type.
Each device controller has a local buffer.
CPU moves data from/to main memory to/from local buffers
I/O is from the device to local buffer of controller.
Device controller informs CPU that it has finished its operation by
causing an interrupt.
Operating System Concepts
1.28
Silberschatz and Galvin 1999
Common Functions of Interrupts
•
•
•
•
•
Interrupt transfers control to the interrupt service routine
generally, through the interrupt vector, which contains the
addresses of all the service routines.
Interrupt architecture must save the address of the interrupted
instruction.
Incoming interrupts are disabled while another interrupt is being
processed to prevent a lost interrupt.
A trap is a software-generated interrupt caused either by an error
or a user request.
An operating system is interrupt driven.
Operating System Concepts
1.29
Silberschatz and Galvin 1999
Interrupt Handling
•
•
•
The operating system preserves the state of the CPU by storing
registers and the program counter.
Determines which type of interrupt has occurred:
– polling
– vectored interrupt system (note: PC’s use this)
Separate segments of code determine what action should be
taken for each type of interrupt
Operating System Concepts
1.30
Silberschatz and Galvin 1999
Interrupt Time Line For a Single Process Doing Output
Operating System Concepts
1.31
Silberschatz and Galvin 1999
I/O Structure
•
•
After I/O starts, control returns to user program only upon I/O
completion (blocking I/O, synchronous).
– wait instruction idles the CPU until the next interrupt
– wait loop (contention for memory access).
– At most one I/O request is outstanding at a time, no
simultaneous I/O processing.
After I/O starts, control returns to user program without waiting
for I/O completion (non-blocking I/O, asynchronous).
– System call – request to the operating system to allow user
to wait for I/O completion.
– Device-status table contains entry for each I/O device
indicating its type, address, and state.
– Operating system indexes into I/O device table to determine
device status and to modify table entry to include interrupt.
Operating System Concepts
1.32
Silberschatz and Galvin 1999
Direct Memory Access (DMA) Structure
•
•
•
Used for high-speed I/O devices able to transmit informatin at
close to memory speeds.
Device controller transfers blocks of data from buffer storage
directly to main memory without CPU intervention.
Only on interrupt is generated per block, rather than the one
interrupt per byte.
Operating System Concepts
1.33
Silberschatz and Galvin 1999
Storage Structure
•
Main memory – only large storage media that the CPU can
access directly.
•
Secondary storage – extension of main memory that provides
large nonvolatile storage capacity.
•
Magnetic disks – rigid metal or glass platters covered with
magnetic recording material
– Disk surface is logically divided into tracks, which are
subdivided into sectors.
– The disk controller determines the logical interaction
between the device and the computer.
Operating System Concepts
1.34
Silberschatz and Galvin 1999
Moving-Head Disk Mechanism
Operating System Concepts
1.35
Silberschatz and Galvin 1999
Storage-Device Hierarchy
Operating System Concepts
1.36
Silberschatz and Galvin 1999
Storage Hierarchy (Cont’d)
•
•
Caches
– Main memory
– High speed system level (on-board caches)
– I/O controllers (ex: disk)
– Etc.
Buffers
Operating System Concepts
1.37
Silberschatz and Galvin 1999
Hardware Protection
•
•
•
•
Dual-Mode Operation, Protection Rings, etc.
I/O Protection
Memory Protection
CPU Protection
Operating System Concepts
1.38
Silberschatz and Galvin 1999
Dual-Mode Operation
•
•
Mode bit added to computer hardware to indicate the current
mode: monitor (0) or user (1).
When an interrupt or fault occurs hardware switches to
monitor mode.
Interrupt/fault
monitor
user
set user mode
•
Privileged instructions can be issued only in monitor mode.
Operating System Concepts
1.39
Silberschatz and Galvin 1999
I/O Protection
•
•
All I/O instructions are privileged instructions.
Must ensure that a user program could never gain control of the
computer in monitor mode (I.e., a user program that, as part of its
execution, stores a new address in the interrupt vector).
Operating System Concepts
1.40
Silberschatz and Galvin 1999
Memory Protection via Base and Limit
Operating System Concepts
1.41
Silberschatz and Galvin 1999
Protection Hardware
•
•
When executing in monitor mode, the operating system has
unrestricted access to both monitor and user’s memory.
The load instructions for the base and limit registers are
privileged instructions.
Operating System Concepts
1.42
Silberschatz and Galvin 1999
CPU Protection
•
•
•
•
Timer – interrupts computer after specified period to ensure
operating system maintains control.
– Timer is decremented every clock tick.
– When timer reaches the value 0, an interrupt occurs.
Timer commonly used to implement time sharing.
Time also used to compute the current time.
Load-timer is a privileged instruction.
Operating System Concepts
1.43
Silberschatz and Galvin 1999
General-System Architecture
•
•
Given the I/O instructions are privileged, how does the user
program perform I/O?
System call – the method used by a process to request action by
the operating system.
– Usually takes the form of a trap to a specific location in the
interrupt vector.
– Control passes through the interrupt vector to a service
routine in the OS, and the mode bit is set to monitor mode.
– The monitor verifies that the parameters are correct and
legal, executes the request, and returns control to the
instruction following the system call.
Operating System Concepts
1.44
Silberschatz and Galvin 1999
Use of A System Call to Perform I/O
Operating System Concepts
1.45
Silberschatz and Galvin 1999
Module 3: Operating-System Structures
•
•
•
•
•
•
•
•
System Components
Operating System Services
System Calls
System Programs
System Structure
Virtual Machines
System Design and Implementation
System Generation
Operating System Concepts
1.46
Silberschatz and Galvin 1999
Common System Components
•
•
•
•
•
•
•
•
Process Management
Main Memory Management
Secondary-Storage Management
I/O System Management
File Management
Protection System
Networking
Command-Interpreter System
Operating System Concepts
1.47
Silberschatz and Galvin 1999
Process Management
•
•
A process is a program in execution. A process needs certain
resources, including CPU time, memory, files, and I/O devices, to
accomplish its task.
The operating system is responsible for the following activities in
connection with process management.
– Process creation and deletion.
– process suspension and resumption.
– Provision of mechanisms for:
 process synchronization
 process communication
Operating System Concepts
1.48
Silberschatz and Galvin 1999
Unix Process Creation
Operating System Concepts
1.49
Silberschatz and Galvin 1999
Main-Memory Management
•
•
•
Memory is a large array of words or bytes, each with its own
address. It is a repository of quickly accessible data shared by
the CPU and I/O devices.
Main memory is a volatile storage device. It loses its contents in
the case of system failure.
The operating system is responsible for the following activities in
connections with memory management:
– 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.
Operating System Concepts
1.50
Silberschatz and Galvin 1999
Secondary-Storage Management
•
•
•
Since main memory (primary storage) is volatile and too small to
accommodate all data and programs permanently, the computer
system must provide secondary storage to back up main
memory.
Most modern computer systems use disks as the principle on-line
storage medium, for both programs and data.
The operating system is responsible for the following activities in
connection with disk management:
– Free space management
– Storage allocation
– Disk scheduling
Operating System Concepts
1.51
Silberschatz and Galvin 1999
I/O System Management
•
Operating System Concepts
The I/O system consists of:
– A buffer-caching system
– A general device-driver interface
– Drivers for specific hardware devices
1.52
Silberschatz and Galvin 1999
File Management
•
•
A file is a collection of related information defined by its creator.
Commonly, files represent programs (both source and object
forms) and data.
The operating system is responsible for the following activities in
connections with file management:
– 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 (nonvolatile) storage media.
Operating System Concepts
1.53
Silberschatz and Galvin 1999
Protection System
•
•
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.
Operating System Concepts
1.54
Silberschatz and Galvin 1999
Command-Interpreter System
•
Many commands are given to the operating system by control
statements which deal with:
– process creation and management
– I/O handling
– secondary-storage management
– main-memory management
– file-system access
– protection
– networking
Operating System Concepts
1.55
Silberschatz and Galvin 1999
Command-Interpreter System (Cont.)
•
The program that reads and interprets control statements is
called variously:
– control-card interpreter
– command-line interpreter (command.com in DOS)
– shell (in UNIX)
Its function is to get and execute the next command statement.
•
Most modern systems have a graphical front end (Windows,
Unix/Linux KDE, etc.) to this.
Operating System Concepts
1.56
Silberschatz and Galvin 1999
Operating System Services
•
Program execution – system capability to load a program into
memory and to run it.
•
I/O operations – since user programs cannot execute I/O
operations directly, the operating system ust provide some
means to perform I/O.
•
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
tied together by a network. Implemented via shared memory or
message passing.
•
Error detection – ensure correct computing by detecting errors in
the CPU and memory hardware, in I/O devices, or in user
programs.
Operating System Concepts
1.57
Silberschatz and Galvin 1999
Additional Operating System Functions
Additional functions exist not for helping the user, but rather for
ensuring efficient system operations.
• Resource allocation – allocating resources to multiple users
or multiple jobs running at the same time.
• Accounting – keep track of and record which users use how
much and what kinds of computer resources for account
billing or for accumulating usage statistics.
• Protection – ensuring that all access to system resources is
controlled.
Operating System Concepts
1.58
Silberschatz and Galvin 1999
System Calls
•
•
System calls provide the interface between a running program
and the operating system.
– Generally available as assembly-language instructions.
– Languages defined to replace assembly language for
systems programming allow system calls to be made
directly (e.g., C, C++)
Three general methods are used to pass parameters between a
running program and the operating system.
– Pass parameters in registers.
– Store the parameters in a table in memory, and the table
address is passed as a parameter in a register.
– Push (store) the parameters onto the stack by the program,
and pop off the stack by operating system.
Operating System Concepts
1.59
Silberschatz and Galvin 1999
MS-DOS Execution
At System Start-up
Operating System Concepts
Running a Program
1.60
Silberschatz and Galvin 1999
UNIX Running Multiple Programs
Operating System Concepts
1.61
Silberschatz and Galvin 1999
Communication Models
Msg Passing
Operating System Concepts
Shared Memory
1.62
Silberschatz and Galvin 1999
System Programs
•
•
System programs provide a convenient environment for program
development and execution. The can be divided into:
– File manipulation
– Status information
– File modification
– Programming language support
– Program loading and execution
– Communications
– Application programs
Most users’ view of the operation system is defined by system
programs, not the actual system calls.
Operating System Concepts
1.63
Silberschatz and Galvin 1999
System Structure – Simple Approach
•
MS-DOS – written to provide the most functionality in the least
space
– not divided into modules
– Although MS-DOS has some structure, its interfaces and
levels of functionality are not well separated
Operating System Concepts
1.64
Silberschatz and Galvin 1999
MS-DOS Layer Structure
Operating System Concepts
1.65
Silberschatz and Galvin 1999
System Structure – Simple Approach (Cont.)
•
UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring. The UNIX OS consists
of two separable parts.
– Systems programs
– The kernel
 Consists of everything below the system-call interface
and above the physical hardware
 Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level.
Operating System Concepts
1.66
Silberschatz and Galvin 1999
UNIX(BSD) System Structure
Operating System Concepts
1.67
Silberschatz and Galvin 1999
System Structure – Layered Approach
•
•
•
The operating system is divided into a number of layers (levels),
each built on top of lower layers. The bottom layer (layer 0), is
the hardware; the highest (layer N) is the user interface.
With modularity, layers are selected such that each uses
functions (operations) and services of only lower-level layers.
Bottom layers are the kernel. Some systems(NT, MACH) use a
micro kernel architecture.
Operating System Concepts
1.68
Silberschatz and Galvin 1999
NT Architecture
Operating System Concepts
1.69
Silberschatz and Galvin 1999
Virtual Machines
• Host one environment on another
– Linux dosemu
– Mainframe VM systems
– Mac PowerPC 6800 emulation
Operating System Concepts
1.70
Silberschatz and Galvin 1999
Virtual Machines (Cont’d)
Non-virtual Machine
Operating System Concepts
Virtual Machine
1.71
Silberschatz and Galvin 1999
Operating System Implementation
•
•
•
Traditionally written in assembly language, operating systems
can now be written in higher-level languages.
Code written in a high-level language:
– can be written faster.
– is more compact.
– is easier to understand and debug.
An operating system is far easier to port (move to some other
hardware) if it is written in a high-level language (NT, Unix)
Operating System Concepts
1.72
Silberschatz and Galvin 1999
System Generation (SYSGEN)
•
•
•
•
Operating systems are designed to run on any of a class of
machines; the system must be configured for each specific
computer site.
SYSGEN program obtains information concerning the specific
configuration of the hardware system.
Booting – starting a computer by loading the kernel.
Bootstrap program – code stored in ROM that is able to locate
the kernel, load it into memory, and start its execution.
Operating System Concepts
1.73
Silberschatz and Galvin 1999
System Services
Group Activity
•
•
Select a service area:
– Program execution
– I/O operation
– File manipulation
– Error detection
– Communications
Operating System Concepts
1.74
Give a brief 5 – 10 minute
presentation
– How performed
– Data structures
– 1 presenter is fine
Silberschatz and Galvin 1999
Next Week (WS2): Agenda
•
•
•
•
•
•
•
•
Reading: ch’s 4-7. Note: scan only material related to graph theory
Homework Review: ch’s 4-7
Study group papers & presentations
Lecture & discussion on process types & concepts
Group activity on processes and resources
Lecture & discussion on resource allocation
Group activity on process management
Summary & preview
Operating System Concepts
1.75
Silberschatz and Galvin 1999
Next Week (WS2): Study Group
•
•
•
How O/S manages processes & concurrency
– process scheduling
– interprocess communication
– process synchronization
– deadlocks
– etc.
3 - 5 page paper
Presentation
– 5 - 10 minutes
– 1 person can represent group
Operating System Concepts
1.76
Silberschatz and Galvin 1999