SlideShare a Scribd company logo
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

PPT
inputoutput_organization__Morrismano.ppt
PPTX
Ch 7 io_management & disk scheduling
PPTX
This pot is about computer architecture.
PPTX
I/o management and disk scheduling .pptx
PPT
07_Input Output_Computer Architecture.ppt
PDF
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
PPTX
ch-6 COAyjdhfzgsgfzjnfgbcxvbnfsxgcv.pptx
PDF
chapter5-Input-output.pdf
inputoutput_organization__Morrismano.ppt
Ch 7 io_management & disk scheduling
This pot is about computer architecture.
I/o management and disk scheduling .pptx
07_Input Output_Computer Architecture.ppt
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
ch-6 COAyjdhfzgsgfzjnfgbcxvbnfsxgcv.pptx
chapter5-Input-output.pdf

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

PPTX
Input Output - Computer Architecture
PPT
07 Input Output
PPTX
Chapter 5 IO Unit.pptx we are electrical
PDF
Organisasi dan Arsitektur Komputer MO-06
PPTX
Hardware I/O organization
PPTX
Computer architecture presentation
PPT
07 input output
PPT
Chapter 6 input output
PPTX
operating system introduction- basics of operating system, definition, meanin...
PPT
Supplemental lecture on comprehensive I/O systems.ppt
PPT
07 input output
PPT
Cs intro-ca
PPTX
Lecture 9.pptx
PPTX
Module 6.pptx for computer architecture and organisation
PPT
PPT
chapter 4 Device Management systemss.ppt
PPT
Presentation
PPTX
I/O Management
PPT
POLITEKNIK MALAYSIA
PPT
COMPUTER ORGANIZATION-Input-Output Organization
Input Output - Computer Architecture
07 Input Output
Chapter 5 IO Unit.pptx we are electrical
Organisasi dan Arsitektur Komputer MO-06
Hardware I/O organization
Computer architecture presentation
07 input output
Chapter 6 input output
operating system introduction- basics of operating system, definition, meanin...
Supplemental lecture on comprehensive I/O systems.ppt
07 input output
Cs intro-ca
Lecture 9.pptx
Module 6.pptx for computer architecture and organisation
chapter 4 Device Management systemss.ppt
Presentation
I/O Management
POLITEKNIK MALAYSIA
COMPUTER ORGANIZATION-Input-Output Organization
Ad

Recently uploaded (20)

PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Pre independence Education in Inndia.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharma ospi slides which help in ospi learning
human mycosis Human fungal infections are called human mycosis..pptx
Pre independence Education in Inndia.pdf
Microbial disease of the cardiovascular and lymphatic systems
Pharmacology of Heart Failure /Pharmacotherapy of CHF
GDM (1) (1).pptx small presentation for students
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Computing-Curriculum for Schools in Ghana
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Renaissance Architecture: A Journey from Faith to Humanism
O7-L3 Supply Chain Operations - ICLT Program
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Supply Chain Operations Speaking Notes -ICLT Program
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharma ospi slides which help in ospi learning
Ad

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