SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
I/O
Beuth Hochschule

Summer Term 2014

!
Pictures (C) W. Stallings, if not stated otherwise

!
Additional source:

Daniel P. Bovet & Marco Cesati. Understanding the Linux Kernel. 3rd Edition. O‘Reilly

!
!
!
Operating Systems I PT/FF 14
Input / Output Devices
• Hardware devices engaged in I/O can be categorized into:

• Responsible for interaction with the user

• Printers, terminals, video display, keyboard, mouse

• Provisioning of system-local hardware functionality

• Disk drives, USB keys, sensors, controllers

• Provisioning of communication support

• Modems, WLAN stick, network card

• Devices differ according to multiple factors

• Data transfer rates, complexity of control, data encoding, error conditions, ...

• I/O devices either operate as block device (fixed-size data blocks) or 

character / stream device (stream of bytes)
2
Operating Systems I PT/FF 14
I/O Functionality
• I/O functionality in an operating system can take place as:

• Programmed I/O with polling

• Process issues I/O command indirectly through the operating system

• Busy waits for completion

• Interrupt-driven I/O

• Process issues I/O command indirectly through the operating system

• Operating system blocks the process until an interrupt signals I/O completion

• With non-blocking I/O, the process continues to work instead of being blocked

• In both cases, the processor must fetch I/O read results from the device

• Alternative: Direct Memory Access (DMA)
3
Operating Systems I PT/FF 14
I/O Hardware - Single Bus
4
(C) Russinovich et al.
Operating Systems I PT/FF 14
I/O Hardware - Multiple Busses
5
(C) Russinovich et al.
Operating Systems I PT/FF 14
Direct Memory Access (DMA)
• Special hardware unit realizes the
data transfer between device and
main memory
6
Operating Systems I PT/FF 14
Device Drivers
• Lowest level of software to interact with I/O hardware

• Contains all device-dependent code for one type of hardware unit

• Direct communication with the device hardware

• Writes control registers, accesses hardware-mapped memory regions

• Starting and completion of I/O operations

• Loaded drivers become part of the running operating system image

• User mode applications deal with logical I/O

• Processes are enabled to access data records in files

• Driver may block after issuing a request, un-blocked by device interrupt
7
Operating Systems I PT/FF 14
Flow of a Blocking I/O Request
1. Thread issues blocking read() system call

2. Kernel checks parameters, may already return buffered data and finish

3. Thread is suspended if physical I/O required, added to wait queue for device

4. I/O request is scheduled

5. Device driver allocates kernel buffer and sends command to the hardware controller

6. Device controller operates the hardware to perform data transfer

7. Driver may poll for status and data, or set up DMA that will generate interrupt

8. Interrupt occurs, handler implementation from the driver stores the data 

9. Kernel transfers data to user space and makes thread ready again

10. Thread resumes execution at completion of read() call
8
Operating Systems I PT/FF 14
Design Objectives
• Design objectives for the I/O mechanism in
operating systems

• Generality
• Handle all devices in a uniform manner, 

both for kernel and user mode

• Hierarchical approach for device
management to reflect bus topology

• Efficiency

• I/O operations nearly always are the main
bottleneck in application performance

• Most I/O devices are extremely slow
compared with main memory and processor

• Operating system must take care of disk I/O
coordination and performance
9
Operating Systems I PT/FF 14
Layers of the I/O System
• Device-independent software layer
combines common management tasks

• Uniform interfacing for device
interaction (e.g. read / write / create)

• Device naming

• Device protection

• Buffering

• Storage allocation on block devices

• Allocation and releasing

• Error reporting
10
User process
Device-independent
software layer
Device driver layer
Interrupt handlers
Hardware
Operating Systems I PT/FF 14
Buffering
• Typical optimization is buffering of I/O requests
• Perform input transfers in advance of requests being made

• Perform output transfers delayed, after the request is made
11
Operating Systems I PT/FF 14
Buffering
• No buffer - Operating system directly accesses the device

• Single buffer - Operating system assigns buffer in main memory for I/O request

