Transcription and Subtitles
- 63Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
Why must an operating system support many different types of input/output devices?
63 questions
- 1
Why must an operating system support many different types of input/output devices?
Model answer
Different devices vary in how they connect, their speed, the direction of data transfer, and how users and applications interact with them.
Explanation
An operating system must coordinate devices ranging from fast SSDs to slow printers and tapes, including input-only, output-only, and two-way devices.
- 2
What are the three main hardware components needed to support input/output devices?
Model answer
The system needs hardware devices and controllers, connections such as ports and buses, and mechanisms for transferring and controlling data.
Explanation
These components allow different devices to communicate with the operating system despite their differing characteristics.
- 3
What is the purpose of a device controller?
Model answer
A device controller manages the operation of a particular type of I/O device and handles its device-specific hardware functions.
Explanation
Controllers may contain control electronics, codes, registers, memory, buffers, or caches suited to the device.
- 4
Why are controllers for different devices usually different?
Model answer
Different devices perform different functions and communicate in different ways, so each requires hardware designed for its specific operations.
Explanation
For example, a USB mouse, thumb drive, and foot pedal can use the same connector but require different controllers.
- 5
What is the role of a data bus in an I/O system?
Model answer
The data bus provides the shared pathway over which data moves between the CPU, memory, controllers, and connected devices.
Explanation
Many different devices may use the same bus, so the system must coordinate access when several need to transfer data.
- 6
How can many different devices use the same connector, such as USB?
Model answer
The connector and bus provide a common communication interface, while the device controller handles the unique behavior of each attached device.
Explanation
Keyboards, phones, webcams, storage devices, and other peripherals can share USB because their device-specific controllers interpret the transferred data.
- 7
What is an expansion bus used for?
Model answer
An expansion bus connects peripheral interfaces to the computer's main bus, allowing additional devices to communicate with the system.
Explanation
For example, USB devices can connect through an expansion bus that ultimately connects to the PCI bus.
- 8
Why can multiple devices attempting to use one bus create a problem?
Model answer
Because the bus is shared, simultaneous requests must be coordinated; otherwise, devices may compete for access or data transfers may conflict.
Explanation
The operating system and hardware use control mechanisms to determine which device can communicate and when.
- 9
What is a device driver?
Model answer
A device driver is operating-system software that communicates with and controls a specific type of hardware device.
Explanation
It accounts for the device's particular setup, functions, and connection requirements.
- 10
Why is a device driver needed when a new device is installed?
Model answer
The operating system needs software that understands how to communicate with and control that particular device.
Explanation
Drivers may be required for external devices such as mice and printers as well as internal devices such as graphics cards and disks.
- 11
How do registers support I/O operations?
Model answer
Registers hold data being read or written and store control or status information about the device.
Explanation
A controller may use registers to hold incoming data, outgoing data, and information such as whether the device is currently in use.
- 12
Why must an operating system track whether an I/O device is currently in use?
Model answer
It must prevent conflicting processes from accessing the same device simultaneously when that could corrupt data or produce incorrect output.
Explanation
For example, allowing two applications to write to a printer at once could produce jumbled output.
- 13
What is memory-mapped I/O?
Model answer
Memory-mapped I/O represents device registers or locations as memory addresses, allowing ordinary memory instructions to read from or write to devices.
Explanation
Writing a value to a designated address can cause hardware such as a graphics adapter to perform an I/O action.
- 14
How would a graphics adapter use memory-mapped I/O to change a pixel?
Model answer
The system writes data representing a color to the memory address associated with the pixel, and the graphics hardware sends the corresponding information to the monitor.
Explanation
The device is controlled through an address that behaves like a memory location even though it represents an I/O operation.
- 15
How does direct I/O differ from memory-mapped I/O?
Model answer
Direct I/O uses special I/O instructions to communicate with a device, whereas memory-mapped I/O uses ordinary memory instructions and assigned memory addresses.
Explanation
The two approaches differ in how the CPU identifies and accesses device locations.
- 16
What are well-known I/O addresses?
Model answer
Well-known I/O addresses are predefined addresses associated with particular hardware devices or controllers.
Explanation
The operating system and hardware can use these known locations to communicate with devices such as interrupt controllers and graphics hardware.
- 17
What is polling in an I/O system?
Model answer
Polling is the process of repeatedly checking each device in turn to determine whether it has data or requires service.
Explanation
The CPU asks devices one after another whether they have something to report.
- 18
What is an interrupt in the context of I/O?
Model answer
An interrupt is a signal from a device to the CPU indicating that the device needs attention or has completed an operation.
Explanation
The device raises an interrupt line, causing the CPU to temporarily handle the device's request.
- 19
Compare polling and interrupts as methods for detecting device activity.
Model answer
Polling makes the CPU check devices repeatedly, while interrupts allow a device to notify the CPU when service is needed.
Explanation
Polling can be acceptable for a small, predictable set of fast devices, whereas interrupts avoid constant checking and reduce the risk of delayed responses.
- 20
Why can polling be inefficient when there are many devices?
Model answer
A slow or lengthy request from one device can delay the CPU from checking other devices, potentially causing important incoming data to be missed.
Explanation
For example, data arriving from a keyboard or network may be lost if polling reaches that device too late.
- 21
Describe the basic sequence that occurs when a keyboard generates an interrupt.
Model answer
The keyboard raises an interrupt, the CPU runs the keyboard interrupt handler, and the handler retrieves the character and places it in a buffer before the CPU resumes its previous process.
Explanation
The handler should perform the minimum necessary work and leave later processing to the process that uses the keyboard input.
- 22
Why does an interrupt handler store keyboard input in a buffer instead of processing it fully?
Model answer
Storing the character quickly allows the CPU to return to the interrupted process while the appropriate application processes the input later.
Explanation
Interrupt handlers should be small, compact, and fast to minimize disruption to normal execution.
- 23
What is the purpose of an interrupt controller?
Model answer
An interrupt controller receives interrupt requests and helps determine how they are presented to and prioritized by the CPU.
Explanation
It coordinates requests from many devices that may need CPU attention.
- 24
Can an interrupt handler itself be interrupted?
Model answer
Sometimes; some interrupts are defined as interruptible, while others are temporarily protected from interruption.
Explanation
Whether nesting is allowed depends on the interrupt's type and priority.
- 25
What is a maskable interrupt?
Model answer
A maskable interrupt is an interrupt that the CPU can temporarily ignore or disable.
Explanation
Masking is useful when the CPU must protect a critical operation or prioritize a more important interrupt.
- 26
What is a non-maskable interrupt?
Model answer
A non-maskable interrupt is an interrupt that the CPU cannot ignore and must service.
Explanation
Non-maskable interrupts are reserved for events that require guaranteed attention.
- 27
Why are interrupt priorities needed?
Model answer
Priorities determine which interrupt should be serviced first when multiple devices or events request CPU attention.
Explanation
Some events are more urgent than others, so the system cannot always treat all interrupt requests equally.
- 28
What types of events can be represented by interrupts besides device requests?
Model answer
Interrupts can also represent exceptions, such as divide errors, debugging events, breakpoints, page faults, and floating-point errors, as well as system calls.
Explanation
The interrupt mechanism provides a general way to transfer control to an appropriate handler when special events occur.
- 29
What is direct memory access, or DMA?
Model answer
DMA is a method in which a hardware controller transfers a block of data between a device and memory without requiring the CPU to manage every individual word.
Explanation
The CPU specifies the transfer details and is notified by an interrupt when the transfer completes.
- 30
Why is DMA especially useful for disk transfers?
Model answer
Disks often transfer large blocks of data, so DMA avoids the overhead of making the CPU handle each word individually.
Explanation
The CPU can request a block transfer, continue other work, and respond when the controller reports completion.
- 31
What information does the CPU provide when initiating a DMA transfer?
Model answer
The CPU specifies the amount of data, the source, and the destination, then allows the DMA controller to perform the transfer.
Explanation
The controller carries out the operation and later interrupts the CPU to report completion or an error.
- 32
What is the main disadvantage of DMA?
Model answer
DMA requires additional hardware in the form of a DMA controller, so it increases system cost and complexity.
Explanation
Although DMA improves transfer efficiency, the hardware needed to support it consumes resources.
- 33
What is a character device?
Model answer
A character device transfers data one character or unit at a time, typically as a sequential stream.
Explanation
Keyboards are an example because input arrives as individual keystrokes.
- 34
What is a block device?
Model answer
A block device transfers data in blocks of multiple bytes rather than one character at a time.
Explanation
Hard disks commonly transfer blocks such as disk sectors or larger groups of bytes.
- 35
What is the difference between sequential access and random access?
Model answer
Sequential access requires data to be accessed in order, while random access allows the system to access a chosen location directly.
Explanation
Tape drives and keyboard streams are sequential, whereas a disk or display can access or update selected locations.
- 36
How do synchronous and asynchronous I/O differ?
Model answer
Synchronous I/O waits for the requested operation to progress or complete, while asynchronous I/O allows the process to continue and receive notification later.
Explanation
Asynchronous I/O makes better use of CPU time but is more difficult to implement.
- 37
What is blocking I/O?
Model answer
Blocking I/O prevents the process from continuing until the I/O operation finishes.
Explanation
It is simple to implement because the process stops, performs the I/O, and resumes afterward, but it can be slow and inefficient.
- 38
What is non-blocking I/O?
Model answer
Non-blocking I/O allows a process to perform some work, return to execution, and later continue the transfer or check its progress.
Explanation
The system reports how much data was transferred so the process can issue or complete further operations.
- 39
Why is asynchronous I/O usually more resource-efficient than blocking I/O?
Model answer
Asynchronous I/O lets the CPU and process continue useful work while a slower device performs its transfer.
Explanation
The system receives notification when the operation completes instead of wasting time waiting.
- 40
Why might an I/O subsystem schedule access to a device?
Model answer
Scheduling can prevent conflicts, improve efficiency, and ensure that different processes receive fair access to a shared device.
Explanation
A printer, for example, may need requests ordered so that output does not become mixed together.
- 41
What is quality of service in an I/O subsystem?
Model answer
Quality of service is a guarantee that each process receives a specified share or amount of access to a resource.
Explanation
It can be used to enforce fairness when one process might otherwise monopolize a device.
- 42
What is buffering, and why is it used in I/O systems?
Model answer
Buffering uses memory between a device and the system to temporarily store data and accommodate differences in transfer speed or data size.
Explanation
A fast bus or CPU can continue working while a slower device fills or empties the buffer.
- 43
How can a device controller's buffer improve disk performance?
Model answer
The controller can collect a complete block from the disk and then transfer it rapidly to memory when the system is ready.
Explanation
This prevents the system from having to manage every small part of a slow disk transfer individually.
- 44
What is copy semantics in relation to I/O buffering?
Model answer
Copy semantics concerns which version of data is authoritative when the same data exists in multiple locations, such as a user buffer, system buffer, or cache.
Explanation
The system must determine which copy contains the latest changes and ensure that updates are transferred appropriately.
- 45
What is a device-status table?
Model answer
A device-status table records the devices connected to the system, their states, and information about processes or requests using them.
Explanation
It helps the operating system track requests, users, device characteristics, and resource availability.
- 46
Why might an I/O scheduler process a smaller request before an earlier larger request?
Model answer
Serving the smaller request first may free the device sooner and improve overall responsiveness or scheduling efficiency.
Explanation
I/O scheduling algorithms can choose an order based on efficiency or fairness rather than arrival time alone.
- 47
What is caching in an I/O system?
Model answer
Caching keeps recently accessed or likely-to-be-needed data in faster memory so it can be reused without accessing the slower device again.
Explanation
Caching improves performance when the same or nearby data is requested repeatedly.
- 48
How can buffering and caching exist together in one I/O operation?
Model answer
Data may first be held in a device buffer, copied into a cache, and then transferred to main memory or an application.
Explanation
Because several copies may exist simultaneously, the system must track which copy is current and which changes must be written back.
- 49
What is spooling?
Model answer
Spooling stores output as files in a queue so a process can continue while a slow, dedicated device processes the files later.
Explanation
Printing is a common example: applications place formatted print files in a spool queue, and the printer handles them sequentially.
- 50
Why is spooling useful for printers?
Model answer
It prevents applications from waiting for the slow printer and ensures that print jobs are organized in a queue.
Explanation
The printer reads each queued file in its required format and prints the jobs one at a time.
- 51
What is deadlock in the context of reserved I/O devices?
Model answer
Deadlock occurs when processes wait indefinitely for resources held by one another, so none can continue.
Explanation
For example, one process may hold a device while waiting for data from another process that is itself waiting for that device.
- 52
Why can reserving an I/O device for one process create problems?
Model answer
Exclusive reservation can prevent other processes from obtaining needed resources and may contribute to deadlock.
Explanation
The system must carefully manage ownership and release of reserved devices.
- 53
How should an I/O subsystem handle device errors?
Model answer
It must detect errors, decide whether to retry the operation, limit repeated failures, mark unusable areas, and report persistent problems when appropriate.
Explanation
Disk controllers may mark repeatedly failing blocks as bad so they are no longer used.
- 54
Why must an operating system protect I/O devices from direct process access?
Model answer
Protection prevents poorly behaved or malicious processes from bypassing the operating system and interfering with devices or other processes.
Explanation
I/O commands should pass through controlled system calls and kernel mechanisms rather than allowing unrestricted direct access.
- 55
What information must the kernel track to manage I/O devices?
Model answer
The kernel tracks connected devices, device types and speeds, current users, connection status, controllers, drivers, buffers, and other resource information.
Explanation
This information allows the kernel to coordinate access, perform transfers, handle errors, and enforce protection.
- 56
How can an operating system use object-oriented methods to implement I/O?
Model answer
It can represent files, devices, network connections, and related resources as objects that communicate through message passing.
Explanation
This approach organizes device records and interfaces while allowing different hardware types to be managed through common operations.
- 57
Why do network devices require additional interface support?
Model answer
Network communication involves protocols and connections that differ from local hardware access, so the operating system needs suitable network controllers, drivers, or socket interfaces.
Explanation
Network interfaces provide a layer between applications and the protocols used to communicate with remote systems.
- 58
What is the general sequence for reading a file from an I/O device?
Model answer
The system translates the file name into a device and location, requests the data through the I/O subsystem and device driver, places it in a buffer, and makes it available to the requesting process.
Explanation
The request passes through several layers, including the kernel, device driver, interrupt handler, and device controller.
- 59
Why does reading a file involve multiple operating-system layers?
Model answer
Each layer provides a different function, translating the user's file request into device-specific operations and then returning the data to the application.
Explanation
The path may include the file interface, I/O subsystem, kernel, device driver, interrupt handler, controller, and physical device.
- 60
Why is I/O generally slower than internal CPU or memory operations?
Model answer
I/O must pass through device controllers, drivers, buses, buffers, and sometimes networks, while external devices are often much slower than the CPU and memory.
Explanation
Caching, buffering, DMA, smarter controllers, and local copies are used to reduce this performance gap.
- 61
Why can cloud storage be slower to access than a local copy?
Model answer
Cloud storage requires data to travel over a network in addition to passing through the normal I/O layers, adding network delay.
Explanation
Services such as cloud drives may keep frequently used files locally and synchronize them with the remote copy to improve responsiveness.
- 62
How do DMA, buffering, and caching each improve I/O performance?
Model answer
DMA reduces CPU involvement in transfers, buffering accommodates speed differences, and caching avoids repeated access to slow devices by keeping data in fast memory.
Explanation
These mechanisms address different sources of delay but may be combined during one I/O operation.
- 63
Why must an I/O system coordinate both hardware and software?
Model answer
Hardware controllers and buses perform device operations, while the kernel, drivers, and applications request, organize, protect, and interpret those operations.
Explanation
Reliable I/O requires all layers to cooperate despite differences among devices and connection methods.

Ask anything
We've read this whole study set, so questions about it get the best answers.