SlideShare a Scribd company logo
1 of 48
I/o Systems
1
Members
Danyal Yousaf 20011519-012
Hassaan Ali 20011519-015
Yasir Mukhtar 20011519-020
I/o Systems
2
Overview
Application I/O
interface
Kernel I/O
Subsystem
Streams Performance
OVERVIEW
• The control of devices connected to the computer is
the major concern of operating system designer,
because I/O devices vary so widely in their functions
and speed.
• Varies methods are needed to control them.
3
TOPICS
4
Peripheral devices I/O Management
Block & Character
device
DMA Polling & Interrupt Network devices
Danyal Yousaf 20011519-012
Peripheral Devices
What Does Peripheral Device Mean?
• A Peripheral Device is an internal or external device that connects
directly to a computer or other digital device but does not contribute to
the computer's primary function, such as computing. It helps end users
access and use the functionalities of a computer.
• Since it’s not a core device for the system, the computer can still function
without the peripheral, which simply provides extra functions. However,
some peripherals such as a mouse, keyboard, or monitor tend to be
pretty much fundamental to the interaction between the user and the
computer itself.
5
Peripheral Devices
• A Peripheral Device is also called a computer
peripheral, input-output device, or I/O device.
• Peripheral Devices are connected with CPU by busses,
processor is not connected to these devices directly
rather it is connected by interface.
6
Peripheral Devices
• Why we use interface between peripheral devices and
processor ?
• Because CPU can execute millions of instruction per second, but
peripheral devices are slow e.g keyboard.
• If we connect them directly these devices cannot cope with the CPU
speed either CPU has to wait, or these devices cannot process the
data.
• So that's why interfaces are used to synchronous them properly.
• Interfaces contain multiple registers they pick data serially and send
to CPU in a parallel way by faster speed.
7
Peripheral Devices
• Different nature of devices (signals) and the role of
interface ?
• CPU (electrical device) KEYBOARD (electromechanical device)
magnetic disk (electro - magnetic).
• We use interface between them for signal conversion because
signals produced by these devices are of different nature.
• Also we use interface between them to equalize their format size.
8
Peripheral Devices
• All Peripheral Devices are of
different nature . if we want
to take data from them then
we have to built logic for
them separately.
• So, in order to avoid these
issues we use interface
between them.
9
Processor
Interface Interface Interface
Keyboard
and display
terminal
Printer
Magnetic
disk
Data
Address
Control
Block & Character Devices
• Block devices is one with which driver communicate by
sending blocks of data. for example, hard disk, usd camera
etc.
• Character devices: a character devices is one with which
the driver communicates by sending and receiving single
characters.
• For example: serial ports, sound cards etc.
10
I/O MANAGEMENT
• Synchronous I/O: in this scheme CPU execution waits while I/o
proceeds.
• Asynchronous I/O: in this scheme I/o proceeds concurrently with
CPU execution.
• The CPU must have a way to pass information to and from an I/O
devices. There is a way to communicate with CPU and I/O
devices.
1. Direct Memory Access
11
Direct Memory Access
• Direct Memory Access: DMA takes care
of entire data transfer. What is DMA?
• It is simply the transfer of data from one
resource to another resources without
involving CPU( You will ask why without
CPU because CPU does the entire job)
it is just to speed up the memory
operations.
12
CPU
Memory
Data
I/O Device
Data
I/O Commands
Direct Memory Access
13
CPU DMAC MEMORY
DISK CONTROLLER
Address
COUNT
Control Signals
BUS
4 BLOCKS
Direct Memory Access
• A DMA controller transfers 16-bit words to memory using cycle
stealing. The words are assembled from a device that transmit
characters at a rate of 2400 characters/sec. The CPU fetching
instructions at an average rate of 1million instructions)sec.
• By how much will the CPU be slowed down because of DMA
transfer?( Each character is of 8 bits).
Options
1. 12%
2. 0.12%
3. 24 %
4. 0.24 %
14
Polling & Interrupt I/O
• A computer must have a way of detecting the arrival of any type of
input. there are two ways that this can happen, known as polling and
interrupts.
• Polling I/O: Polling is the simplest way for an I/O device to communicate
with the processor. the process of periodically checking status of the
device to see if it is time for the next I/o operation, is called polling.
• Interrupt I/O: it is an alternative scheme for dealing with I/O called
interrupt driven method.
• An interrupt is the signal to the microprocessor from a device that
require attention.
15
Network Devices
• Computer networking devices, are electronic devices which are
required for communication and interaction between devices on a
computer network.
e.g hub , repeater, bridge etc.
• When referring to a network, a hub is the most basic networking
device that connects multiple computers or other network devices.
it operate on physical layer of OSI-model.
• The three types are active, passive and intelligent hub.
16
Network Devices
• Repeater as a networking device: A repeater is an
electronic device that amplifies the signal it receives.
• You can think of repeater as a device which receives a
signal and retransmits it at a higher level or higher power
so that the signal can cover longer distances.
• A bridge is a type of computer network device that
provides interconnection with other bridge networks that
use the same protocol. Bridge devices work at the data
link layer of the Open System Interconnect (OSI) model,
connecting two different networks together and providing
communication between them.
17
TOPICS
18
Clocks & Timers Buffering Caching
Spooling
Nonblocking &
Asynchronous
Error handling
Hassaan Ali 20011519-015
Clocks & Timers
Most computers clocks and timers that
provide three basic Functions:
• Give the current time.
• Give the elapsed time. (up time)
• Set a timer to trigger operation X at
time T.
19
Clocks & Timers
• Types of clocks
20
Hardware clock System clock
Kernel
Clock
RTC
Clocks & Timers
Hardware clock
• A real time clock (RTC) is a battery powered
clock that is integrated on a computer
motherboard as an IC.
• Lithium battery is used for back up power.
• It tracks the time even while the system is
turned off or is in a low power state.
• RTC is indirectly responsible for interrupts,
timer, task scheduling and synchronization
etc.
21
Clocks & Timers
System clock
• System Clock is Implemented or maintained in the
operating system and is used to set the tasks and
processes.
• System clock tracks the time after the system is
turned on.
• Used for:
• Synchronization and scheduling.
• Settings and managing interrupts.
• Setting timer. For Example Alarm.
22
Working
23
Example
24
Hardware
clock
System clock
Hardware
clock
System clock
When On
When Off
Analog Signals to Digital
Digital Signals to Analog
Buffering
• Buffering is the process of preloading data into a buffer.
• What is a buffer? Where is it located?
• hardware devices or program processes that operate at
different speeds or with different sets of priorities. The
buffer allows each device or process to operate without
being held up by the other.
• It helps in Matching Speed between two devices,
between which the data is transmitted.
• It helps the devices with different data transfer size to
get adapted to each other.
25
Buffering Example
• Example of a YouTube video:
• When you are watching a YouTube video the
video has to preload some data before you can
watch it in real time.
• The data is stored in the buffer temporarily.
• CPU has to wait till the specified amount of data
is stored in the buffer.
• Then CPU executes the data in the buffer.
26
Buffer
Data
CPU
Buffering
• Types of Buffer:
• Single Buffer
• Double Buffer
27
Buffer 1
Buffer 2
Consumer
I/O DEVICE
Operating System
MOVE
User Process
Buffer 1 Consumer
I/O DEVICE
Operating System
MOVE
User Process
Buffering
• Types of Buffer:
• Single Buffer
• Double Buffer
• The usage of multiple buffers
increases the overall throughput
of a device and helps prevents
bottlenecks.
• A major disadvantage of double
buffering is that the complexity
of the process gets increased.
28
Data Flow
Caching
• What is Cache? Where is it located ?
• A cache is a high-speed memory that
temporarily saves data.
• Caching is a process of storing copies
of files in the cache memory.
• Caching is used to increase the
accessibility speed of the frequently
used programs on your system.
• Example of google chrome or loading
any application.
29
CPU
Main
Memory
Cache
Memory
Caching Example
• Whenever the CPU needs to access memory,
it first checks the cache memory. If the data
is not found in cache memory, then the CPU
moves into the main memory.
Advantage:
• Performance in increased by a lot.
• Results in better User Experience.
30
Index Data
0 Xyz
1 pdq
2 abc
3 rgf
Index Data
0 abc
1 xyz
Main Memory Cache Memory
CPU
Spooling
• Spooling is a process in which data is
temporarily held to be used and executed by a
device, program or the system.
• I/P and O/P devices are very slow as
compared to the CPU.
• Batch Operation.
• CPU is not set free in batch operation, it has to
wait for the I/O operation to be completed.
• To fix this we can use a Spool Buffer.
• This makes CPU utilization better.
• Multiple I/O devices can be used.
31
(Simultaneous Peripheral operations online)
Input Devices Output Devices
CPU
System
Main
Memory
Disk
Secondary
Memory
Spooling Example
32
• The biggest example of Spooling is printing. The documents
which are to be printed are stored in the SPOOL and then
added to the queue for printing.
• Many processes can perform their operations while the printer
executes the printing process on the documents one-by-one.
• Many features can also be added like setting priorities or
notification when the printing process has been completed or
selecting the different types of paper to print on according to
the user's choice.
Nonblocking & Asynchronous
33
• It refers to the program that does not block the execution of
further operations. Non-Blocking methods are executed
asynchronously.
• Asynchronously means that the program may not necessarily
execute line by line. The program calls the function and move
to the next operation and does not wait for it to return.
• Async is multi-thread, which means operations or programs
can run in parallel. Sync is single-thread, so only one
operation or program will run at a time.
Error Handling
• Error handling is defined as the ability of a software application
to help user to solve those problems that may occur while
using the application.
• Unexpected events
• Software tries to help the user giving error Messages.
• System error logs hold problem reports.
• The routines in a program that respond to abnormal input or
conditions.
• The quality of such routines is based on the clarity of the error
messages and the options given to users for resolving the
problem.
34
Error Handling
Types of errors that can occur:
• Syntax errors.
• Logic errors.
• The program can run but does not do what it is expected to
do.
• Usually called bugs.
• Runtime errors.
• Usually crashes the program.
35
TOPICS
36
I/O Protection
Kernel Data
Structures
Power
Management
Streams Performance
Yasir Mukhtar 20011519-020
I/O Protection
• User process may accidentally or
purposefully attempt to disrupt
normal operation via illegal I/O
instructions
• All I/O instructions defined to be
privileged
• I/O must be performed via system calls
• Memory-mapped and I/O port memory
locations must be protected too
37
38
Use of a System Call to Perform I/O
Kernel Data Structures
• Kernel keep state info for I/O components using
open file tables and also track network
connections, character-device communications,
and other I/O activities.
• Some use object-oriented methods and message
passing to implement I/O.
• Windows uses message passing
• Message with I/O information passed from user
mode into kernel
• Message modified as it flows through to device
driver and back to process
39
Power Management
• Not strictly domain of I/O, but much is I/O related
• Computers and devices use electricity, generate heat,
frequently require cooling.
• OSes can help manage and improve use
• Cloud computing environments move virtual machines
between servers.
• Can end up evacuating whole systems and shutting them
down.
• Mobile computing has power management as first
class OS aspect.
40
Power Management
• For example, Android implements
• Component-level power management
• Understands relationship between components
• Build device tree representing physical device topology
• System bus -> I/O subsystem -> {flash, USB storage}
• Device driver tracks state of device, whether in use
• Unused component – turn it off
• All devices in tree branch unused – turn off branch
41
Power Management
• For example, Android implements
• Wake locks – like other locks but prevent sleep of device when lock is held.
• Power collapse – put a device into very deep sleep
• Marginal power use
• Only awake enough to respond to external stimuli (button press,
incoming call)
• Modern systems use advanced configuration and power interface (ACPI) who
provides an open standard that operating systems can use to discover and
configure computer hardware components, to perform power management,
auto configuration and status monitoring.
42
43
Life Cycle of An I/O Request
• STREAM – a full-duplex communication channel between a
user-level process and a device in Unix System V and beyond
• A STREAM consists of:
• STREAM head interfaces with the user process
• Driver end interfaces with the device
• Zero or more STREAM modules between them
• Each module contains a read queue and a write queue
• Message passing is used to communicate between queues
• Flow control option to indicate available or busy
• Asynchronous internally, synchronous where user process
communicates with stream head
44
STREAMS
45
The STREAMS Structure
User
Process
Stream head
Read queue Write Queue
Read queue Write Queue
Read queue Write Queue
Read queue Write Queue
Driver end
Device
STREAMS
Modules
• I/O a major factor in system
Performance:
• Demands CPU to execute device driver,
kernel I/O code
• Context switches due to interrupts
• Network traffic especially stressful
46
Performance
• Use DMAC.
• Reduce number of context switches.
• Reduce interrupts by using large transfers, smart
controllers, polling.
• Use smarter hardware devices.
• Balance CPU, memory, bus, and I/O performance
for highest throughput.
• Move user-mode processes / daemons to kernel
threads.
47
Improving Performance
48
Thank You