• For block-oriented devices, read-ahead may manage to prepare blocks in
memory that are fetched later by the process

• For stream-oriented devices, read-ahead is based on the notion of text lines
(terminals) or bytes (terminals, video stream)

• Swapping logic of the operating system is affected

• Double buffer / buffer swapping - Process can transfer data from / to one buffer
while the operating system empties or fills the other buffer

• Circular buffer - Two or more buffers are used in a circular fashion

• Buffering smoothes out peaks in I/O demand, less advantage under heavy load
12
Operating Systems I PT/FF 14
Windows
• I/O system design goals

• Fast I/O processing on single / multiprocessor systems

• Protection for shareable resources using Windows security mechanisms

• Meet requirements dictated by different subsystems

• Provide common services for device drivers

• Ease device driver development, support for high-level languages

• Dynamic addition/removal of device drivers

• Support multiple file systems (FAT, CDFS, UDF, NTFS)

• Provide mapped file I/O capabilities

• Instrumentation support and diagnosability
13
Operating Systems I PT/FF 14
Windows
14
(C) Russinovich et al.
Operating Systems I PT/FF 14
Windows - I/O Architecture
• I/O Manager 

• Connects applications and components to virtual, logical, and physical devices

• Windows APIs: ReadFile, WriteFile, CreateFile, CloseFile, DeviceIoControl

• Defines the infrastructure that supports device drivers

• Manages buffers for I/O requests

• Provides time-out support for drivers

• Knows which installable file systems are loaded

• Provides flexible I/O services for environment subsystems

• Framework for delivery of I/O request packets (IRPs)
15
Operating Systems I PT/FF 14
Windows - I/O Architecture
• The hardware abstraction layer (HAL) insulates drivers from the specifics of
processor and interrupt controller

• Bus driver for all the devices on the computer's motherboard that aren't controlled
by other drivers

• By programming against the HAL, drivers are source-level compatible across
different CPU and mainboard architectures 

• PnP manager handles driver loading and starting 

• Performs resource arbitration

• Relies on the I/O Manager to manage drivers and send PnP-related commands

• Power manager controls the power states

• Relies on the I/O Manager to ask drivers if they can change power state
16
Operating Systems I PT/FF 14
Driver Layering
• Windows drivers can be stacked
to add functionality

• Only the lowest layer talks to the
hardware

• Filter drivers attach their devices
to other devices

• See‘s all requests first an can
manipulate them

• Examples: File replication, file
encryption, shadow copies,
licensing, virus scanner
17
Operating Systems I PT/FF 14
Windows - IRPs
• I/O manager creates an IRP for each I/O operation and passes it to correct drivers

• Deletes IRP when I/O operation is complete

• Device drivers

• Receive IRP routed to them by the I/O manager and performs the operation

• Inform the I/O manager when those commands complete by passing back the IRP

• Often use the I/O manager to forward IRPs to other device drivers

• Fast I/O
• Bypass generation of IRPs, go directly to file system driver or cache manager

• Scatter/Gather I/O
• Read/write multiple buffers with a single system call
18
Operating Systems I PT/FF 14
Windows - Interrupt Dispatching
19
(C) Russinovich et al.
Operating Systems I PT/FF 14
Windows - Interrupt Dispatching
• IRQL is the state of a processor in the system

• Servicing an interrupt raises the processor IRQL to that interrupt‘s IRQL

• This masks subsequent interrupts with an equal or lower IRQL

• User mode 

applications are 

limited to IRQL 0

• No wait operations 

or page faults for 

IRQL >= 2

• After ISR execution,

IRQL is lowered to

initial level
20
Passive/Low
APC
Dispatch/DPC
Device 1
.
.
.
Profile & Synch (Srv 2003)
Clock
Interprocessor Interrupt
Power fail
High
Normal thread execution
Hardware interrupts
Deferrable software interrupts
0
1
2
30
29
28
31
Operating Systems I PT/FF 14
Windows - IRQLs
• High - Used when halting the system (via KeBugCheck())

• Power fail - Originated in the NT design document, but has never been used

• Inter-processor interrupt - used to request action from other processor
(dispatching a thread, updating a processors TLB, system shutdown, system crash)
• Clock - Used to update system‘s clock, allocation of CPU time to threads

• Profile - Used for kernel profiling (see Kernel profiler – Kernprof.exe, Res Kit)

• Device - Used to prioritize device interrupts

• DPC/dispatch and APC - Software interrupts 

that kernel and device drivers generate

• Passive - No interrupt level at all, 0

normal thread execution
21
Passive/Low
APC
Dispatch/DPC
Device 1
.
.
.
Profile & Synch (Srv 2003)
Clock
Interprocessor Interrupt
Power fail
High
Normal thread execution
Hardware interrupts
Deferrable software interrupts
0
1
2
30
29
28
31

Más contenido relacionado

La actualidad más candente

Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O DevicesSlideshare
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System ImplementationWayne Jones Jnr
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
Operating system components
Operating system componentsOperating system components
Operating system componentsSyed Zaid Irshad
 
File access methods.54
File access methods.54File access methods.54
File access methods.54myrajendra
 
Process control block(PCB)
Process control block(PCB)Process control block(PCB)
Process control block(PCB)Sujata Yadav
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 
Process management os concept
Process management os conceptProcess management os concept
Process management os conceptpriyadeosarkar91
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memorysgpraju
 
Handheld operting system
Handheld operting systemHandheld operting system
Handheld operting systemAj Maurya
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411Geerthik Varun
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating systemArshad khan
 
Structure of operating system
Structure of operating systemStructure of operating system
Structure of operating systemRafi Dar
 

La actualidad más candente (20)

Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 
I/O Management
I/O ManagementI/O Management
I/O Management
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O Devices
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
operating system structure
operating system structureoperating system structure
operating system structure
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Operating system components
Operating system componentsOperating system components
Operating system components
 
File access methods.54
File access methods.54File access methods.54
File access methods.54
 
Process control block(PCB)
Process control block(PCB)Process control block(PCB)
Process control block(PCB)
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Process management os concept
Process management os conceptProcess management os concept
Process management os concept
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Storage Structure in OS
Storage Structure in OSStorage Structure in OS
Storage Structure in OS
 
Handheld operting system
Handheld operting systemHandheld operting system
Handheld operting system
 
IO Management
IO ManagementIO Management
IO Management
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating system
 
File system
File systemFile system
File system
 
Structure of operating system
Structure of operating systemStructure of operating system
Structure of operating system
 

Destacado

5. spooling and buffering
5. spooling and buffering 5. spooling and buffering
5. spooling and buffering myrajendra
 
Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)Page Maker
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating SystemsAkshay Kurup
 
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENT
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENTDEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENT
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENTJOLLUSUDARSHANREDDY
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory AccessTuqa Rmahi
 
Working of input and output devices
Working of input and output devicesWorking of input and output devices
Working of input and output devicesDevika Rangnekar
 
Direct memory access
Direct memory accessDirect memory access
Direct memory accessshubham kuwar
 
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systemsmyrajendra
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its typesNehal Naik
 

Destacado (20)

5. spooling and buffering
5. spooling and buffering 5. spooling and buffering
5. spooling and buffering
 
I/O Buffering
I/O BufferingI/O Buffering
I/O Buffering
 
I/O System
I/O SystemI/O System
I/O System
 
Input Output Control System
Input Output Control SystemInput Output Control System
Input Output Control System
 
Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating Systems
 
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENT
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENTDEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENT
DEVICE FILE AND INPUT OUTPUT SUBSYSTEMS MANAGEMENT
 
10. resource management
10. resource management10. resource management
10. resource management
 
Operating system
Operating systemOperating system
Operating system
 
DMA operation
DMA operationDMA operation
DMA operation
 
Input and Output Control
Input and Output ControlInput and Output Control
Input and Output Control
 
Io (2)
Io (2)Io (2)
Io (2)
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory Access
 
Working of input and output devices
Working of input and output devicesWorking of input and output devices
Working of input and output devices
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Device Management
Device ManagementDevice Management
Device Management
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systems
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its types
 

Similar a Operating Systems 1 (11/12) - Input / Output

Operating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsOperating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsPeter Tröger
 
ITFT_Device management in Operating System
ITFT_Device management in Operating SystemITFT_Device management in Operating System
ITFT_Device management in Operating SystemSneh Prabha
 
I/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxI/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxwebip34973
 
Operating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesOperating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesPeter Tröger
 
6.1_IO-Principles.ppt
6.1_IO-Principles.ppt6.1_IO-Principles.ppt
6.1_IO-Principles.pptdedanndege
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingmadhuributani
 
Input output concepts in operating systems
Input output concepts in operating systemsInput output concepts in operating systems
Input output concepts in operating systemsisitneededwhy
 
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI Learning
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI LearningAN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI Learning
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI LearningPHI Learning Pvt. Ltd.
 
Chapter-05-IO (2).ppt
Chapter-05-IO (2).pptChapter-05-IO (2).ppt
Chapter-05-IO (2).pptMyName1sJeff
 

Similar a Operating Systems 1 (11/12) - Input / Output (20)

Operating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware BasicsOperating Systems 1 (2/12) - Hardware Basics
Operating Systems 1 (2/12) - Hardware Basics
 
Ch12 io systems
Ch12   io systemsCh12   io systems
Ch12 io systems
 
ITFT_Device management in Operating System
ITFT_Device management in Operating SystemITFT_Device management in Operating System
ITFT_Device management in Operating System
 
I/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxI/o management and disk scheduling .pptx
I/o management and disk scheduling .pptx
 
Operating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesOperating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - Processes
 
5120224.ppt
5120224.ppt5120224.ppt
5120224.ppt
 
Os introduction
Os introductionOs introduction
Os introduction
 
Os introduction
Os introductionOs introduction
Os introduction
 
In out system
In out systemIn out system
In out system
 
I/O Organization
I/O OrganizationI/O Organization
I/O Organization
 
6.1_IO-Principles.ppt
6.1_IO-Principles.ppt6.1_IO-Principles.ppt
6.1_IO-Principles.ppt
 
1_to_10.pdf
1_to_10.pdf1_to_10.pdf
1_to_10.pdf
 
OS Introduction
OS IntroductionOS Introduction
OS Introduction
 
Lec 2
Lec 2Lec 2
Lec 2
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk scheduling
 
Input output concepts in operating systems
Input output concepts in operating systemsInput output concepts in operating systems
Input output concepts in operating systems
 
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
 
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI Learning
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI LearningAN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI Learning
AN INTRODUCTION TO OPERATING SYSTEMS : CONCEPTS AND PRACTICE - PHI Learning
 
Chapter01 (1).ppt
Chapter01 (1).pptChapter01 (1).ppt
Chapter01 (1).ppt
 
Chapter-05-IO (2).ppt
Chapter-05-IO (2).pptChapter-05-IO (2).ppt
Chapter-05-IO (2).ppt
 

Más de Peter Tröger

WannaCry - An OS course perspective
WannaCry - An OS course perspectiveWannaCry - An OS course perspective
WannaCry - An OS course perspectivePeter Tröger
 
Cloud Standards and Virtualization
Cloud Standards and VirtualizationCloud Standards and Virtualization
Cloud Standards and VirtualizationPeter Tröger
 
Distributed Resource Management Application API (DRMAA) Version 2
Distributed Resource Management Application API (DRMAA) Version 2Distributed Resource Management Application API (DRMAA) Version 2
Distributed Resource Management Application API (DRMAA) Version 2Peter Tröger
 
OpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissionsOpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissionsPeter Tröger
 
Design of Software for Embedded Systems
Design of Software for Embedded SystemsDesign of Software for Embedded Systems
Design of Software for Embedded SystemsPeter Tröger
 
Humans should not write XML.
Humans should not write XML.Humans should not write XML.
Humans should not write XML.Peter Tröger
 
What activates a bug? A refinement of the Laprie terminology model.
What activates a bug? A refinement of the Laprie terminology model.What activates a bug? A refinement of the Laprie terminology model.
What activates a bug? A refinement of the Laprie terminology model.Peter Tröger
 
Dependable Systems - Summary (16/16)
Dependable Systems - Summary (16/16)Dependable Systems - Summary (16/16)
Dependable Systems - Summary (16/16)Peter Tröger
 
Dependable Systems - Hardware Dependability with Redundancy (14/16)
Dependable Systems - Hardware Dependability with Redundancy (14/16)Dependable Systems - Hardware Dependability with Redundancy (14/16)
Dependable Systems - Hardware Dependability with Redundancy (14/16)Peter Tröger
 
Dependable Systems - System Dependability Evaluation (8/16)
Dependable Systems - System Dependability Evaluation (8/16)Dependable Systems - System Dependability Evaluation (8/16)
Dependable Systems - System Dependability Evaluation (8/16)Peter Tröger
 
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)Peter Tröger
 
Dependable Systems -Software Dependability (15/16)
Dependable Systems -Software Dependability (15/16)Dependable Systems -Software Dependability (15/16)
Dependable Systems -Software Dependability (15/16)Peter Tröger
 
Dependable Systems -Reliability Prediction (9/16)
Dependable Systems -Reliability Prediction (9/16)Dependable Systems -Reliability Prediction (9/16)
Dependable Systems -Reliability Prediction (9/16)Peter Tröger
 
Dependable Systems -Fault Tolerance Patterns (4/16)
Dependable Systems -Fault Tolerance Patterns (4/16)Dependable Systems -Fault Tolerance Patterns (4/16)
Dependable Systems -Fault Tolerance Patterns (4/16)Peter Tröger
 
Dependable Systems - Introduction (1/16)
Dependable Systems - Introduction (1/16)Dependable Systems - Introduction (1/16)
Dependable Systems - Introduction (1/16)Peter Tröger
 
Dependable Systems -Dependability Means (3/16)
Dependable Systems -Dependability Means (3/16)Dependable Systems -Dependability Means (3/16)
Dependable Systems -Dependability Means (3/16)Peter Tröger
 
Dependable Systems - Hardware Dependability with Diagnosis (13/16)
Dependable Systems - Hardware Dependability with Diagnosis (13/16)Dependable Systems - Hardware Dependability with Diagnosis (13/16)
Dependable Systems - Hardware Dependability with Diagnosis (13/16)Peter Tröger
 
Dependable Systems -Dependability Attributes (5/16)
Dependable Systems -Dependability Attributes (5/16)Dependable Systems -Dependability Attributes (5/16)
Dependable Systems -Dependability Attributes (5/16)Peter Tröger
 
Dependable Systems -Dependability Threats (2/16)
Dependable Systems -Dependability Threats (2/16)Dependable Systems -Dependability Threats (2/16)
Dependable Systems -Dependability Threats (2/16)Peter Tröger
 
Verteilte Software-Systeme im Kontext von Industrie 4.0
Verteilte Software-Systeme im Kontext von Industrie 4.0Verteilte Software-Systeme im Kontext von Industrie 4.0
Verteilte Software-Systeme im Kontext von Industrie 4.0Peter Tröger
 

Más de Peter Tröger (20)

WannaCry - An OS course perspective
WannaCry - An OS course perspectiveWannaCry - An OS course perspective
WannaCry - An OS course perspective
 
Cloud Standards and Virtualization
Cloud Standards and VirtualizationCloud Standards and Virtualization
Cloud Standards and Virtualization
 
Distributed Resource Management Application API (DRMAA) Version 2
Distributed Resource Management Application API (DRMAA) Version 2Distributed Resource Management Application API (DRMAA) Version 2
Distributed Resource Management Application API (DRMAA) Version 2
 
OpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissionsOpenSubmit - How to grade 1200 code submissions
OpenSubmit - How to grade 1200 code submissions
 
