The document discusses input and output (I/O) in operating systems. It provides an overview of I/O hardware and software principles, and describes the three main methods of implementing I/O - programmed I/O, interrupt-driven I/O, and I/O using direct memory access (DMA). Device drivers are organized to provide a uniform interface and hide device specifics, while the operating system provides services like buffering to device drivers.
Advanced debugging on ARM Cortex devices such as STM32, Kinetis, LPC, etc.Atollic
Learn more on advanced debugging of ARM Cortex devices, including how to analyse crashed system after a hard fault exception, SWV real-time event and data tracing, analysing execution history using ETM instruction tracing, dual-core debugging, kernel aware RTOS debugging, and more. Also, learn how to introducing bugs in the first place with static source code analysis (such as MISRA-C), code complexity analysis, and source code review meetings (peer review)
SA_IT241_3
WHAT ARE THE SECURITY VIOLATION CATEGORIES?
1. Breach of confidentiality: unauthorized reading of data.
2. Breach of integrity: unauthorized modification of data.
3. Breach of availability: unauthorized destruction of data.
4. Theft of service: unauthorized use of resources.
5. Denial of Service(DOS): Prevention of legitimate use.
WHAT ARE THE SECURITY VIOLATION METHODS?
1. Masquerading (authentication breach): pretending to be an authorized user.
2. Replay Attack: Replaying the same message or adding a modification to it.
3. Man-in-the-middle attack: intruder sits in data flow, masquerading as sender to receiver and vice versa.
4. Session hijacking: intercepting a session which is already on going to by-pass authentication.
5. Privilege escalation: A really Common attack, access of resources that a user is not supposed to have.
WHAT ARE THE OTHER VARIATIONS OF HYPERVISORS?
1. Paravirtualization: guest OS is modified to work with VMM.
2. Programming-environment virtualization: VMMS do not virtualize hardware which creates optimized virtual system (Used by Oracle Java and Microsoft.Net).
3. Emulators: Allows applications written for one hardware to run on different hardware environments.
4. Application Containment: Not virtualization but, provides features like it by segregating application making them more secure and manageable.
Oracle Solaris Zones, BSD Jails, IBM AIX WPARs.
• Much variation is due to breadth, depth, and importance of virtualization.
WHAT ARE THE STEPS OF LIVE MIGRATION?
1. VMM start connection with the target VMM.
2. Target created a new guest (by creating a new VCPU).
3. VMM sends read-only files to target VMM.
4. VMM sends read-write files to target VMM.
5. Repeat 4 unit done as not all read-write data can be sent (could be a dirty read).
6. If step 4 and 5 becomes very short then, VMM freezes guest, send remaining stuff.
7. Target starts running the freezed guest.
WHAT ARE THE REASONS FOR DISTRIBUTED SYSTEMS?
1. Resource sharing
Sharing files, information, printing.
Using remote GPUs.
2. Computation speedup
dsitribute processing needed to multicomputers.
Load balancing: moving jobs to more lightly-laoded sites.
3. Reliability: detect and recover failurs.
WHAT ARE THE WIDELY USED ARCHITECTURES?
1. Client-server model.
2. Cluster-based model.
WHAT ARE THE CHALLENGES?
1. Naming and transparency.
2. Remote file access.
3. Caching and caching consistency.
WHAT WAS GFS WAS INFLUNECNED BY?
1. Hardware failure should be expected routinely.
2. Most files are changed by appending new data (rather than overwriting existing data).
3. Modularized software layer MapReduce sit on top of GFS to carry out large-scale parallel computations.
WHAT ARE THE ADVANTAGES OF DISK CACHES?
1. Reliable
2. Cached data kept on disk do not need to be fetched again while recovery.
ADVANTAGES OF MAIN MEMORY CACHES?
1. Can make workstations diskless.
2. Quicker data access.
3. Performance speed up in bigger memories.
4. Server c
Advanced debugging on ARM Cortex devices such as STM32, Kinetis, LPC, etc.Atollic
Learn more on advanced debugging of ARM Cortex devices, including how to analyse crashed system after a hard fault exception, SWV real-time event and data tracing, analysing execution history using ETM instruction tracing, dual-core debugging, kernel aware RTOS debugging, and more. Also, learn how to introducing bugs in the first place with static source code analysis (such as MISRA-C), code complexity analysis, and source code review meetings (peer review)
SA_IT241_3
WHAT ARE THE SECURITY VIOLATION CATEGORIES?
1. Breach of confidentiality: unauthorized reading of data.
2. Breach of integrity: unauthorized modification of data.
3. Breach of availability: unauthorized destruction of data.
4. Theft of service: unauthorized use of resources.
5. Denial of Service(DOS): Prevention of legitimate use.
WHAT ARE THE SECURITY VIOLATION METHODS?
1. Masquerading (authentication breach): pretending to be an authorized user.
2. Replay Attack: Replaying the same message or adding a modification to it.
3. Man-in-the-middle attack: intruder sits in data flow, masquerading as sender to receiver and vice versa.
4. Session hijacking: intercepting a session which is already on going to by-pass authentication.
5. Privilege escalation: A really Common attack, access of resources that a user is not supposed to have.
WHAT ARE THE OTHER VARIATIONS OF HYPERVISORS?
1. Paravirtualization: guest OS is modified to work with VMM.
2. Programming-environment virtualization: VMMS do not virtualize hardware which creates optimized virtual system (Used by Oracle Java and Microsoft.Net).
3. Emulators: Allows applications written for one hardware to run on different hardware environments.
4. Application Containment: Not virtualization but, provides features like it by segregating application making them more secure and manageable.
Oracle Solaris Zones, BSD Jails, IBM AIX WPARs.
• Much variation is due to breadth, depth, and importance of virtualization.
WHAT ARE THE STEPS OF LIVE MIGRATION?
1. VMM start connection with the target VMM.
2. Target created a new guest (by creating a new VCPU).
3. VMM sends read-only files to target VMM.
4. VMM sends read-write files to target VMM.
5. Repeat 4 unit done as not all read-write data can be sent (could be a dirty read).
6. If step 4 and 5 becomes very short then, VMM freezes guest, send remaining stuff.
7. Target starts running the freezed guest.
WHAT ARE THE REASONS FOR DISTRIBUTED SYSTEMS?
1. Resource sharing
Sharing files, information, printing.
Using remote GPUs.
2. Computation speedup
dsitribute processing needed to multicomputers.
Load balancing: moving jobs to more lightly-laoded sites.
3. Reliability: detect and recover failurs.
WHAT ARE THE WIDELY USED ARCHITECTURES?
1. Client-server model.
2. Cluster-based model.
WHAT ARE THE CHALLENGES?
1. Naming and transparency.
2. Remote file access.
3. Caching and caching consistency.
WHAT WAS GFS WAS INFLUNECNED BY?
1. Hardware failure should be expected routinely.
2. Most files are changed by appending new data (rather than overwriting existing data).
3. Modularized software layer MapReduce sit on top of GFS to carry out large-scale parallel computations.
WHAT ARE THE ADVANTAGES OF DISK CACHES?
1. Reliable
2. Cached data kept on disk do not need to be fetched again while recovery.
ADVANTAGES OF MAIN MEMORY CACHES?
1. Can make workstations diskless.
2. Quicker data access.
3. Performance speed up in bigger memories.
4. Server c
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Vaccine management system project report documentation..pdfKamal Acharya
The Division of Vaccine and Immunization is facing increasing difficulty monitoring vaccines and other commodities distribution once they have been distributed from the national stores. With the introduction of new vaccines, more challenges have been anticipated with this additions posing serious threat to the already over strained vaccine supply chain system in Kenya.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
1. Input and Output
CS-3013 A-term 2009 1
Input and Output
CS-3013, Operating Systems
A-term 2009
(Slides include materials from Modern Operating Systems, 3rd ed., by Andrew Tanenbaum and from
Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne)
2. Input and Output
CS-3013 A-term 2009 2
Overview
• What is I/O?
• Principles of I/O hardware
• Principles of I/O software
• Methods of implementing input-output activities
• Organization of device drivers
• Specific kinds of devices
(Tanenbaum, Chapter 5)
3. Input and Output
CS-3013 A-term 2009 3
Overview
• What is I/O?
• Principles of I/O hardware
• Principles of I/O software
• Methods of implementing input-output activities
• Organization of device drivers
• Specific kinds of devices
(Tanenbaum, Chapter 5)
4. Input and Output
CS-3013 A-term 2009 4
The I/O Subsystem
• The largest, most complex subsystem in OS
• Most lines of code
• Highest rate of code changes
• Where OS engineers most likely to work
• Difficult to test thoroughly
• Make-or-break issue for any system
• Big impact on performance and perception
• Bigger impact on acceptability in market
5. Input and Output
CS-3013 A-term 2009 5
Device
Hardware Organization (simple)
CPU
Memory
memory bus
Device
6. Input and Output
CS-3013 A-term 2009 6
Hardware Organization (typical Pentium)
ISA
bridge
IDE
disk
Main
Memory
CPU
Level
2
cache
Bridge
Moni-
tor
Graphics
card
USB
Key-
board
Mouse
Ether-
net
SCSI
Modem
Sound
card
Printer
PCI bus
ISA bus
AGP Port
7. Input and Output
CS-3013 A-term 2009 7
Kinds of I/O Devices
• Character (and sub-character) devices
• Mouse, character terminal, joy stick, some keyboards
• Block transfer
• Disk, tape, CD, DVD
• Network
• Clocks
• Internal, external
• Graphics
• GUI, games
• Multimedia
• Audio, video
• Other
• Sensors, controllers
8. Input and Output
CS-3013 A-term 2009 8
Controlling an I/O Device
• A function of host CPU architecture
• Two extremes:– Special instructions vs. memory-mapped
• Special I/O instructions
• Opcode to stop, start, query, etc.
• Separate I/O address space
• Kernel mode only
• Memory-mapped I/O control registers
• Each register has a physical memory address
• Writing to data register is output
• Reading from data register is input
• Writing to control register causes action
• Can be mapped to kernel or user-level virtual memory
9. Input and Output
CS-3013 A-term 2009 9
Character Device (example)
• Data register:
• Register or address where data is read from or
written to
• Very limited capacity (at most a few bytes)
• Action register:
• When writing to register, causes a physical action
• Reading from register yields zero
• Status register:
• Reading from register provides information
• Writing to register is no-op
10. Input and Output
CS-3013 A-term 2009 10
Block Transfer Device (example)
• Buffer address register:
• Points to area in physical memory to read or write data
or
• Addressable buffer for data
• E.g., network cards
• Action register:
• When writing to register, initiates a physical action or data
transfer
• Reading from register yields zero
• Status register:
• Reading from register provides information
• Writing to register is no-op
11. Input and Output
CS-3013 A-term 2009 11
DMA
(Direct Memory Access)
• Ability to cause block devices to autonomously
read from and/or write to main memory
• (Usually) physical addresses
• (Sometimes) bus congestion leading to performance
degradation of CPU
• Transfer address
• Points to location in physical memory
• Action register:
• Initiates a reading of control block chain to start actions
• Status register:
• Reading from register provides information
12. Input and Output
CS-3013 A-term 2009 12
Direct Memory Access (DMA)
Operation of a DMA transfer
Figure 5-4, Tanenbaum
13. Input and Output
CS-3013 A-term 2009 13
Programmed DMA
DMA controller
First
control block
controls
disk
operation
address
Count
control info
next
operation
address
Count
control info
next
operation
address
Count
control info
next
…
physical
memory
14. Input and Output
CS-3013 A-term 2009 14
Programmed DMA (continued)
• DMA control register points to first control block in chain
• Each DMA control block has
• Action & control info for a single transfer of one or more blocks
• Data addresses in physical memory
• (optional) link to next block in chain
• (optional) interrupt upon completion
• Each control block removed from chain upon completion
• I/O subsystem may add control blocks to chain while
transfers are in progress
• Result:– uninterrupted sequence of transfers with no CPU
intervention
16. Input and Output
CS-3013 A-term 2009 16
Overview
• What is I/O?
• Principles of I/O hardware
• Principles of I/O software
• Methods of implementing input-output activities
• Organization of device drivers
• Specific kinds of devices
(Tanenbaum, Chapter 5)
17. Input and Output
CS-3013 A-term 2009 17
Principles of I/O Software
• Efficiency – Do not allow I/O operations to become system bottleneck
• Especially slow devices
• Device independence – isolate OS and application programs from
device specific details and peculiarities
• Uniform naming – support a way of naming devices that is scalable
and consistent
• Error handling – isolate the impact of device errors, retry where
possible, provide uniform error codes
• Errors are abundant in I/O
• Buffering – provide uniform methods for storing and copying data
between physical memory and the devices
• Uniform data transfer modes – synchronous and asynchronous, read,
write, ..
• Controlled device access – sharing and transfer modes
• Uniform driver support – specify interfaces and protocols that drivers
must adhere to
18. Input and Output
CS-3013 A-term 2009 18
I/O Software “Stack”
User Level Software
Device Independent
Software
Device Drivers
Interrupt Handlers
Hardware
I/O API & libraries
Device Dependent
Device Dependent –
as short as possible
(Rest of the OS)
19. Input and Output
CS-3013 A-term 2009 19
Three common ways I/O can be performed
• Programmed I/O
• Interrupt-Driven I/O
• I/O using DMA
20. Input and Output
CS-3013 A-term 2009 20
Programmed I/O (Polling)
• Used when device and controller are relatively
quick to process an I/O operation
– Device driver
• Gains access to device
• Initiates I/O operation
• Loops testing for completion of I/O operation (busy wait)
• If there are more I/O operations, repeat
– Used in following kinds of cases
• Service interrupt time > Device response time
• Device has no interrupt capability
• Embedded systems where CPU has nothing else to do
21. Input and Output
CS-3013 A-term 2009 21
Programmed I/O Example —
Bitmapped Keyboard & Mouse
• Keyboard & mouse buttons implemented as 128-
bit read-only register
• One bit for each key and mouse button
• 0 = “up”; 1 = “down”
• Mouse “wheels” implemented as pair of counters
• One click per unit of motion in each of x and y directions
• Clock interrupt every 10 msec
• Reads keyboard register, compares to previous copy
• Determines key & button transitions up or down
• Decodes transition stream to form character and button
sequence
• Reads and compares mouse counters to form motion sequence
22. Input and Output
CS-3013 A-term 2009 22
Other Programmed I/O examples
• Check status of device
• Read from disk or boot device at boot time
• No OS present, hence no interrupt handlers
• Needed for bootstrap loading of the inner portions of
kernel
• External sensors or controllers
• Real-time control systems
23. Input and Output
CS-3013 A-term 2009 23
Interrupt-Driven I/O
• Interrupts occur on I/O events
• operation completion
• Error or change of status
• Programmed in DMA command chain
• Interrupt
– stops CPU from continuing with current work
– Saves some context
– restarts CPU with new address & stack
• Set up by the interrupt vector
• Target is the interrupt handler
CPU participates in
every byte transferred!
25. Input and Output
CS-3013 A-term 2009 25
Interrupt Request Lines (IRQs)
• Every device is assigned an IRQ
– Used when raising an interrupt
– Interrupt handler can identify the interrupting
device
• Assigning IRQs
– In older and simpler hardware, physically by
wires and contacts on device or bus
– In most modern PCs, etc., assigned dynamically
at boot time
26. Input and Output
CS-3013 A-term 2009 26
Handling Interrupts (Linux Style)
• Terminology
– Interrupt context – kernel operating not on behalf of any process
– Process context – kernel operating on behalf of a particular process
– User context – process executing in user virtual memory
• Interrupt Service Routine (ISR), also called Interrupt
Handler
– The function that is invoked when an interrupt is raised
– Identified by IRQ
– Operates on Interrupt stack (as of Linux kernel 2.6)
• One interrupt stack per processor; approx 4-8 kbytes
• …
27. Input and Output
CS-3013 A-term 2009 27
Handling Interrupts (Linux Style – continued)
• …
• Top half – does minimal, time-critical work
necessary
– Acknowledge interrupt, reset device, copy buffer or
registers, etc.
– Interrupts (usually) disabled on current processor
• Bottom half – the part of the ISR that can be
deferred to more convenient time
– Completes I/O processing; does most of the work
– Interrupts enabled (usually)
– Communicates with processes
– Possibly in a kernel thread (or even a user thread!)
Definitions!
28. Input and Output
CS-3013 A-term 2009 28
Interrupt-Driven I/O Example
Software Time-of-Day Clock
• Interrupt occurs at fixed intervals
• 50 or 60 Hz
• Service routine (top half):–
• Adds one tick to clock counter
• Service routine (bottom half):–
• Checks list of soft timers
• Notifies tasks of any expired timers
Note that this looks a lot
like programmed I/O
• Except for bottom-half
processing
29. Input and Output
CS-3013 A-term 2009 29
Other Interrupt-Driven I/O examples
• Very “slow” character-at-a-time terminals
– Mechanical printers (15 characters/second)
– Some keyboards (one character/keystroke)
• Command-line completion in many Unix systems
– Game consoles
– Serial modems
– Many I/O devices in “old” computers
• Paper tape, punched cards, etc.
30. Input and Output
CS-3013 A-term 2009 30
Programmed I/O vs. Interrupt-driven I/O
• Programmed I/O
• A process or thread pro-actively works the device,
gets or puts the data, does everything else.
• Interrupt-driven I/O
• Device operates autonomously, let’s processor know
when it is done or ready
• Both
• CPU participates in transfer of every byte or word.
32. Input and Output
CS-3013 A-term 2009 32
DMA Interrupt Handler
• Service Routine – top half (interrupts disabled)
– Does as little work as possible and returns
• (Mostly) notices completion of one transfer, starts another
• (Occasionally) checks for status
• Setup for more processing in bottom half
• Service Routine – bottom half (interrupts enabled)
– Compiles control blocks from I/O requests
– Manages & pins buffers, translates virtual to physical
addresses
– Posts completion of transfers to requesting applications
• Unpin and/or release buffers
– Possibly in a kernel thread
33. Input and Output
CS-3013 A-term 2009 33
DMA example — Streaming tape
• Requirement
• Move data to/from tape device fast enough to avoid stopping
tape motion
• Producer-consumer model between application
and bottom-half service routine
• Multiple actions queued up before previous action is
completed
• Notifies application of completed actions
• Top half service routine
• Records completion of each action
• Starts next action before tape moves too far
• Result:–
• Ability to read or write 100’s or 1000’s of megabytes without
stopping tape motion
34. Input and Output
CS-3013 A-term 2009 34
Other DMA examples
• Disks, CD-ROM readers, DVD readers
• Ethernet & wireless “modems”
• Tape and bulk storage devices
• Common themes:–
• Device controller has space to buffer a (big) block of data
• Controller has intelligence to update physical addresses and
transfer data
• Controller (often) has intelligence to interpret a sequence of
control blocks without CPU help
• CPU does not touch data during transfer!
Not GUIs
35. Input and Output
CS-3013 A-term 2009 35
Digression:
Error Detection and Correction
• Most data storage and network devices have
hardware error detection and correction
• Redundancy code added during writing
• Parity: detects 1-bit errors, not 2-bit errors
• Hamming codes
– Corrects 1-bit errors, detects 2-bit errors
• Cyclic redundancy check (CRC)
– Detects errors in string of 16- or 32-bits
– Reduces probability of undetected errors to very, very low
• Check during reading
• Report error to device driver
• Error recovery:– one of principal responsibilities
of a device driver!
36. Input and Output
CS-3013 A-term 2009 36
Overview
• What is I/O?
• Principles of I/O hardware
• Principles of I/O software
• Methods of implementing input-output activities
• Organization of device drivers
• Specific kinds of devices
(Tanenbaum, Chapter 5)
37. Input and Output
CS-3013 A-term 2009 37
Device Drivers
• Organization
• Static or dynamic
• Uniform interfaces to OS
• Uniform buffering strategies
• Hide device idiosyncrasies
38. Input and Output
CS-3013 A-term 2009 38
Device Drivers
• Device Drivers are dependent on both the OS & device
• OS dependence
– Meet the interface specs of the device independent layer
– Utilize the facilities supplied by the OS – buffers, error codes, etc.
– Accept and execute OS commands – e.g. read, open, etc.
• Device Dependent
– Actions during Interrupt Service routine
– Translate OS commands into device operations
• E.g read block n becomes a series of setting and clearing and
interpreting device registers or interfaces
– Note that some device drivers have layers
• Strategy or policy part to optimize arm movement or do retries; plus a
mechanism part the executes the operations
39. Input and Output
CS-3013 A-term 2009 39
OS Responsibility to Device Driver
• Uniform API
• Open, Close, Read, Write, Seek functions
• ioctl function as escape mechanism
• Buffering
• Kernel functions for allocating, freeing, mapping, pinning
buffers
• Uniform naming
• /dev/(type)(unit)
– type defines driver; unit says which device
• Other
• Assign interrupt level (IRQ)
• Protection (accessibility by application, user-space routines)
• Error reporting mechanism
40. Input and Output
CS-3013 A-term 2009 40
Abstract Overview
• Think of I/O subsystem as a Java-style class
• Uniform interface in form of specific operations
(methods) and services
• Uniform state information
• Each I/O driver implements a subclass
• Own methods for uniform interface
• Additional state info & methods for specific needs
• However, no Java support in kernel
• Must implement everything in long-hand in C
41. Input and Output
CS-3013 A-term 2009 41
Uniform API and Buffering Example
Memory-mapped Keyboard
• /dev/kb
• Device interrupt routine detects key transitions
• Driver converts sequence of transitions into
characters in user’s written language
• Characters placed sequentially in buffer
• Accessible by read()
• Application calls getchar() or get()
• Library routines implemented with read()
• Provides uniform input stream semantics
42. Input and Output
CS-3013 A-term 2009 42
Buffering
• DMA devices need memory to read from,
write to
• Must be contiguous pages
• (Usually) physical addresses
• Double buffering
• One being filled (or emptied) by device
• Other being emptied (or filled) by application
• Special case of producer-consumer with n = 2
43. Input and Output
CS-3013 A-term 2009 43
Installing Device Drivers
• Classic Unix
• Create and compile driver to .o file
• Edit and re-compile device table to add new device
• Re-link with .o files for OS kernel new boot file
• Classic Macintosh
• Submit to Apple for verification, approval, and inclusion
• MS-DOS and Windows
• Dynamic driver loading and installation
• Special driver-level debuggers available; open device environment
• Certification program for trademarking
• Linux
• Dynamic driver loading and installation
• Open device environment
44. Input and Output
CS-3013 A-term 2009 44
Operating System Organization
Kernel
System Libraries (user space)
Utilities, tools, Window
packages, program
management, other stuff
Drivers & modules File Systems
45. Input and Output
CS-3013 A-term 2009 45
Installing Device Drivers
• Classic Unix
• Create and compile driver to .o file
• Edit and re-compile device table to add new device
• Re-link with .o files for OS kernel new boot file
• Classic Macintosh
• Submit to Apple for verification, approval, and inclusion
• MS-DOS and Windows
• Dynamic driver loading and installation
• Special driver-level debuggers available; open device environment
• Certification program for trademarking
• Linux
• Dynamic driver loading and installation
• Open device environment
Reason why Windows
won Battle of the Desktop
46. Input and Output
CS-3013 A-term 2009 46
Dynamic Device Configuration
• At boot time:–
1. Probe hardware for inventory of devices &
addresses
2. Map devices to drivers (using table previously
created)
3. Load necessary drivers into kernel space, register
in interrupt vector (.sys files in Windows)
• Run time:–
1. Detect interrupt from newly added device
2. Search for driver, or ask user; add to table
3. Load into kernel space, register in interrupt vector
47. Input and Output
CS-3013 A-term 2009 47
Probing for devices
• (Most) bridge and bus standards include
registration protocol
• [vendor, device ID]
• OS (recursively) tests every addressable
connection
• If device is present, it responds with own ID
• Performed both at
• Boot time: to associate drivers with addresses
• Installation time: to build up association table
48. Input and Output
CS-3013 A-term 2009 49
Allocating and Releasing Devices
• Some devices can only be used by one
application at a time
• CD-ROM recorders
• GUI interface
• Allocated at Open() time
• Freed at Close() time
49. Input and Output
CS-3013 A-term 2009 50
User Space I/O Software
(Daemons and Spoolers)
• Device registers mapped into virtual address
space of daemon process
• Controlled directly by daemon
• Top-half service routine
• Handles interrupts
• Signals via semaphores or monitors
• Bottom-half service routine
• The daemon itself!
• Waits for signals or monitors
• Manages device and requests from outside kernel
50. Input and Output
CS-3013 A-term 2009 51
User Space I/O example
Print Spooler
• /dev/lpt is a “virtual” device available to every process &
user
• Driver causes
– “Printing” to spool file
– Control info to spooler daemon
• Printer selection, options, and parameters
• Spooler selects one print “job” at a time
– Prints from spool file to physical device
• Types of printing
– Simple character strings separated by n characters
– Stream of PCL or inkjet commands
– Postscript files
– …
51. Input and Output
CS-3013 A-term 2009 52
Overview
• What is I/O?
• Principles of I/O hardware
• Principles of I/O software
• Methods of implementing input-output activities
• Organization of device drivers
• Specific kinds of devices
(Tanenbaum, Chapter 5)
52. Input and Output
CS-3013 A-term 2009 53
Character Terminal
• Really two devices
• Keyboard input
• Character display output
• /dev/tty (Unix) or COM (Windows)
• The classic input-output terminal
• RS-232 standard
• Modes
• raw
• cooked (aka canonical) – with backspace correction, tab
expansion, etc.
• Printed output vs. CRT display
53. Input and Output
CS-3013 A-term 2009 54
A special kind of Device
The Graphical User Interface
• aka, the bitmapped display
• In IBM language:– “all points addressable”
• 300K pixels to 2M pixels
• Each pixel may be separated written
• Collectively, they create
• Windows
• Graphics
• Images
• Videos
• Games
54. Input and Output
CS-3013 A-term 2009 55
GUI Device — early days
• Bitmap in main memory
• All output via library routines to bitmap
• Entirely (or mostly) in user space
• Controller, an automaton to do:–
• D-A conversion (digital to analog video)
• 60+ Hz refresh rate
• “clock” interrupt at top of each frame
Main Memory
CPU
Bitmap Digital to
Analog
55. Input and Output
CS-3013 A-term 2009 56
GUI Device — Displaying Text
• Font: an array of bitmaps, one per character
• Designed to be pleasing to eye
• bitblt: (Bit-oriented Block Transfer)
• An operation to copy a rectangular array of pixels
from one bitmap to another
A B C D E F …
Bitmap
bitblt
Dog
56. Input and Output
CS-3013 A-term 2009 57
GUI Device – Color
• Monochrome: one bit per pixel
• foreground vs. background
• Color: 2-32 bits per pixel
• Direct vs. Color palette
• Direct: (usually) 8 bits each per Red, Green, Blue
• Palette: a table of length 2p, for p-bit pixels
Each entry (usually) 8 bits each for RGB
57. Input and Output
CS-3013 A-term 2009 58
GUI Device – Cursor
• A small bitmap to overlay main bitmap
• Hardware support
• Substitute cursor bits during each frame
• Software implementation
• Bitblt area under cursor to temporary bitmap
• Bitblt cursor bitmap to main bitmap
• Restore area under cursor from temporary bitmap
• Very, very tricky!
• Timing is critical for smooth appearance
• Best with double-buffered main bitmap
58. Input and Output
CS-3013 A-term 2009 59
GUI Device – Window
• A virtual bitmap
• size, position, clipping boundaries
• font, foreground and background colors
• A list of operations needed to redraw contents
• Operations to window itself:–
• write(), refresh()
Called by application to
add/change information
Called by window manager to
redraw current contents
59. Input and Output
CS-3013 A-term 2009 60
GUI Device — Text Window
• Character terminal emulated in a window
• RS-232 character set and controls
• /dev/tty
• Operates like a character terminal with
visible, partially obscured, or completely
covered
60. Input and Output
CS-3013 A-term 2009 61
Modern GUI Devices
ISA
bridge
IDE
disk
Main
Memory
CPU
Level
2
cache
Bridge
Moni-
tor
Graphics
card
USB
Key-
board
Mouse
Ether-
net
SCSI
Modem
Sound
card
Printer
PCI bus
ISA bus
AGP Port
61. Input and Output
CS-3013 A-term 2009 62
Modern GUI Devices (continued)
• Double-buffered bitmap in Graphics card
• Graphics and information written/drawn in back buffer
• Monitor refreshes from main buffer (60+ Hz)
• Refresh interrupt at start of every frame
• Bitblt to substitute cursor
• CPU writes text, etc.
• Graphics processor (GPU) draws images, vectors, polygons
• Window manager orders redraw when necessary
CPU Bridge
Moni-
tor
Graphics
card