SlideShare a Scribd company logo
1 of 28
I/O Organization
Dhaval Bagal
• The major functions or requirements for an I/O module fall into the following
categories:
• Control and timing
• Processor communication
• Device communication
• Data buffering
• Error detection
Requirements for I/O Module
Control and Timing :
• During any period of time, the processor may communicate with one or more external
devices in unpredictable patterns, depending on the program’s need for I/O.
• The internal resources, such as main memory and the system bus, must be shared among a
number of activities, including data I/O. Thus, the I/O function includes a control and timing
requirement, to coordinate the flow of traffic between internal resources and external
devices. For example, the control of the transfer of data from an external device to the
processor might involve the following sequence of steps:
• The processor interrogates the I/O module to check the status of the attached device.
• The I/O module returns the device status.
• If the device is operational and ready to transmit, the processor requests the
transfer of data, by means of a command to the I/O module.
• The I/O module obtains a unit of data(e.g.,8or16bits) from the external device.
• The data are transferred from the I/O module to the processor.
Processor Communication :
• Processor communcation involves the following :
• Command decoding : The I/O module accepts commands from the processor, typically sent as
signals on the control bus. For example, an I/O module for a disk drive might accept the
following commands: READ SECTOR, WRITE SECTOR, SEEK track number, and SCAN
record ID. The latter two commands each include a parameter that is sent on the data bus.
• Data : Data are exchanged between the processor and the I/O module over the data bus.
• Status reporting : Because peripherals are so slow, it is important to know the status of the I/O
module. For example, if an I/O module is asked to send data to the processor (read), it may not
be ready to do so because it is still working on the previous I/O command. This fact can be
reported with a status signal. Common status signals are BUSY and READY. There may also
be signals to report various error conditions.
• Address recognition : Just as each word of memory has an address, so does each I/O device.
Thus, an I/O module must recognize one unique address for each peripheral it controls.
Error Detection :
• Finally, an I/O module is often responsible for error detection and for subsequently
reporting errors to the processor.
• One class of errors includes mechanical and electrical malfunctions reported by the
device (e.g., paper jam, bad disk track).
• Another class consists of unintentional changes to the bit pattern as it is transmitted
from device to I/O module. Some form of error-detecting code is often used to detect
transmission errors.
• I/O operations often have high latencies; the time between the initiation of an I/O
process and its completion may be millions of processor clock cycles.
• Most of this latency is due to the hardware itself; for example, information cannot be
read from or written to a hard disk until the spinning of the disk brings the target
sectors directly under the read/write head.
• If a program only wants to read one block of data from a device, the driver might fetch
that block plus several of the blocks immediately following it on the disk, caching
these in memory which can reduce the latency dramatically.
• When writes to disk are requested, the driver may simply cache the data in memory
until it has accumulated enough blocks of data, at which point it writes them all at
once; this is called flushing the output buffer, orsyncing.
I/O Buffering
• On a multitasking operating system, hardware devices are controlled by the kernel, and
user space applications may not directly access them.
• For this reason, performing I/O requires performing system calls, which, for various
reasons, introduce overhead.
• This overhead is typically on the order of microseconds rather than millisecond, so
using buffering makes a big difference for applications that are I/O bound.
• Thus, nearly every program written in a high-level programming language will have its
own I/O buffers. These buffers may be much larger than the ones maintained by the
low-level drivers, and they exist at a higher level of abstraction, as they are associated
with file handle or file descriptor objects rather than actual hardware.
• Only when the buffer is exhausted, does the program perform a system call to read
more data from the file often, more than is requested by the program at the current time.
Likewise, each output (write) routine simply tacks data onto the buffer, until it is filled, at
which point its contents are sent to the system.
• When a user process issues an I/O request, the O.S assigns a buffer in the system portion of
main memory to the operation.
• In the block oriented devices, Input transfers are made to the system buffer. When the transfer
is complete, the process moves the block into user space and request another block. This is
called reading ahead, it is done in the expectation that the block will be needed sometimes in
future.
• This approach will generally provide a speed up compared to the lack of system buffering. The
O.S must keep track of the assignment of system buffers to user processes.
• Similar considerations apply to block oriented output. When data are being transmitted to a
device, they are first copied from user space into the system buffer, from which they will
ultimately be written. The requesting process is now free to continue.
Single Buffering
• Suppose T is the time required to input one block and C is the computation time
required for input request.
• Without buffering: Execution time is T+C.
• With buffering: Execution time is max [C,T]+M, where M is time required to move the
data from system buffer to user memory.
• In stream oriented I/O, it can be used in two ways,
• Line-at a time fashion. Line- at a time operation is used for scroll made terminals.
User inputs one line at a time, with a carriage return signaling at the end of a line.
• Byte-at a time fashion. Byte-at a time operation is used on forms mode, terminals
when each keystroke is significant.
• An improvement over single buffering is by assigning two system buffers to the
operations.
• A process transfers data to one buffer while operating system empties the other
• Double buffering may be inadequate, if the process performs rapid burst of I/O. When
two or more buffers are used, the collection of buffers is called as a circular buffer,
with each buffer being one unit in the circular buffer.
Double and Circular Buffering
• When the processor is executing a program and encounters an instruction relating to
I/O, it executes that instruction by issuing a command to the appropriate I/O module.
• With programmed I/O, the I/O module will perform the requested action and then set
the appropriate bits in the I/O status register.
• The I/O module takes no further action to alert the processor. In particular, it does not
interrupt the processor.
• Thus, it is the responsibility of the processor periodically to check the status of the I/O
module until it finds that the operation is complete.
Programmed I/O
• With programmed I/O, there is a close correspondence between the I/O-related
instructions that the processor fetches from memory and the I/O commands that the
processor issues to an I/O module to execute the instructions.
• Typically, there will be many I/O devices connected through I/O modules to the
system.
• Each device is given a unique identifier or address.
• When the processor issues an I/O command, the command contains the address of
the desired device.
• Thus, each I/O module must interpret the address lines to determine if the command
is for itself.
• With memory-mapped I/O, there is a single address space for memory locations and I/O
devices.
• The processor treats the status and data registers of I/O modules as memory locations and
uses the same machine instructions to access both memory and I/O devices.
• With isolated I/O the I/O ports are accessible only by special I/O commands, which activate the
I/O command lines on the bus.
• For most types of processors, there is a relatively large set of different instructions for
referencing memory.
• If isolated I/O is used, there are only a few I/O instructions.
• Thus, an advantage of memory-mapped I/O is that this large repertoire of instructions can be
used, allowing more efficient programming.
• A disadvantage is that valuable memory address space is used up.
Memory Mapped and Isolated I/O
• The problem with programmed I/O is that the processor has to wait a long time for the
I/O module of concern to be ready for either reception or transmission of data.
• The processor, while waiting, must repeatedly interrogate the status of the I/O
module. As a result, the level of the performance of the entire system is severely
degraded.
• An alternative is for the processor to issue an I/O command to a module and then go
on to do some other useful work.
• The I/O module will then interrupt the processor to request service when it is ready to
exchange data with the processor. The processor then executes the data transfer, as
before, and then resumes its former processing.
Interrupt Driven I/O
• At the end of each instruction cycle, the processor checks for interrupts
• When the interrupt from the I/O module occurs, the processor saves the context of the
current program and processes the interrupt.
• It then restores the context of the program it was working on (or some other program)
and resumes execution.
• Interrupt I/O still consumes a lot of processor time, because every word of data that
goes from memory to I/O module or from I/O module to memory must pass through
the processor.
• Two design issues arise in implementing interrupt I/O. First, because there will almost
invariably be multiple I/O modules, how does the processor determine which device
issued the interrupt?
• And second, if multiple interrupts have occurred, how does the processor decide
which one to process?
• Four general categories of techniques are in common use:
• Multiple interrupt lines
• Software poll
• Daisy chain (hardware poll, vectored)
• Bus arbitration (vectored)
Design Issues for Interrupt I/O
• Multiple Interrupt Lines : The most straightforward approach to the problem is to
provide multiple interrupt lines between the processor and the I/O modules. However,
it is impractical
• Software polling :
• When the processor detects an interrupt, it branches to an interrupt-service
routine whose job it is to poll each I/O module to determine which module caused
the interrupt.
• The processor then reads the status register of each I/O module to identify the
interrupting module.
• The disadvantage of the software poll is that it is time consuming. A more efficient
technique is to use a daisy chain, which provides, in effect, a hardware poll.
• Daisy Chaining :
• For interrupts, all I/O modules share a common interrupt request line.
• The interrupt acknowledge line is daisy chained through the modules.
• When the processor senses an interrupt, it sends out an interrupt acknowledge.
• This signal propagates through a series of I/O modules until it gets to a requesting
module.
• The requesting module typically responds by placing a word on the data lines.
This word is referred to as a vector and is either the address of the I/O module
or some other unique identifier.
• In either case, the processor uses the vector as a pointer to the appropriate
device-service routine.
• This avoids the need to execute a general interrupt-service routine first. This
technique is called a vectored interrupt.
• Bus Arbitration :
• There is another technique that makes use of vectored interrupts, and that is bus
arbitration.
• With bus arbitration, an I/O module must first gain control of the bus before it can
raise the interrupt request line.
• Thus, only one module can raise the line at a time.
• When the processor detects the interrupt, it responds on the interrupt
acknowledge line.
• The requesting module then places its vector on the data lines.
• In Interrupt driven I/O there is intervention of processor while transferring data. Thus
the I/O transfer rate is limited by the speed with which the processor can test and
service a device.
• Also for managing I/O transfer a number of instructions must be executed for each I/O
transfer.
• The DMA module is capable of mimicking the processor and, indeed, of taking over
control of the system from the processor. It needs to do this to transfer data to and
from memory over the system bus.
• For this purpose, the DMA module must use the bus only when the processor does not
need it, or it must force the processor to suspend operation temporarily. The latter
technique is more common and is referred to as cycle stealing, because the DMA
module in effect steals a bus cycle.
DMA
• The DMA module, acting as a surrogate processor, uses programmed I/O to
exchange data between memory and an I/O module through the DMA module.
• When the processor wishes to read or write a block of data, it issues a command to
the DMA module, by sending to the DMA module the following information:
• Whether a read or write is requested, using the read or write control line between the
processor and the DMA module
• The address of the I/O device involved, communicated on the data lines
• The starting location in memory to read from or write to, communicated on the data
lines and stored by the DMA module in its address register
• The number of words to be read or written, again communicated via the data lines
and stored in the data count register
• The processor then continues with other work. It has delegated this I/O operation to
the DMA module.
• The DMA module transfers the entire block of data, one word at a time, directly to or
from memory, without going through the processor.
• When the transfer is complete, the DMA module sends an interrupt signal to the
processor.
• Thus, the processor is involved only at the beginning and end of the transfer
• The processor is suspended just before it needs to use the bus.
• The DMA module then transfers one word and returns control to the processor.
• Note that this is not an interrupt; the processor does not save a context and do
something else. Rather, the processor pauses for one bus cycle.
• The DMA logic may actually be a part of an I/O module,
• Or it may be a separate module that controls one or more I/O modules.
• This concept can be taken one step further by connecting I/O modules to the DMA
module using an I/O bus
• Centralised Arbitration :
• In centralized bus arbitration, a single bus arbiter performs the required arbitration.
The bus arbiter may be the processor or a separate controller connected to the bus.
Bus Arbitration
• Decentralised Arbitration :
• For distributed arbitration, each device is assigned a unique ID ARB3…ARB0
• There are 4 arbitration lines which are all open collector. Therefore more than one
device can place their 4 bit ID to indicate that they need to control bus.
• When 2 or more devices place their ID on bus lines then it is necessary to identify the
highest ID
• A —> 0001 and B —> 0110
• Code is 0111
• Each device compares the code formed on the arbitration line to its own ID, starting
from the most significant bit.
• If it finds the difference at any bit position, it disables its drives at that bit position and
for all lower-order bits.
• E.g In this case 0 of A and 0 of B match. Next 0 of A and 1 of B don't match. Hence A
disables all its lines and B owns the race

