Re: file I/O and block I/O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/5/15 Sushil Patil <sushilpa@xxxxxxxxx>:
> Hi,
>
>>
>> Is Block I/O necessarily a SCSI thing? I thought 'dd' command could be
>> used for block I/O over devices like floppy, CDROM, and IDE device?
>> Am I wrong?
>
> File I/O is an I/O which is thought to be happening on logical entity
> "file".This is
> purely an user level interpretation of data which file-systems portrays .
>
> As its name indicates Block I/O is the chunked I/O.Its the thing that
> happens between file-system
> and the block-device (maybe routed via volume manager).
>
> The File I/O request is translated into Block I/O request when it comes to
> _actually_ reading/writing data from/to the disk.This block I/O can be
> cached I/O
> or non-cached (unbuffered) I/O (DIRECT I/O).
>
> The data is read or written in chunks (called  blocks) from disk for
> efficiency reasons.
>
> I hope now file i/o and block i/o are somewhat clearer :)
>
> ~Sushil

Un*x systems has two main abstractions (the upper level ones): files
and prcesses. By this way, devices are represented as files (remember
/dev?), and then, there are two kinds (flavors) of devices: char
devices, and block devices.

Char devices are the simpler ones, since that char devices I/O is
based on a stream of bytes received and sent by the device driver. On
the other side, block devices relies on specialized structures (the
page cache, the inodes and dentries), and operates via blocks
(mappings of disk sectors indeed), being able to seek over the mapped
region for instance (as opposed to char devices, constrained to
streamed bytes). The block operations are designed and implemented in
order to surpass the brutal difference among timings regarding memory
operations and disk operations, buffering data to optimize writes and
seeks on the slower disk I/O.

Then, file I/O can be block I/O or not, depending on the nature of the
file. Think on a disk file (manifestly block, since it lives inside a
hard drive or something similar), and a network socket. Beautiful
architecture that one used by U*ix :)


Best regards
Mauad

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux