Newsgroups: comp.os.minix
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!EU.net!sun4nl!cs.vu.nl!kjb
From: kjb@cs.vu.nl (Kees J. Bot)
Subject: Re: Minix success report and questions
Nntp-Posting-Host: hornet.cs.vu.nl
References: <JCH.95Sep2180453@maddalena.dm.unibo.it> <DEDupu.5B0@crash.cts.com>
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Tue, 5 Sep 1995 11:05:13 GMT
Message-ID: <DEFIsq.2xL.0.-s@cs.vu.nl>
Lines: 52

cwr@crash.cts.com (Will Rose) writes:

>Juliusz Chroboczek (jch@dm.unibo.it) wrote:

>: o The Unices I know have two sets of devices for disks -- raw and
>:   cooked.  Why doesn't Minix need that?

>Well, it has hd0 for the disk and hd1...4 for the filesystems.
>Is that what you mean?  I've usually seen cooked applied to tty
>output, so I'm missing something.

I think Juliusz means "Why are there no disk character devices?"  The
answer is that Minix can handle them fine, but that I saw no reason
whatsoever to complicate things by including them.

I often use 'mknod rhd0 c 3 0' to create a raw disk device for
throughput testing.  That's the only good use for them.

Some background for those interested:
UNIX systems have two kinds of devices: block and character devices.
Block devices have block buffering imposed on them by the file system.
Block devices can hold file systems.  Examples:

	brw-rw-rw-  1 root       2,   0 Apr 28 10:48 fd0
	brw-------  1 root       3,   0 Apr 19  1994 hd0
	brw-------  1 root       3,   2 Dec 18  1992 hd2
	brw-------  1 root       3, 157 Nov 30  1992 hd9b
	brw-------  1 root       1,   0 Nov  1  1993 ram

(The last one is the RAM disk.  It is a block device to make FS happy.)

Character devices offer direct unbuffered I/O to a device, for instance
RS232 lines, the printer, tape drives, and /dev/null.  None of these can
be buffered, for they often do not allow random access.  Examples:

	crw-------  1 root       4,   0 Aug 31 08:01 console
	crw-r-----  1 root       1,   2 Nov 30  1992 kmem
	c-w-------  1 daemon     6,   0 Nov 30  1992 lp
	crw-rw-rw-  1 root       1,   3 Sep  5 12:44 null
	crw-rw----  1 root      10,  73 Dec 15  1994 rst4

Now if you make character devices for what are normally block devices
then you can access disks and such without intervention from FS.  You
have to make sure that you read and write the device using disk block
size multiples at a block boundary.  This can be quite fast.

(This leads to the strange situation that block devices can be accessed
byte by byte, and characters devices must be accessed a block by block.
(No, I wasn't the first to think this up.))
--
	                        Kees J. Bot  (kjb@cs.vu.nl)
	              Systems Programmer, Vrije Universiteit Amsterdam