More Related Content

What's hot

Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed controlSyed Zaid Irshad
 
DMA operation
DMA operationDMA operation
DMA operationImran Khan
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and DesignKamal Acharya
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Memory management
Memory managementMemory management
Memory managementVishal Singh
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle pptsheetal singh
 
Asynchronous data transfer
Asynchronous  data  transferAsynchronous  data  transfer
Asynchronous data transferNancyBeaulah_R
 
Interrupts and types of interrupts
Interrupts and types of interruptsInterrupts and types of interrupts
Interrupts and types of interruptsMuhammad Sheharyar Asif
 
Computer registers
Computer registersComputer registers
Computer registersDeepikaT13
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operationskdisthere
 
I/O System
I/O SystemI/O System
I/O SystemNagarajan
 
03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.encAnwal Mirza
 
Arithmatic pipline
Arithmatic piplineArithmatic pipline
Arithmatic piplineA. Shamel
 

What's hot (20)

Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed control
 
DMA operation
DMA operationDMA operation
DMA operation
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Interrupts
InterruptsInterrupts
Interrupts
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
 
Interrupt
InterruptInterrupt
Interrupt
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Memory management
Memory managementMemory management
Memory management
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Asynchronous data transfer
Asynchronous  data  transferAsynchronous  data  transfer
Asynchronous data transfer
 