Design of Software for Embedded Systems
Design of Software for Embedded SystemsDesign of Software for Embedded Systems
Design of Software for Embedded Systems
 
Humans should not write XML.
Humans should not write XML.Humans should not write XML.
Humans should not write XML.
 
What activates a bug? A refinement of the Laprie terminology model.
What activates a bug? A refinement of the Laprie terminology model.What activates a bug? A refinement of the Laprie terminology model.
What activates a bug? A refinement of the Laprie terminology model.
 
Dependable Systems - Summary (16/16)
Dependable Systems - Summary (16/16)Dependable Systems - Summary (16/16)
Dependable Systems - Summary (16/16)
 
Dependable Systems - Hardware Dependability with Redundancy (14/16)
Dependable Systems - Hardware Dependability with Redundancy (14/16)Dependable Systems - Hardware Dependability with Redundancy (14/16)
Dependable Systems - Hardware Dependability with Redundancy (14/16)
 
Dependable Systems - System Dependability Evaluation (8/16)
Dependable Systems - System Dependability Evaluation (8/16)Dependable Systems - System Dependability Evaluation (8/16)
Dependable Systems - System Dependability Evaluation (8/16)
 
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)
Dependable Systems - Structure-Based Dependabiilty Modeling (6/16)
 
Dependable Systems -Software Dependability (15/16)
Dependable Systems -Software Dependability (15/16)Dependable Systems -Software Dependability (15/16)
Dependable Systems -Software Dependability (15/16)
 
Dependable Systems -Reliability Prediction (9/16)
Dependable Systems -Reliability Prediction (9/16)Dependable Systems -Reliability Prediction (9/16)
Dependable Systems -Reliability Prediction (9/16)
 
Dependable Systems -Fault Tolerance Patterns (4/16)
Dependable Systems -Fault Tolerance Patterns (4/16)Dependable Systems -Fault Tolerance Patterns (4/16)
Dependable Systems -Fault Tolerance Patterns (4/16)
 
Dependable Systems - Introduction (1/16)
Dependable Systems - Introduction (1/16)Dependable Systems - Introduction (1/16)
Dependable Systems - Introduction (1/16)
 
Dependable Systems -Dependability Means (3/16)
Dependable Systems -Dependability Means (3/16)Dependable Systems -Dependability Means (3/16)
Dependable Systems -Dependability Means (3/16)
 
Dependable Systems - Hardware Dependability with Diagnosis (13/16)
Dependable Systems - Hardware Dependability with Diagnosis (13/16)Dependable Systems - Hardware Dependability with Diagnosis (13/16)
Dependable Systems - Hardware Dependability with Diagnosis (13/16)
 
Dependable Systems -Dependability Attributes (5/16)
Dependable Systems -Dependability Attributes (5/16)Dependable Systems -Dependability Attributes (5/16)
Dependable Systems -Dependability Attributes (5/16)
 
Dependable Systems -Dependability Threats (2/16)
Dependable Systems -Dependability Threats (2/16)Dependable Systems -Dependability Threats (2/16)
Dependable Systems -Dependability Threats (2/16)
 
Verteilte Software-Systeme im Kontext von Industrie 4.0
Verteilte Software-Systeme im Kontext von Industrie 4.0Verteilte Software-Systeme im Kontext von Industrie 4.0
Verteilte Software-Systeme im Kontext von Industrie 4.0
 

Último

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Último (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Operating Systems 1 (11/12) - Input / Output

  • 1. I/O Beuth Hochschule Summer Term 2014 ! Pictures (C) W. Stallings, if not stated otherwise ! Additional source: Daniel P. Bovet & Marco Cesati. Understanding the Linux Kernel. 3rd Edition. O‘Reilly ! ! !
  • 2. Operating Systems I PT/FF 14 Input / Output Devices • Hardware devices engaged in I/O can be categorized into: • Responsible for interaction with the user • Printers, terminals, video display, keyboard, mouse • Provisioning of system-local hardware functionality • Disk drives, USB keys, sensors, controllers • Provisioning of communication support • Modems, WLAN stick, network card • Devices differ according to multiple factors • Data transfer rates, complexity of control, data encoding, error conditions, ... • I/O devices either operate as block device (fixed-size data blocks) or 
 character / stream device (stream of bytes) 2
  • 3. Operating Systems I PT/FF 14 I/O Functionality • I/O functionality in an operating system can take place as: • Programmed I/O with polling • Process issues I/O command indirectly through the operating system • Busy waits for completion • Interrupt-driven I/O • Process issues I/O command indirectly through the operating system • Operating system blocks the process until an interrupt signals I/O completion • With non-blocking I/O, the process continues to work instead of being blocked • In both cases, the processor must fetch I/O read results from the device • Alternative: Direct Memory Access (DMA) 3
  • 4. Operating Systems I PT/FF 14 I/O Hardware - Single Bus 4 (C) Russinovich et al.
  • 5. Operating Systems I PT/FF 14 I/O Hardware - Multiple Busses 5 (C) Russinovich et al.
  • 6. Operating Systems I PT/FF 14 Direct Memory Access (DMA) • Special hardware unit realizes the data transfer between device and main memory 6
  • 7. Operating Systems I PT/FF 14 Device Drivers • Lowest level of software to interact with I/O hardware • Contains all device-dependent code for one type of hardware unit • Direct communication with the device hardware • Writes control registers, accesses hardware-mapped memory regions • Starting and completion of I/O operations • Loaded drivers become part of the running operating system image • User mode applications deal with logical I/O • Processes are enabled to access data records in files • Driver may block after issuing a request, un-blocked by device interrupt 7
  • 8. Operating Systems I PT/FF 14 Flow of a Blocking I/O Request 1. Thread issues blocking read() system call 2. Kernel checks parameters, may already return buffered data and finish 3. Thread is suspended if physical I/O required, added to wait queue for device 4. I/O request is scheduled 5. Device driver allocates kernel buffer and sends command to the hardware controller 6. Device controller operates the hardware to perform data transfer 7. Driver may poll for status and data, or set up DMA that will generate interrupt 8. Interrupt occurs, handler implementation from the driver stores the data 9. Kernel transfers data to user space and makes thread ready again 10. Thread resumes execution at completion of read() call 8
  • 9. Operating Systems I PT/FF 14 Design Objectives • Design objectives for the I/O mechanism in operating systems • Generality • Handle all devices in a uniform manner, 
 both for kernel and user mode • Hierarchical approach for device management to reflect bus topology • Efficiency • I/O operations nearly always are the main bottleneck in application performance • Most I/O devices are extremely slow compared with main memory and processor • Operating system must take care of disk I/O coordination and performance 9
  • 10. Operating Systems I PT/FF 14 Layers of the I/O System • Device-independent software layer combines common management tasks • Uniform interfacing for device interaction (e.g. read / write / create) • Device naming • Device protection • Buffering • Storage allocation on block devices • Allocation and releasing • Error reporting 10 User process Device-independent software layer Device driver layer Interrupt handlers Hardware
  • 11. Operating Systems I PT/FF 14 Buffering • Typical optimization is buffering of I/O requests • Perform input transfers in advance of requests being made • Perform output transfers delayed, after the request is made 11
  • 12. Operating Systems I PT/FF 14 Buffering • No buffer - Operating system directly accesses the device • Single buffer - Operating system assigns buffer in main memory for I/O request • For block-oriented devices, read-ahead may manage to prepare blocks in memory that are fetched later by the process • For stream-oriented devices, read-ahead is based on the notion of text lines (terminals) or bytes (terminals, video stream) • Swapping logic of the operating system is affected • Double buffer / buffer swapping - Process can transfer data from / to one buffer while the operating system empties or fills the other buffer • Circular buffer - Two or more buffers are used in a circular fashion • Buffering smoothes out peaks in I/O demand, less advantage under heavy load 12
  • 13. Operating Systems I PT/FF 14 Windows • I/O system design goals • Fast I/O processing on single / multiprocessor systems • Protection for shareable resources using Windows security mechanisms • Meet requirements dictated by different subsystems • Provide common services for device drivers • Ease device driver development, support for high-level languages • Dynamic addition/removal of device drivers • Support multiple file systems (FAT, CDFS, UDF, NTFS) • Provide mapped file I/O capabilities • Instrumentation support and diagnosability 13
  • 14. Operating Systems I PT/FF 14 Windows 14 (C) Russinovich et al.
  • 15. Operating Systems I PT/FF 14 Windows - I/O Architecture • I/O Manager • Connects applications and components to virtual, logical, and physical devices • Windows APIs: ReadFile, WriteFile, CreateFile, CloseFile, DeviceIoControl • Defines the infrastructure that supports device drivers • Manages buffers for I/O requests • Provides time-out support for drivers • Knows which installable file systems are loaded • Provides flexible I/O services for environment subsystems • Framework for delivery of I/O request packets (IRPs) 15
  • 16. Operating Systems I PT/FF 14 Windows - I/O Architecture • The hardware abstraction layer (HAL) insulates drivers from the specifics of processor and interrupt controller • Bus driver for all the devices on the computer's motherboard that aren't controlled by other drivers • By programming against the HAL, drivers are source-level compatible across different CPU and mainboard architectures • PnP manager handles driver loading and starting • Performs resource arbitration • Relies on the I/O Manager to manage drivers and send PnP-related commands • Power manager controls the power states • Relies on the I/O Manager to ask drivers if they can change power state 16
  • 17. Operating Systems I PT/FF 14 Driver Layering • Windows drivers can be stacked to add functionality • Only the lowest layer talks to the hardware • Filter drivers attach their devices to other devices • See‘s all requests first an can manipulate them • Examples: File replication, file encryption, shadow copies, licensing, virus scanner 17
  • 18. Operating Systems I PT/FF 14 Windows - IRPs • I/O manager creates an IRP for each I/O operation and passes it to correct drivers • Deletes IRP when I/O operation is complete • Device drivers • Receive IRP routed to them by the I/O manager and performs the operation • Inform the I/O manager when those commands complete by passing back the IRP • Often use the I/O manager to forward IRPs to other device drivers • Fast I/O • Bypass generation of IRPs, go directly to file system driver or cache manager • Scatter/Gather I/O • Read/write multiple buffers with a single system call 18
  • 19. Operating Systems I PT/FF 14 Windows - Interrupt Dispatching 19 (C) Russinovich et al.
  • 20. Operating Systems I PT/FF 14 Windows - Interrupt Dispatching • IRQL is the state of a processor in the system • Servicing an interrupt raises the processor IRQL to that interrupt‘s IRQL • This masks subsequent interrupts with an equal or lower IRQL • User mode 
 applications are 
 limited to IRQL 0 • No wait operations 
 or page faults for 
 IRQL >= 2 • After ISR execution,
 IRQL is lowered to
 initial level 20 Passive/Low APC Dispatch/DPC Device 1 . . . Profile & Synch (Srv 2003) Clock Interprocessor Interrupt Power fail High Normal thread execution Hardware interrupts Deferrable software interrupts 0 1 2 30 29 28 31
  • 21. Operating Systems I PT/FF 14 Windows - IRQLs • High - Used when halting the system (via KeBugCheck()) • Power fail - Originated in the NT design document, but has never been used • Inter-processor interrupt - used to request action from other processor (dispatching a thread, updating a processors TLB, system shutdown, system crash) • Clock - Used to update system‘s clock, allocation of CPU time to threads • Profile - Used for kernel profiling (see Kernel profiler – Kernprof.exe, Res Kit) • Device - Used to prioritize device interrupts • DPC/dispatch and APC - Software interrupts 
 that kernel and device drivers generate • Passive - No interrupt level at all, 0
 normal thread execution 21 Passive/Low APC Dispatch/DPC Device 1 . . . Profile & Synch (Srv 2003) Clock Interprocessor Interrupt Power fail High Normal thread execution Hardware interrupts Deferrable software interrupts 0 1 2 30 29 28 31