More Related Content

Similar to I/O systems chapter 12 OS

Computer Architecture and Organization.pptx
Computer Architecture and Organization.pptxComputer Architecture and Organization.pptx
Computer Architecture and Organization.pptxLearnersCoach
 
Unit v: Device Management
Unit v: Device ManagementUnit v: Device Management
Unit v: Device ManagementArnav Chowdhury
 
Introduction to Operating Systems.pdf
Introduction to Operating Systems.pdfIntroduction to Operating Systems.pdf
Introduction to Operating Systems.pdfHarika Pudugosula
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its typesNehal Naik
 
What is operating system
What is operating systemWhat is operating system
What is operating systemSuvithak
 
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.
 
Computer Architecture & Organization.ppt
Computer Architecture & Organization.pptComputer Architecture & Organization.ppt
Computer Architecture & Organization.pptFarhanaMariyam1
 
Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptxAshokRachapalli1
 
Computer architecture pptx
Computer architecture pptxComputer architecture pptx
Computer architecture pptxMDSHABBIR12
 
diploma basic of computers.ppt
diploma basic of computers.pptdiploma basic of computers.ppt
diploma basic of computers.pptLathaSrinivas5
 
Report in SAD
Report in SADReport in SAD
Report in SADjesseledm
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 

Similar to I/O systems chapter 12 OS (20)