Interrupts and types of interrupts
Interrupts and types of interruptsInterrupts and types of interrupts
Interrupts and types of interrupts
 
Computer registers
Computer registersComputer registers
Computer registers
 
Modes of data transfer
Modes of data transferModes of data transfer
Modes of data transfer
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operations
 
Direct Memory Access ppt
Direct Memory Access pptDirect Memory Access ppt
Direct Memory Access ppt
 
I/O System
I/O SystemI/O System
I/O System
 
03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc
 
Arithmatic pipline
Arithmatic piplineArithmatic pipline
Arithmatic pipline
 

Similar to I/O Organization

computer system structure
computer system structurecomputer system structure
computer system structureHAMZA AHMED
 
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
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingmadhuributani
 
Unit v: Device Management
Unit v: Device ManagementUnit v: Device Management
Unit v: Device ManagementArnav Chowdhury
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its typesNehal Naik
 
E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5Sneha Chopra
 
I/O systems chapter 12 OS
I/O systems chapter 12 OS I/O systems chapter 12 OS
I/O systems chapter 12 OS ssuser45ae56
 
COMPUTER ORGANIZATION NOTES Unit 3 4
COMPUTER ORGANIZATION NOTES  Unit 3 4COMPUTER ORGANIZATION NOTES  Unit 3 4
COMPUTER ORGANIZATION NOTES Unit 3 4Dr.MAYA NAYAK
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptxSherinRappai
 
Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfTaufeeq8
 
