

ram                       Device Driver                       ram




RAM device driver


The COHERENT  ram devices allow the user to  allocate and use the
random access  memory (RAM) of  the computer system  directly.  A
typical use  is for a RAM  disk, which is a  COHERENT file system
kept in memory rather than on a diskette or hard disk.

The COHERENT RAM device driver has major number 8.  It can be ac-
cessed either as a block-special device or as a character-special
device.   The high-order  bit  of the  minor number  gives a  RAM
device number (0 or 1), allowing the use of up to two RAM devices
simultaneously.  The low-order seven bits specify the device size
in 64  KB (128 block) increments.   The first open call  on a RAM
device  with nonzero  size (1  to 127)  allocates memory  for the
device; the  open call fails  if sufficient memory  is not avail-
able.  Accessing a RAM device with a minor number specifying size
0  frees the  allocated memory, provided  all earlier  open calls
have been closed.

Initially, COHERENT includes  two RAM block devices, 512KB device
/dev/ram0 (8,  8) and 192KB  device /dev/ram1 (8,  131).  It also
includes /dev/ram0close (8,  0) and /dev/ram1close (8, 128).  The
system administrator  should change the RAM  devices to sizes ap-
propriate for available system memory.

***** Note *****

The  COHERENT  installation program  /etc/build  uses RAM  device
/dev/ram1 as a  RAM disk during installation.  Programs compress,
uncompress, zcat and  fsck sometimes use /dev/ram1 as a temporary
storage device.  Users should avoid using /dev/ram1 as a RAM disk
because of these programs.

***** Examples *****

The following example  formats and mounts a 512-kilobyte RAM disk
on directory /fast.


        mkdir /fast
        /etc/mkfs /dev/ram0 1024
        /etc/mount /dev/ram0 /fast


When the  RAM disk is no longer needed,  its allocated memory can
be freed as follows:


        /etc/umount /dev/ram0
        cat /dev/null >/dev/ram0close





COHERENT Lexicon                                           Page 1




ram                       Device Driver                       ram



The  next example  replaces  the default  /dev/ram0  with a  one-
megabyte device containing a COHERENT file system.  The new minor
number 16  specifies RAM device 0 and size  16 times 64 kilobytes
(i.e., one  megabyte).  The new RAM  device contains 2,048 blocks
of 512 bytes each.


        rm /dev/ram0
        /etc/mknod /dev/ram0 b 8 16
        /etc/mkfs /dev/ram0 2048


***** Files *****

/dev/ram*

***** See Also *****

compress, device drivers,  fsck, mkfs, mount, umount, uncompress,
zcat

***** Notes *****

Moving frequently  used commands or  files to a RAM  disk can im-
prove system performance substantially.  However, the contents of
a  RAM device  are lost  if the system  loses power,  reboots, or
crashes, so changes to files kept  on a RAM disk should be stored
frequently to the hard disk or to diskette.

If a RAM device uses most but not all of available system memory,
its open  call will succeed but subsequent  commands may fail be-
cause insufficient memory remains for the system.

























COHERENT Lexicon                                           Page 2


