Chapter 5
Chapter 5
Chapter 5
Block devices: is one that stores information in fixed-size blocks, each one with its
own address. Common block sizes range from 512 to 65,536 bytes. All transfers
are in units of one or more entire (consecutive) blocks. The essential property of a
block device is that it is possible to read or write each block independently of all
the other ones. Hard disks, Blu-ray discs, and USB sticks are common block
devices
Character devices: A character device deliv ers or accepts a stream of characters,
without regard to any block structure. It is not addressable and does not have any
seek operation
Example: . Printers, network interfaces, mice (for pointing), rats (for psychology
lab experiments), and most other devices that are not disk-like can be seen as
character devices
2, How does CPU communicate with control registers and data buffer?
With registers: Each controller has a few registers that are used for
communicating with the CPU. By writing into these registers, the operating system
can command the de vice to deliver data, accept data, switch itself on or off, or
otherwise perform some action. By reading from these registers, the operating
system can learn what the device’s state is, whether it is prepared to accept a new
command, and so on.
With data buffer: In addition to the control registers, many devices have a data
buffer that the op erating system can read and write which is basically just a data
buffer, available for programs or the operating system to write into.
3, What does a DMA contain? How does it work?
DMA contain memory addresses registered, counting bits, one or more controller
registers
When DMA is used, the procedure is different.
Step 1: . First the CPU programs the DMA controller by setting its registers so it
knows what to transfer where. It also issues a command to the disk controller
telling it to read data from the disk into its internal buffer and verify the checksum.
When valid data are in the disk controller’s buffer, DMA can begin.
Step 2: The DMA controller initiates the transfer by issuing a read request over the
bus to the disk controller. This read request looks like any other read request, and
the disk controller does not know (or care) whether it came from the CPU or from
a DMA controller.
Step 3: Typically, the memory address to write to is on the bus’ address lines, so
when the disk controller fetches the next word from its internal buffer, it knows
where to write it. The write to memory is another standard bus cycle
Step 4: When the write is complete, the disk controller sends an acknowl edgement
signal to the DMA controller, also over the bus.
Requesting Access:
The user process requests access to the printer by making a system call to open it. If the printer is
available, the call succeeds, otherwise, it may block until the printer becomes available.
Copying Data to Kernel Space:
Once access is granted, the user process requests the operating system to print a string on the
printer.
The operating system copies the string from the user buffer to a kernel buffer for easier access.
Checking Printer Status:
The operating system checks if the printer is available. If not, it waits until it becomes available.
When the printer becomes available, the operating system copies the first character from the
kernel buffer to the printer's data register, activating the printer.
Printing Characters:
The operating system continuously checks the status of the printer to see if it's ready to accept
another character.
When the printer is ready, the operating system sends the next character from the kernel buffer to
the printer's data register.
This process repeats until all characters in the string have been printed.
Returning Control:
Once all characters have been printed, control returns to the user process.
Busy Waiting:
During this entire process, the CPU is actively involved in checking the printer status and
sending characters to the printer.
This method ties up the CPU until all I/O operations are complete, making it inefficient in
systems where the CPU has other tasks to perform.
Operates on a word or byte basis with Hamming code for error correction.
Data is divided into words or bytes and spread across multiple disks.
Requires synchronized drives and works with parity bits.
RAID level 3: