Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to understand 'transparent' in this statement?

6 views
Skip to first unread message

fl

unread,
Apr 19, 2013, 10:33:59 PM4/19/13
to
Hi,
I read the following on a book on Linux device driver.

............
Like a char device, each block device is accessed through a filesystem node, and the difference between them is transparent to the user. Block drivers have a completely different interface to the kernel than char drivers.
........

'transparent' is often used in computer related topics. Sometimes it seems clear to me, sometimes it does not. The above means that char device and block device is the same to 'the user'? But, it then says that the interface is very different to the kernel. Maybe device driver has two interfaces? One is to the kernel while the other to the user? From my limited knowledge about device driver, I think that it has two interface. One is to the hardware while the other is to the user. Device driver is part of a kernel.

Could you correct me what is wrong with my thoughts?

Thanks,

The Natural Philosopher

unread,
Apr 19, 2013, 11:29:07 PM4/19/13
to
what they are trying to say is that the whole point of the operating
system is to shield the user from the underlying complexity of the
device in question.

that means that the operating system knows that the device is block or
character based, and the interface to and from the driver that handles
the interface between the hard ware and the operating system is
specialised, unique to the hardware, and radically different for block
devices, but that is all *hidden* from the user. An odd use of the word
transparent. :-)

So in practice a user will open read write and close a a block device
as if it were a character based device. The only difference being that
attempts to SEEK on a character device will fail.

I.e. the transparency refers the fact that (seek excepted) the user
doesn't know or need to know whether its a character or a block device
he is accessing.

of course you can't hide all the differences entirely. character devices
have limited buffering and if they arereceiving data at some point there
is a 'use it or lose it' aspect to them.






--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

Richard Kettlewell

unread,
Apr 20, 2013, 3:39:58 AM4/20/13
to
The Natural Philosopher <t...@invalid.invalid> writes:
> So in practice a user will open read write and close a a block device
> as if it were a character based device. The only difference being that
> attempts to SEEK on a character device will fail.

Seeking works fine on those character devices for which it makes sense,
e.g. /dev/mem or /dev/zero.

--
http://www.greenend.org.uk/rjk/

Richard Kettlewell

unread,
Apr 20, 2013, 4:52:26 AM4/20/13
to
The interface to user processes is part of the kernel: the
implementations of the read and write syscalls, among others.
Transparency in this case means you use the same calls to read any kind
of device or file (or to write, etc).

It breaks down somewhat as you get to more device-specific operations
(e.g. you can’t apply TIOCGWINSZ to a hard disk) but there’s still
enough commonality of behavior that the commonality of interface is
useful.

Device drivers support these operations via various kernel interfaces -
file_operations, tty_operations and block_device_operations being three
examples.

These interfaces are layered. read() always starts with file_operations
but the code it calls via that interface may in turn use some other
interface. For instance all terminals share the same file_operations,
which points at the generic tty code, but have different tty_operations,
depending on whether they are a serial port, a virtual console, a pty,
etc.

The situation for block devices is similar, though a bit more complex.

“Character devices” don’t really form a very coherent collection.
/dev/mem is quite unlike a tty, for instance. If it weren’t for the
fact that stat() identifies devices via a (type, major, minor) triple
the distinction might not have been preserved in this form.

--
http://www.greenend.org.uk/rjk/

The Natural Philosopher

unread,
Apr 20, 2013, 8:14:50 AM4/20/13
to
fair point. I had forgotten those
0 new messages