A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...rsaravanakumar13
 
Unit2 p1 io organization-97-2003
Unit2 p1 io organization-97-2003Unit2 p1 io organization-97-2003
Unit2 p1 io organization-97-2003Swathi Veeradhi
 
comporgppt.pptx
comporgppt.pptxcomporgppt.pptx
comporgppt.pptxFaisalAijaz1
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 

Similar to I/O Organization (20)

computer system structure
computer system structurecomputer system structure
computer system structure
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 
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
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk scheduling
 
Unit v: Device Management
Unit v: Device ManagementUnit v: Device Management
Unit v: Device Management
 
Io techniques & its types
Io techniques & its typesIo techniques & its types
Io techniques & its types
 
E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5
 
I/O systems chapter 12 OS
I/O systems chapter 12 OS I/O systems chapter 12 OS
I/O systems chapter 12 OS
 
COMPUTER ORGANIZATION NOTES Unit 3 4
COMPUTER ORGANIZATION NOTES  Unit 3 4COMPUTER ORGANIZATION NOTES  Unit 3 4
COMPUTER ORGANIZATION NOTES Unit 3 4
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptx
 
Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdf
 
Ca 2 note mano
Ca 2 note manoCa 2 note mano
Ca 2 note mano
 
Ch12 io systems
Ch12   io systemsCh12   io systems
Ch12 io systems
 
A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...
 
Unit2 p1 io organization-97-2003
Unit2 p1 io organization-97-2003Unit2 p1 io organization-97-2003
Unit2 p1 io organization-97-2003
 
comporgppt.pptx
comporgppt.pptxcomporgppt.pptx
comporgppt.pptx
 
Cao u1
Cao u1Cao u1
Cao u1
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 

More from Dhaval Bagal

Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer ArithmeticDhaval Bagal
 
Advanced processor principles
Advanced processor principlesAdvanced processor principles
Advanced processor principlesDhaval Bagal
 