I/O Organization
I/O OrganizationI/O Organization
I/O Organization
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Computer Architecture and Organization.pptx
Computer Architecture and Organization.pptxComputer Architecture and Organization.pptx
Computer Architecture and Organization.pptx
 
ch1.pptx
ch1.pptxch1.pptx
ch1.pptx
 
03 - Inside Comupters.pptx
03 - Inside Comupters.pptx03 - Inside Comupters.pptx
03 - Inside Comupters.pptx
 
Unit v: Device Management
Unit v: Device ManagementUnit v: Device Management
Unit v: Device Management
 
Introduction to Operating Systems.pdf
Introduction to Operating Systems.pdfIntroduction to Operating Systems.pdf
Introduction to Operating Systems.pdf
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its types
 
Lecture 02 hardwares
Lecture 02 hardwaresLecture 02 hardwares
Lecture 02 hardwares
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
Chapter01 (1).ppt
Chapter01 (1).pptChapter01 (1).ppt
Chapter01 (1).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
 
1_to_10.pdf
1_to_10.pdf1_to_10.pdf
1_to_10.pdf
 
Computer Architecture & Organization.ppt
Computer Architecture & Organization.pptComputer Architecture & Organization.ppt
Computer Architecture & Organization.ppt
 
OS Content.pdf
OS Content.pdfOS Content.pdf
OS Content.pdf
 
Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptx
 
