-4

Operating System Concepts says:

Devices vary on many dimensions, as illustrated in Figure 13.7.

• Character-stream or block. A character-stream device transfers bytes one by one, whereas a block device transfers a block of bytes as a unit.

• Sequential or random access. A sequential device transfers data in a fixed order determined by the device, whereas the user of a random-access device can instruct the device to seek to any of the available data storage locations

enter image description here

Does block device imply random access?

Does random access imply block device?

Does character device imply sequential access?

Does sequential access imply character device?

Thanks.

closed as too broad by muru, RalfFriedl, user88036, Isaac, Jeff Schaller Oct 2 '18 at 10:01

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Block devices are seekable, which means random access from the point of view of the user. The actual implementation may be sequential, for example some tape device where any movement backward from the current position might require rewinding the tape to the beginning and then moving forward. A character device may or may not be seekable. – Mark Plotnick Oct 2 '18 at 16:40
  • @MarkPlotnick Thanks. Do you mean that a user of a device should notice the difference between block and character devices, but not the difference between sequential and random access? – Tim Oct 2 '18 at 16:47
  • @Mark Will a user of linux or programmer of Linux API notice the difference between block and character devices, but not the difference between sequential and random access? – Tim Oct 2 '18 at 17:20
  • Block and character devices overlap in only a few areas - tapes and disks - and the only real visible difference is that block devices use the buffer cache and character devices don't. (And some block device drivers may offer the option of bypassing the buffer cache on a per-file basis). A user/programmer may or may not notice that a device is random access or sequential. It's up to the driver to either hide or expose the device's seekability. – Mark Plotnick Oct 2 '18 at 17:55
  • @Mark Thanks. "Block devices are seekable, which means random access from the point of view of the user. The actual implementation may be sequential," Is it correct that block/character device is at a higher level than sequential/random access? If a user can notice sequential/random access of a device, then he can also see whether the device is block/character device? But not the other way around? – Tim Oct 2 '18 at 17:58
3

Does block device imply random access?

No, e.g. rewind-only tape with block structure.

Does random access imply block device?

No, though I can't think of an existing character-stream device with random access. But SSDs and Flash-ROMs in general allow character-specific reading and writing, though only block-specific erasing (which shows that devices can vary in even more dimensions).

Does character device imply sequential access?

That's equivalent to the second implication (by contraposition).

Does sequential access imply character device?

This is equivalent to the first implication.

Not the answer you're looking for? Browse other questions tagged or ask your own question.