operating system - overview

33
Operating System - Overview Lecture 2

Upload: ronny

Post on 21-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Operating System - Overview

Operating System - Overview

Lecture 2

Page 2: Operating System - Overview

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

Page 3: Operating System - Overview

The Modern Computer System

• Figure 1.1 A computer system consists of hardware, system programs, and application programs.

Page 4: Operating System - Overview

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

Page 5: Operating System - Overview

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.

Page 6: Operating System - Overview

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

Page 7: Operating System - Overview

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.)

Page 8: Operating System - Overview

Input and Output

Page 9: Operating System - Overview

Introduction

• 4 main parts that make up computer1. Processor2. Memory3. File system4. 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.

Page 10: Operating System - Overview

Simple Computer

The organization of a simple computer with one CPU and two I/O devices

Page 11: Operating System - Overview

I/O CharacteristicsCharacteristic Examples

Data Rate Disk: 2Mb/sKeyboard: 10 – 15 bytes/s

Unit of Transfer Disk: blocks of 512, 1024 bytesScreen: single characters

Operations Disk: read, write, seek etcPrinter: write, move paper

Error Conditions Disk: Read errorsPrinter: paper out

Page 12: Operating System - Overview
Page 13: Operating System - Overview

Device Controllers

• Figure 3-2. A model for connecting the CPU, memory, controllers, and I/O devices.

Page 14: Operating System - Overview

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

Page 15: Operating System - Overview

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

Page 16: Operating System - Overview

Interrupts Continued

How interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires

Page 17: Operating System - Overview

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

Page 18: Operating System - Overview

Direct Memory Access (DMA)

• Figure 3-4. Operation of a DMA transfer.

Operation of a DMA transfer

Page 19: Operating System - Overview

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.

Page 20: Operating System - Overview

Structure of I/O System

ApplicationProgram

Device(hardware)

DeviceController(hardware)

DeviceDriver

Input-OutputControlSystem

SystemCalls I/O Bus

Operating System

Windows/Unix Operating System

I/O Control System NIC Driver Device

Controller(hardware)

Structure of I/O System

Practical Example

Page 21: Operating System - Overview

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.

Page 22: Operating System - Overview

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.

Page 23: Operating System - Overview

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

Page 24: Operating System - Overview

Device Drivers

• Logical position of device drivers is shown here• Communications between drivers and device controllers goes over

the bus

Page 25: Operating System - Overview

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.

Page 26: Operating System - Overview

Buffering - problem

• Problem from below diagram we can see time to transfer data from I/O device causes processor P to wait – very inefficient.

T1 P1 T3T2 P3P2

Concept

Timing

UserProcess

OperatingSystem

DiskDrive

Work Area

Unbuffered Transfer

Page 27: Operating System - Overview

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.

T1 P1

T3T2

P3P2

Concept

Timing

UserProcess

OperatingSystem

DiskDrive

Work Area

Unbuffered Transfer

M1 M3M2

Page 28: Operating System - Overview

I/O Buffering

Page 29: Operating System - Overview

I/O Buffering

Page 30: Operating System - Overview

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.

Page 31: Operating System - Overview

Windows I/O

• Windows uses a software module called the Input-Output Manager

Page 32: Operating System - Overview

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.

Page 33: Operating System - Overview

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.