Computer architecture pptx
Computer architecture pptxComputer architecture pptx
Computer architecture pptx
 
diploma basic of computers.ppt
diploma basic of computers.pptdiploma basic of computers.ppt
diploma basic of computers.ppt
 
Report in SAD
Report in SADReport in SAD
Report in SAD
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 

Recently uploaded

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
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
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
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
 

Recently uploaded (20)

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
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
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.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
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

I/O systems chapter 12 OS

  • 1. I/o Systems 1 Members Danyal Yousaf 20011519-012 Hassaan Ali 20011519-015 Yasir Mukhtar 20011519-020
  • 3. OVERVIEW • The control of devices connected to the computer is the major concern of operating system designer, because I/O devices vary so widely in their functions and speed. • Varies methods are needed to control them. 3
  • 4. TOPICS 4 Peripheral devices I/O Management Block & Character device DMA Polling & Interrupt Network devices Danyal Yousaf 20011519-012
  • 5. Peripheral Devices What Does Peripheral Device Mean? • A Peripheral Device is an internal or external device that connects directly to a computer or other digital device but does not contribute to the computer's primary function, such as computing. It helps end users access and use the functionalities of a computer. • Since it’s not a core device for the system, the computer can still function without the peripheral, which simply provides extra functions. However, some peripherals such as a mouse, keyboard, or monitor tend to be pretty much fundamental to the interaction between the user and the computer itself. 5
  • 6. Peripheral Devices • A Peripheral Device is also called a computer peripheral, input-output device, or I/O device. • Peripheral Devices are connected with CPU by busses, processor is not connected to these devices directly rather it is connected by interface. 6
  • 7. Peripheral Devices • Why we use interface between peripheral devices and processor ? • Because CPU can execute millions of instruction per second, but peripheral devices are slow e.g keyboard. • If we connect them directly these devices cannot cope with the CPU speed either CPU has to wait, or these devices cannot process the data. • So that's why interfaces are used to synchronous them properly. • Interfaces contain multiple registers they pick data serially and send to CPU in a parallel way by faster speed. 7
  • 8. Peripheral Devices • Different nature of devices (signals) and the role of interface ? • CPU (electrical device) KEYBOARD (electromechanical device) magnetic disk (electro - magnetic). • We use interface between them for signal conversion because signals produced by these devices are of different nature. • Also we use interface between them to equalize their format size. 8
  • 9. Peripheral Devices • All Peripheral Devices are of different nature . if we want to take data from them then we have to built logic for them separately. • So, in order to avoid these issues we use interface between them. 9 Processor Interface Interface Interface Keyboard and display terminal Printer Magnetic disk Data Address Control
  • 10. Block & Character Devices • Block devices is one with which driver communicate by sending blocks of data. for example, hard disk, usd camera etc. • Character devices: a character devices is one with which the driver communicates by sending and receiving single characters. • For example: serial ports, sound cards etc. 10
  • 11. I/O MANAGEMENT • Synchronous I/O: in this scheme CPU execution waits while I/o proceeds. • Asynchronous I/O: in this scheme I/o proceeds concurrently with CPU execution. • The CPU must have a way to pass information to and from an I/O devices. There is a way to communicate with CPU and I/O devices. 1. Direct Memory Access 11
  • 12. Direct Memory Access • Direct Memory Access: DMA takes care of entire data transfer. What is DMA? • It is simply the transfer of data from one resource to another resources without involving CPU( You will ask why without CPU because CPU does the entire job) it is just to speed up the memory operations. 12 CPU Memory Data I/O Device Data I/O Commands
  • 13. Direct Memory Access 13 CPU DMAC MEMORY DISK CONTROLLER Address COUNT Control Signals BUS 4 BLOCKS
  • 14. Direct Memory Access • A DMA controller transfers 16-bit words to memory using cycle stealing. The words are assembled from a device that transmit characters at a rate of 2400 characters/sec. The CPU fetching instructions at an average rate of 1million instructions)sec. • By how much will the CPU be slowed down because of DMA transfer?( Each character is of 8 bits). Options 1. 12% 2. 0.12% 3. 24 % 4. 0.24 % 14
  • 15. Polling & Interrupt I/O • A computer must have a way of detecting the arrival of any type of input. there are two ways that this can happen, known as polling and interrupts. • Polling I/O: Polling is the simplest way for an I/O device to communicate with the processor. the process of periodically checking status of the device to see if it is time for the next I/o operation, is called polling. • Interrupt I/O: it is an alternative scheme for dealing with I/O called interrupt driven method. • An interrupt is the signal to the microprocessor from a device that require attention. 15
  • 16. Network Devices • Computer networking devices, are electronic devices which are required for communication and interaction between devices on a computer network. e.g hub , repeater, bridge etc. • When referring to a network, a hub is the most basic networking device that connects multiple computers or other network devices. it operate on physical layer of OSI-model. • The three types are active, passive and intelligent hub. 16
  • 17. Network Devices • Repeater as a networking device: A repeater is an electronic device that amplifies the signal it receives. • You can think of repeater as a device which receives a signal and retransmits it at a higher level or higher power so that the signal can cover longer distances. • A bridge is a type of computer network device that provides interconnection with other bridge networks that use the same protocol. Bridge devices work at the data link layer of the Open System Interconnect (OSI) model, connecting two different networks together and providing communication between them. 17
  • 18. TOPICS 18 Clocks & Timers Buffering Caching Spooling Nonblocking & Asynchronous Error handling Hassaan Ali 20011519-015
  • 19. Clocks & Timers Most computers clocks and timers that provide three basic Functions: • Give the current time. • Give the elapsed time. (up time) • Set a timer to trigger operation X at time T. 19
  • 20. Clocks & Timers • Types of clocks 20 Hardware clock System clock Kernel Clock RTC
  • 21. Clocks & Timers Hardware clock • A real time clock (RTC) is a battery powered clock that is integrated on a computer motherboard as an IC. • Lithium battery is used for back up power. • It tracks the time even while the system is turned off or is in a low power state. • RTC is indirectly responsible for interrupts, timer, task scheduling and synchronization etc. 21
  • 22. Clocks & Timers System clock • System Clock is Implemented or maintained in the operating system and is used to set the tasks and processes. • System clock tracks the time after the system is turned on. • Used for: • Synchronization and scheduling. • Settings and managing interrupts. • Setting timer. For Example Alarm. 22
  • 24. Example 24 Hardware clock System clock Hardware clock System clock When On When Off Analog Signals to Digital Digital Signals to Analog
  • 25. Buffering • Buffering is the process of preloading data into a buffer. • What is a buffer? Where is it located? • hardware devices or program processes that operate at different speeds or with different sets of priorities. The buffer allows each device or process to operate without being held up by the other. • It helps in Matching Speed between two devices, between which the data is transmitted. • It helps the devices with different data transfer size to get adapted to each other. 25
  • 26. Buffering Example • Example of a YouTube video: • When you are watching a YouTube video the video has to preload some data before you can watch it in real time. • The data is stored in the buffer temporarily. • CPU has to wait till the specified amount of data is stored in the buffer. • Then CPU executes the data in the buffer. 26 Buffer Data CPU
  • 27. Buffering • Types of Buffer: • Single Buffer • Double Buffer 27 Buffer 1 Buffer 2 Consumer I/O DEVICE Operating System MOVE User Process Buffer 1 Consumer I/O DEVICE Operating System MOVE User Process
  • 28. Buffering • Types of Buffer: • Single Buffer • Double Buffer • The usage of multiple buffers increases the overall throughput of a device and helps prevents bottlenecks. • A major disadvantage of double buffering is that the complexity of the process gets increased. 28 Data Flow
  • 29. Caching • What is Cache? Where is it located ? • A cache is a high-speed memory that temporarily saves data. • Caching is a process of storing copies of files in the cache memory. • Caching is used to increase the accessibility speed of the frequently used programs on your system. • Example of google chrome or loading any application. 29 CPU Main Memory Cache Memory
  • 30. Caching Example • Whenever the CPU needs to access memory, it first checks the cache memory. If the data is not found in cache memory, then the CPU moves into the main memory. Advantage: • Performance in increased by a lot. • Results in better User Experience. 30 Index Data 0 Xyz 1 pdq 2 abc 3 rgf Index Data 0 abc 1 xyz Main Memory Cache Memory CPU
  • 31. Spooling • Spooling is a process in which data is temporarily held to be used and executed by a device, program or the system. • I/P and O/P devices are very slow as compared to the CPU. • Batch Operation. • CPU is not set free in batch operation, it has to wait for the I/O operation to be completed. • To fix this we can use a Spool Buffer. • This makes CPU utilization better. • Multiple I/O devices can be used. 31 (Simultaneous Peripheral operations online) Input Devices Output Devices CPU System Main Memory Disk Secondary Memory
  • 32. Spooling Example 32 • The biggest example of Spooling is printing. The documents which are to be printed are stored in the SPOOL and then added to the queue for printing. • Many processes can perform their operations while the printer executes the printing process on the documents one-by-one. • Many features can also be added like setting priorities or notification when the printing process has been completed or selecting the different types of paper to print on according to the user's choice.
  • 33. Nonblocking & Asynchronous 33 • It refers to the program that does not block the execution of further operations. Non-Blocking methods are executed asynchronously. • Asynchronously means that the program may not necessarily execute line by line. The program calls the function and move to the next operation and does not wait for it to return. • Async is multi-thread, which means operations or programs can run in parallel. Sync is single-thread, so only one operation or program will run at a time.
  • 34. Error Handling • Error handling is defined as the ability of a software application to help user to solve those problems that may occur while using the application. • Unexpected events • Software tries to help the user giving error Messages. • System error logs hold problem reports. • The routines in a program that respond to abnormal input or conditions. • The quality of such routines is based on the clarity of the error messages and the options given to users for resolving the problem. 34
  • 35. Error Handling Types of errors that can occur: • Syntax errors. • Logic errors. • The program can run but does not do what it is expected to do. • Usually called bugs. • Runtime errors. • Usually crashes the program. 35
  • 37. I/O Protection • User process may accidentally or purposefully attempt to disrupt normal operation via illegal I/O instructions • All I/O instructions defined to be privileged • I/O must be performed via system calls • Memory-mapped and I/O port memory locations must be protected too 37
  • 38. 38 Use of a System Call to Perform I/O
  • 39. Kernel Data Structures • Kernel keep state info for I/O components using open file tables and also track network connections, character-device communications, and other I/O activities. • Some use object-oriented methods and message passing to implement I/O. • Windows uses message passing • Message with I/O information passed from user mode into kernel • Message modified as it flows through to device driver and back to process 39
  • 40. Power Management • Not strictly domain of I/O, but much is I/O related • Computers and devices use electricity, generate heat, frequently require cooling. • OSes can help manage and improve use • Cloud computing environments move virtual machines between servers. • Can end up evacuating whole systems and shutting them down. • Mobile computing has power management as first class OS aspect. 40
  • 41. Power Management • For example, Android implements • Component-level power management • Understands relationship between components • Build device tree representing physical device topology • System bus -> I/O subsystem -> {flash, USB storage} • Device driver tracks state of device, whether in use • Unused component – turn it off • All devices in tree branch unused – turn off branch 41
  • 42. Power Management • For example, Android implements • Wake locks – like other locks but prevent sleep of device when lock is held. • Power collapse – put a device into very deep sleep • Marginal power use • Only awake enough to respond to external stimuli (button press, incoming call) • Modern systems use advanced configuration and power interface (ACPI) who provides an open standard that operating systems can use to discover and configure computer hardware components, to perform power management, auto configuration and status monitoring. 42
  • 43. 43 Life Cycle of An I/O Request
  • 44. • STREAM – a full-duplex communication channel between a user-level process and a device in Unix System V and beyond • A STREAM consists of: • STREAM head interfaces with the user process • Driver end interfaces with the device • Zero or more STREAM modules between them • Each module contains a read queue and a write queue • Message passing is used to communicate between queues • Flow control option to indicate available or busy • Asynchronous internally, synchronous where user process communicates with stream head 44 STREAMS
  • 45. 45 The STREAMS Structure User Process Stream head Read queue Write Queue Read queue Write Queue Read queue Write Queue Read queue Write Queue Driver end Device STREAMS Modules
  • 46. • I/O a major factor in system Performance: • Demands CPU to execute device driver, kernel I/O code • Context switches due to interrupts • Network traffic especially stressful 46 Performance
  • 47. • Use DMAC. • Reduce number of context switches. • Reduce interrupts by using large transfers, smart controllers, polling. • Use smarter hardware devices. • Balance CPU, memory, bus, and I/O performance for highest throughput. • Move user-mode processes / daemons to kernel threads. 47 Improving Performance