Block device stores information in fixed size blocks. Operating system assigns address to each block. A Block device is one with which the driver communicates by sending entire blocks of data.
Application I/O Interface
• I/O devices are of two types:
1. Block devices 2. Character devices
• Block device stores information in
fixed size blocks. Operating system assigns address to each block. A Block
device is one with which the driver communicates by sending entire blocks of
data. Examples for block devices: hard disks, USB cameras, Disk-On-Key.
• A block device is a device (e.g., a
disk) that can host a file system. In UNIX systems, a block device can
only handle I/O operations that transfer one or more whole blocks, which are
usually 512 bytes in length.
• Every block device driver must provide
an interface to the buffer cache as well as at the normal file operations
interface. Each block device is identified by major and minor numbers.
• Block devices are characterized by
the capability to read and write blocks of data to and from random locations on
an addressable medium. Examples of block devices include hard drives and USB
Flash drives.
• Block and character devices are
represented for user space applications as files than can be manipulated using
the traditional file API.
• A character device is one with which
the driver communicates by sending and receiving single characters. Examples
for character devices es serial ports, parallel ports and sound cards.
• The only difference between a
character device and a regular file is that, user can always move back and
forth in the regular file, whereas most character devices are just data
channels, which user can only access sequentially. User can perform mmap and
lseek operation on the character device.
• Character
devices can be thought of as serial streams of sequential data. Examples of
character devices include serial ports and keyboards.
• Linux supports loadable device
drivers, it is relatively easy to demonstrate a simple device driver skeleton.
A device driver is a special kind of binary module. Unlike a stand-alone binary
executable application, a device driver cannot simply be executed from a
command prompt.
•
Character device drivers are referenced through special files in the file
system. This file is stored in the /dev folder. The command "Is -l"
is used to check the folder. The character "c" in the file listing
indicates the file is a char device. It also contains device major and minor
numbers.
• Network devices are deal differently
from block and character devices. But these devices operate like I/O devices.
User can not directly transfer data to network devices.
• Socket interface is used for
communicating with network devices. Data can be put into the socket at one end,
and read out sequentially at the other end. Sockets are normally full-duplex,
allowing for bi-directional data transfer.
• UNIX uses pipes, FIFO, streams, queue
and mailbox as a network device. Each network device is represented by a device
data structure. The device data structure contains information about the device
and the addresses of functions that allow the various supported network
protocols to use the device's services.
•
Network device drivers can be built into the Linux kernel. Each potential
network device is represented by a device data structure within the network
device list.
• Clocks are required in
multiprogramming environment. Computers have hardware clocks and timers.
•
Three types of time services are commonly needed in modern systems:
1.
Current time of day
2.
Elapsed time
3. Set a timer for particular event.
• Operating system used these function
for timer applications. When user creates a file, operating system record it
time and date.
• A Programmable Interrupt Timer (PIT)
can be used to trigger operations and to measure elapsed time. User process
uses timer by using operating system interface.
• Hardware clock is used to generate interrupt by operating
system. On most systems the system clock is implemented by counting interrupts
generated by the
Introduction to Operating Systems: Unit IV(a): Storage Management : Tag: : Storage Management - Introduction to Operating Systems - Application I/O Interface
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation