Download Lecture 2 - Overview

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Spring (operating system) wikipedia , lookup

Distributed operating system wikipedia , lookup

Process management (computing) wikipedia , lookup

Unix security wikipedia , lookup

Burroughs MCP wikipedia , lookup

VS/9 wikipedia , lookup

Paging wikipedia , lookup

CP/M wikipedia , lookup

Transcript
Operating System - Overview
Lecture 2
OPERATING SYSTEM STRUCTURES
•
•
•
•
•
•
•
•
•
Main componants of an O/S
Process Management
Main Memory Management
File Management
I/O System Management
Secondary Management
Networking
Protection System
Command-Interpreter System
The Modern Computer System
• Figure 1.1 A computer system consists of
hardware, system programs, and
application programs.
PROCESS MANAGEMENT
– A process is a program in execution: (A program is passive, a process
active.)
– A process has resources (CPU time, files) and attributes that must be
managed.
– Management of processes includes:
•







Process Scheduling (priority, time management, . . . )
Creation/termination
Block/Unblock (suspension/resumption )
Synchronization
Communication
Deadlock handling
Debugging
MAIN MEMORY MANAGEMENT




•
•
•
Allocation/de-allocation for processes, files, I/O.
Maintenance of several processes at a time
Keep track of who's using what memory
Movement of process memory to/from secondary storage.
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.
Os componants
•
I/O MANAGEMENT
 Buffer caching system
 Generic device driver code
 Drivers for each device - translate read/write requests into disk position
commands.
•
SECONDARY STORAGE MANAGEMENT
 Disks, tapes, optical, ...
 Free space management ( paging/swapping )
 Storage allocation ( what data goes where on disk )
 Disk scheduling
Os componants
•
NETWORKING
 Communication system between distributed processors.
 Getting information about files/processes/etc. on a remote machine.
 Can use either a message passing or a shared memory model.
•
PROTECTION
 Of files, memory, CPU, etc.
 Means controlling of access
 Depends on the attributes of the file and user
•
SYSTEM PROGRAMS
 Command Interpreters -- Program that accepts control statements (shell, GUI
interface, etc.)
 Compilers/linkers
 Communications (ftp, telnet, etc.)
Input and Output
Introduction
•
4 main parts that make up computer
1.
2.
3.
4.
•
•
Processor
Memory
File system
Input and Output
I/O device and actions are slow
compared to the other 3 parts
Wide variation in nature of I/O devices.
Operating System must find way of
dealing with this.
Simple Computer
The organization of a simple computer with
one CPU and two I/O devices
I/O Characteristics
Characteristic
Examples
Data Rate
Disk: 2Mb/s
Keyboard: 10 – 15 bytes/s
Unit of Transfer
Disk: blocks of 512, 1024 bytes
Screen: single characters
Operations
Disk: read, write, seek etc
Printer: write, move paper
Error Conditions
Disk: Read errors
Printer: paper out
Device Controllers
• Figure 3-2. A model for connecting the
CPU, memory,
controllers, and I/O devices.
I/O Operation
• Computer uses an I/O system bus
• Each I/O device has controller attached to
I/O system bus
• Devices have unique address so
processor can identify device it wishes to
communicate
• Uses interrupts
Interrupts
• I/O device can work away independantly of
processor activity
• To do this it uses interrupts, I/O device sends a
signal to processor to say it has completed part
of task. Processor can then assign more work
for device.
• Example 1 playing music in cd player can work
independantly, press eject button sends interrupt
to processor.
• Example 2 production line in factory
Interrupts Continued
How interrupts happens. Connections between devices and
interrupt controller actually use interrupt lines on the bus
rather than dedicated wires
Direct Memory Access (DMA)
• Most computer systems use DMA
• This enables much faster data rates
• The I/O device can access memory
directly
• Processor only involvement is in initiating
the transfer after that device accesses
memory directly
Direct Memory Access (DMA)
• Figure 3-4. Operation of a DMA transfer.
Operation of a DMA transfer
Objectives of I/O System
• Efficiency – maintain devices operating at
the highest possible rate doing useful work
• Device independence – we don’t care how
system works so long as it does it’s job.
Example we don’t care how printer is
designed or what rollers cogs etc it has.
When we go to file and print we want it to
produce a printer page.
Structure of I/O System
Operating System
InputOutput
Control
System
Application
Program
Device
Controller
(hardware)
Device
Driver
System
Calls
I/O Bus
Structure of I/O System
I/O Control
System
NIC Driver
Windows/Unix Operating System
Practical Example
Device
Controller
(hardware)
Device
(hardware)
Device Drivers
• When you buy a network card, printer,
scanner you receive software to load on
your computer so operating system can
communicate with the device.
• More and more operating system have
drivers preinstalled.
Device Controllers
• Device controller is hardware unit which is
attached to the I/O bus of the computer
and provides a hardware interface
between the computer and the I/O device
itself.
• Example ISA or PCI slot in PC, keyboard
or mouse port.
Block and Character devices
• Block devices are complicated, character
are relatively simple. Examples
– Block: Hard Disk, Floppy Disk
– Character: Printer, Network Card
• Two main types of I/O devices
– Block: transfers blocks of data at a time
– Character: transfer single character at a time
Device Drivers
• Logical position of device drivers is shown here
• Communications between drivers and device
controllers goes over the bus
Virtual Devices
• Virtual device is a simulation of an actual
device
• Most common example is print spooler.
This improves efficiency by printing to a
file and the actual print off can take place
when system is quiet.
Buffering - problem
• Problem from below diagram we can see
time to transfer data from I/O device causes
processor P to wait – very inefficient.
User
Process
Operating
System
Disk
Drive
Concept
Work Area
T1
P1
T2
P2
Unbuffered Transfer
T3
P3
Timing
Buffering - solution
• A buffer is an intermediate main memory
storage area under the control of the operating
system which holds data in transit between the
users work area and the device.
User
Process
Operating
System
Disk
Drive
Concept
Work Area
T1
M1
P1
M2
T2
P2
M3
T3
Unbuffered Transfer
P3
Timing
I/O Buffering
I/O Buffering
Buffering - summary
• Yet a further improvement is to use double
buffering i.e. two separate memory stores.
• I/O devices cannot keep pace with processor, in
single process environment processor would be
continuously waiting. In practice many
processes are competing for processor so that
buffering is effective in smoothing out peaks and
troughs in I/O data rates and contributes to
keeping the processor busy and to working I/O
devices at optimum speed.
Windows I/O
• Windows uses a
software module
called the InputOutput Manager
Windows O/S I/O system
• In Windows application programs
communicate with devices by making calls
to device drivers. These are implemented
as Dynamic Link Libraries (DLL’s) which
are executable code modules, that can be
loaded at run-time as required and which
then become effectively part of the
operating system.
Benefits of DLL’s
• Sharable code – loaded into memory only once.
Most applications use standard drivers such as
display and keyboard drivers.
• Driver for new device can be implemented
without having to modify the o/s
• Range of optional drivers made available and
configured for range of devices eg printers.
• Only drivers actually required by system need to
be loaded saving memory resources.