Memory organization
Memory organizationMemory organization
Memory organizationDhaval Bagal
 
Control unit design
Control unit designControl unit design
Control unit designDhaval Bagal
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureDhaval Bagal
 
Computer Organization and Architecture Overview
Computer Organization and Architecture OverviewComputer Organization and Architecture Overview
Computer Organization and Architecture OverviewDhaval Bagal
 

More from Dhaval Bagal (6)

Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Advanced processor principles
Advanced processor principlesAdvanced processor principles
Advanced processor principles
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Control unit design
Control unit designControl unit design
Control unit design
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Computer Organization and Architecture Overview
Computer Organization and Architecture OverviewComputer Organization and Architecture Overview
Computer Organization and Architecture Overview
 

Recently uploaded

Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 

Recently uploaded (20)

young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 

I/O Organization

  • 2. • The major functions or requirements for an I/O module fall into the following categories: • Control and timing • Processor communication • Device communication • Data buffering • Error detection Requirements for I/O Module
  • 3. Control and Timing : • During any period of time, the processor may communicate with one or more external devices in unpredictable patterns, depending on the program’s need for I/O. • The internal resources, such as main memory and the system bus, must be shared among a number of activities, including data I/O. Thus, the I/O function includes a control and timing requirement, to coordinate the flow of traffic between internal resources and external devices. For example, the control of the transfer of data from an external device to the processor might involve the following sequence of steps: • The processor interrogates the I/O module to check the status of the attached device. • The I/O module returns the device status. • If the device is operational and ready to transmit, the processor requests the transfer of data, by means of a command to the I/O module. • The I/O module obtains a unit of data(e.g.,8or16bits) from the external device. • The data are transferred from the I/O module to the processor.
  • 4. Processor Communication : • Processor communcation involves the following : • Command decoding : The I/O module accepts commands from the processor, typically sent as signals on the control bus. For example, an I/O module for a disk drive might accept the following commands: READ SECTOR, WRITE SECTOR, SEEK track number, and SCAN record ID. The latter two commands each include a parameter that is sent on the data bus. • Data : Data are exchanged between the processor and the I/O module over the data bus. • Status reporting : Because peripherals are so slow, it is important to know the status of the I/O module. For example, if an I/O module is asked to send data to the processor (read), it may not be ready to do so because it is still working on the previous I/O command. This fact can be reported with a status signal. Common status signals are BUSY and READY. There may also be signals to report various error conditions. • Address recognition : Just as each word of memory has an address, so does each I/O device. Thus, an I/O module must recognize one unique address for each peripheral it controls.
  • 5. Error Detection : • Finally, an I/O module is often responsible for error detection and for subsequently reporting errors to the processor. • One class of errors includes mechanical and electrical malfunctions reported by the device (e.g., paper jam, bad disk track). • Another class consists of unintentional changes to the bit pattern as it is transmitted from device to I/O module. Some form of error-detecting code is often used to detect transmission errors.
  • 6. • I/O operations often have high latencies; the time between the initiation of an I/O process and its completion may be millions of processor clock cycles. • Most of this latency is due to the hardware itself; for example, information cannot be read from or written to a hard disk until the spinning of the disk brings the target sectors directly under the read/write head. • If a program only wants to read one block of data from a device, the driver might fetch that block plus several of the blocks immediately following it on the disk, caching these in memory which can reduce the latency dramatically. • When writes to disk are requested, the driver may simply cache the data in memory until it has accumulated enough blocks of data, at which point it writes them all at once; this is called flushing the output buffer, orsyncing. I/O Buffering
  • 7. • On a multitasking operating system, hardware devices are controlled by the kernel, and user space applications may not directly access them. • For this reason, performing I/O requires performing system calls, which, for various reasons, introduce overhead. • This overhead is typically on the order of microseconds rather than millisecond, so using buffering makes a big difference for applications that are I/O bound. • Thus, nearly every program written in a high-level programming language will have its own I/O buffers. These buffers may be much larger than the ones maintained by the low-level drivers, and they exist at a higher level of abstraction, as they are associated with file handle or file descriptor objects rather than actual hardware. • Only when the buffer is exhausted, does the program perform a system call to read more data from the file often, more than is requested by the program at the current time. Likewise, each output (write) routine simply tacks data onto the buffer, until it is filled, at which point its contents are sent to the system.
  • 8. • When a user process issues an I/O request, the O.S assigns a buffer in the system portion of main memory to the operation. • In the block oriented devices, Input transfers are made to the system buffer. When the transfer is complete, the process moves the block into user space and request another block. This is called reading ahead, it is done in the expectation that the block will be needed sometimes in future. • This approach will generally provide a speed up compared to the lack of system buffering. The O.S must keep track of the assignment of system buffers to user processes. • Similar considerations apply to block oriented output. When data are being transmitted to a device, they are first copied from user space into the system buffer, from which they will ultimately be written. The requesting process is now free to continue. Single Buffering
  • 9. • Suppose T is the time required to input one block and C is the computation time required for input request. • Without buffering: Execution time is T+C. • With buffering: Execution time is max [C,T]+M, where M is time required to move the data from system buffer to user memory. • In stream oriented I/O, it can be used in two ways, • Line-at a time fashion. Line- at a time operation is used for scroll made terminals. User inputs one line at a time, with a carriage return signaling at the end of a line. • Byte-at a time fashion. Byte-at a time operation is used on forms mode, terminals when each keystroke is significant.
  • 10. • An improvement over single buffering is by assigning two system buffers to the operations. • A process transfers data to one buffer while operating system empties the other • Double buffering may be inadequate, if the process performs rapid burst of I/O. When two or more buffers are used, the collection of buffers is called as a circular buffer, with each buffer being one unit in the circular buffer. Double and Circular Buffering
  • 11. • When the processor is executing a program and encounters an instruction relating to I/O, it executes that instruction by issuing a command to the appropriate I/O module. • With programmed I/O, the I/O module will perform the requested action and then set the appropriate bits in the I/O status register. • The I/O module takes no further action to alert the processor. In particular, it does not interrupt the processor. • Thus, it is the responsibility of the processor periodically to check the status of the I/O module until it finds that the operation is complete. Programmed I/O
  • 12. • With programmed I/O, there is a close correspondence between the I/O-related instructions that the processor fetches from memory and the I/O commands that the processor issues to an I/O module to execute the instructions. • Typically, there will be many I/O devices connected through I/O modules to the system. • Each device is given a unique identifier or address. • When the processor issues an I/O command, the command contains the address of the desired device. • Thus, each I/O module must interpret the address lines to determine if the command is for itself.
  • 13. • With memory-mapped I/O, there is a single address space for memory locations and I/O devices. • The processor treats the status and data registers of I/O modules as memory locations and uses the same machine instructions to access both memory and I/O devices. • With isolated I/O the I/O ports are accessible only by special I/O commands, which activate the I/O command lines on the bus. • For most types of processors, there is a relatively large set of different instructions for referencing memory. • If isolated I/O is used, there are only a few I/O instructions. • Thus, an advantage of memory-mapped I/O is that this large repertoire of instructions can be used, allowing more efficient programming. • A disadvantage is that valuable memory address space is used up. Memory Mapped and Isolated I/O
  • 14.
  • 15. • The problem with programmed I/O is that the processor has to wait a long time for the I/O module of concern to be ready for either reception or transmission of data. • The processor, while waiting, must repeatedly interrogate the status of the I/O module. As a result, the level of the performance of the entire system is severely degraded. • An alternative is for the processor to issue an I/O command to a module and then go on to do some other useful work. • The I/O module will then interrupt the processor to request service when it is ready to exchange data with the processor. The processor then executes the data transfer, as before, and then resumes its former processing. Interrupt Driven I/O
  • 16. • At the end of each instruction cycle, the processor checks for interrupts • When the interrupt from the I/O module occurs, the processor saves the context of the current program and processes the interrupt. • It then restores the context of the program it was working on (or some other program) and resumes execution. • Interrupt I/O still consumes a lot of processor time, because every word of data that goes from memory to I/O module or from I/O module to memory must pass through the processor.
  • 17.
  • 18. • Two design issues arise in implementing interrupt I/O. First, because there will almost invariably be multiple I/O modules, how does the processor determine which device issued the interrupt? • And second, if multiple interrupts have occurred, how does the processor decide which one to process? • Four general categories of techniques are in common use: • Multiple interrupt lines • Software poll • Daisy chain (hardware poll, vectored) • Bus arbitration (vectored) Design Issues for Interrupt I/O
  • 19. • Multiple Interrupt Lines : The most straightforward approach to the problem is to provide multiple interrupt lines between the processor and the I/O modules. However, it is impractical • Software polling : • When the processor detects an interrupt, it branches to an interrupt-service routine whose job it is to poll each I/O module to determine which module caused the interrupt. • The processor then reads the status register of each I/O module to identify the interrupting module. • The disadvantage of the software poll is that it is time consuming. A more efficient technique is to use a daisy chain, which provides, in effect, a hardware poll.
  • 20. • Daisy Chaining : • For interrupts, all I/O modules share a common interrupt request line. • The interrupt acknowledge line is daisy chained through the modules. • When the processor senses an interrupt, it sends out an interrupt acknowledge. • This signal propagates through a series of I/O modules until it gets to a requesting module. • The requesting module typically responds by placing a word on the data lines. This word is referred to as a vector and is either the address of the I/O module or some other unique identifier. • In either case, the processor uses the vector as a pointer to the appropriate device-service routine. • This avoids the need to execute a general interrupt-service routine first. This technique is called a vectored interrupt.
  • 21. • Bus Arbitration : • There is another technique that makes use of vectored interrupts, and that is bus arbitration. • With bus arbitration, an I/O module must first gain control of the bus before it can raise the interrupt request line. • Thus, only one module can raise the line at a time. • When the processor detects the interrupt, it responds on the interrupt acknowledge line. • The requesting module then places its vector on the data lines.
  • 22. • In Interrupt driven I/O there is intervention of processor while transferring data. Thus the I/O transfer rate is limited by the speed with which the processor can test and service a device. • Also for managing I/O transfer a number of instructions must be executed for each I/O transfer. • The DMA module is capable of mimicking the processor and, indeed, of taking over control of the system from the processor. It needs to do this to transfer data to and from memory over the system bus. • For this purpose, the DMA module must use the bus only when the processor does not need it, or it must force the processor to suspend operation temporarily. The latter technique is more common and is referred to as cycle stealing, because the DMA module in effect steals a bus cycle. DMA
  • 23. • The DMA module, acting as a surrogate processor, uses programmed I/O to exchange data between memory and an I/O module through the DMA module. • When the processor wishes to read or write a block of data, it issues a command to the DMA module, by sending to the DMA module the following information: • Whether a read or write is requested, using the read or write control line between the processor and the DMA module • The address of the I/O device involved, communicated on the data lines • The starting location in memory to read from or write to, communicated on the data lines and stored by the DMA module in its address register • The number of words to be read or written, again communicated via the data lines and stored in the data count register
  • 24. • The processor then continues with other work. It has delegated this I/O operation to the DMA module. • The DMA module transfers the entire block of data, one word at a time, directly to or from memory, without going through the processor. • When the transfer is complete, the DMA module sends an interrupt signal to the processor. • Thus, the processor is involved only at the beginning and end of the transfer • The processor is suspended just before it needs to use the bus. • The DMA module then transfers one word and returns control to the processor. • Note that this is not an interrupt; the processor does not save a context and do something else. Rather, the processor pauses for one bus cycle.
  • 25.
  • 26. • The DMA logic may actually be a part of an I/O module, • Or it may be a separate module that controls one or more I/O modules. • This concept can be taken one step further by connecting I/O modules to the DMA module using an I/O bus
  • 27. • Centralised Arbitration : • In centralized bus arbitration, a single bus arbiter performs the required arbitration. The bus arbiter may be the processor or a separate controller connected to the bus. Bus Arbitration
  • 28. • Decentralised Arbitration : • For distributed arbitration, each device is assigned a unique ID ARB3…ARB0 • There are 4 arbitration lines which are all open collector. Therefore more than one device can place their 4 bit ID to indicate that they need to control bus. • When 2 or more devices place their ID on bus lines then it is necessary to identify the highest ID • A —> 0001 and B —> 0110 • Code is 0111 • Each device compares the code formed on the arbitration line to its own ID, starting from the most significant bit. • If it finds the difference at any bit position, it disables its drives at that bit position and for all lower-order bits. • E.g In this case 0 of A and 0 of B match. Next 0 of A and 1 of B don't match. Hence A disables all its lines and B owns the race