Cover V01, I04
Article
Figure 1
Figure 2
Figure 3
Figure 4
Listing 1
Sidebar 1

nov92.tar


Coherent 4.0 -- A Desktop UNIX Clone

David M. Knight

Coherent 4.0, the latest release of Mark Williams Company's $99 UNIX clone, is an unlimited-user, full 32-bit, "UNIX-compatible" OS and C development system that can run on almost any 386 or 486 PC compatible with 15 megabytes of extra disk space (10Mb for Coherent, 5Mb for your programs). Coherent can coexist with DOS, UNIX, OS/2, or Xenix partitions on the same disk and the Coherent "Master Boot" program allows boot-time selection of the boot partition.

Coherent 4.0 includes a comprehensive set of familiar UNIX commands, languages (awk, lex, m4, make, yacc, sed, etc.) as well as nroff and troff with HPLaserjet/PCL and Postscript printer support. Some of the commands reflect a BSD flavor -- script and ps, for example -- but most follow System V conventions.

The C development environment includes a very fast K&R (not ANSI) C compiler with math, lex, yacc, curses, term and termcap libraries. There is no C source-level debugger, though the literature reports that one is "in the works."

The "COHware" collection of software from public domain and other sources rounds out the package with such tools as:

cu -- UNIX communications utility ckermit -- Columbia U.'s communications package elm -- electronic mailer and utilities forth -- development language mc -- spreadsheet rcs -- Walter Tichey's RCS Revision Control System (Rev 4.6 in my copy) zip/unzip -- compression utilities

and a plethora of games, news readers, communications tools, and utilities. The Coherent brochure also states that GNU C, C++, gawk, bash, make, perl and other tools from the Free Software Foundation will be available soon.

Overview

Coherent 4.0 goes a long way toward resolving the most serious limitations of prior releases and introduces some major enhancements as well. Highlights include:

  • 32-bit "flat" memory model
  • UNIX System V source code compatibility
  • large filesystems on high performance SCSI disks
  • iBCS2 object compatibility
  • UNIX (COFF) binary compatibility
  • MS-DOS filesystem (up to DOS 3.x) access commands
  • termcap/terminfo support including tic, captoinfo, and infocmp
  • COFF compatible C compiler, assembler, and linker
  • System V advisory file/record locking
  • full 386 Macro Assembler
  • virtual consoles
  • a Korn Shell

    iBCS2 Binary Compatibility

    Coherent 4.0 iBCS2 binary compatibility makes it possible to run many "shrink wrapped" SCO or Interactive UNIX applications right out of the box. Classes of application binaries known not to work include all binaries containing hardware floating-point instructions and SCO Xenix binaries.

    When you are considering a PC UNIX application for possible use under Coherent, you must:

    Ensure that the executables are System V COFF binaries. SCO Xenix (Microsoft a.out) binaries and System V.4 ELF binaries will not run.

    Ensure that the binary executables do not use hardware floating-point instructions. Generally speaking, word processors, text processing utilities, and software development tools rarely use hardware floating-point instructions, while most engineering applications, graphics packages, and spreadsheets use them extensively. Databases and accounting programs may use hardware floating point for some datatypes and "decimal math" for others, particularly "money" datatypes.

    The hardware floating-point restriction also means that programs that automatically "sense" whether a floating-point coprocessor is installed will probably fail.

    Look for tar or cpio installation instructions. Coherent does not provide an equivalent to the SCO custom or the System V installpkg installation scripts.

    Anticipate modifying the installation procedure. For example, if an install script uses shell functions, it will need to be run under Coherent's Korn Shell.

    PC UNIX application binaries known to run include:

  • Acucobol's ACUCOBOL-85
  • VersaSoft dBMANV
  • Gimpel Software's FlexeLint
  • Promula Fortran Compiler and Application Dev. System
  • Xtree for UNIX (installation script had to be run with ksh)

    See the "Shortcomings" section below for more on application selection and compatibility issues.

    System V Source Compatibility

    Coherent's System V source compatibility allows many UNIX PC applications to port with just a recompile. During the Beta test, a public domain version of ctar compiled without change, while the GNU RCS (Rev 5.5) utilities port required only minor changes to the makefile and adding a _doprnt() function to the rcslex.c utility.

    Although Coherent does not currently support DOS-under-UNIX or direct mounting of MS-DOS filesystems, it does provide MS-DOS filesystem (up to version 5.0) access commands similar to those found in other UNIX packages. The doscpdir command, which copies subdirectories like the System V.4 dir_copy command, is unique to Coherent. DOS "drive letter" assignments and other configuration settings are declared in the /etc/default/msdos file.

    As delivered, Coherent supports four Virtual Console sessions on a color monitor and four sessions on a monochrome monitor. Up to eight sessions can be configured for a single monitor using the procedure described in the "System Tuning" section.

    Coherent 4.0 Performance

    The Beta test release documents and the Coherent 4.0 literature contain several statements comparing Coherent's C compiler and runtime performance to that of SCO, Interactive, and ESIX development systems. In particular, their runtime sort performance seemed extraordinary.

    Test Programs and Procedures

    To test the performance claims, I used two test programs

  • testqsort -- as published in a Coherent 4.0 document prepared for Byte Magazine and distributed as part of the Beta test package. The output of this program indicates its test strategy; Figure 1 shows the output from a test run on a 33 MHz 386dx machine.

  • a Dhrystone benchmark program -- as published in Byte Magazine (c. 1987). The quote from the source code shown in Figure 2 explains the structure of the program.

    and compiled them with various OS/compiler combinations

  • Coherent 4.0 / cc
  • Interactive Systems UNIX 2.2 / cc (AT&T)
  • Interactive Systems UNIX 2.2 / gcc (GNU cc)
  • SCO ODT 1.1.1 / cc (Microsoft C)
  • SCO ODT 1.1.1 / rcc (AT&T)

    to produce COFF binaries which would each be run on all of the platforms:

  • 386sx/16 4MB RAM - Coherent 4.0
  • 386dx/33 12MB RAM - Interactive UNIX 2.2
  • 386sx/25 8MB RAM - SCO ODT 1.1.1
  • 386sx/25 8MB RAM - Consensys V4 (AT&T UNIX System V.4)
  • 5. 486dx/33 16MB RAM - SCO ODT 1.1.1

    For an additional comparison, I also compiled and ran these benchmarks on UNIX System V.4 (Consensys V4). Although System V.4 ELF binaries will not run on the System V.3 systems, the COFF binaries do run on System V.4 and thus allow comparison of Coherent 4.0 with a state of the art UNIX System V/386.

    Executable Size Comparison

    The size comparison of the resulting executables (shown in Figure 3) supports statements made in the Coherent 4.0 literature.

    Compiler Performance

    Compilation time for the RCS utilities, adjusted for platform differences, ranks the compiler performance as follows:

    1.6 Coherent 4.0/cc (386sx/16 time = 6:57)
    3.3 ISC UNIX 2.2/cc (386dx/33 time = 3:26)
    4.6 SCO ODT 1.1.1/cc (486dx/33 time = 1:34)

    As a nonstandard (benchmark) but substantial compilation task, these results lend credibility to MWC's claim that the Coherent 4.0 C compiler outperforms SCO's cc compiler 3 to 1.

    QSORT Performance

    When the qsort tests were finally complete (on a lowly 386sx/16 it took over four days!) it was clear that Coherent 4.0 fixes a "merge" problem found in many UNIX System V.3 qsort library functions. Compare the output of the Coherent 4.0 executable (see Figure 4) to the output of the ISC cc executable run on the same machine and operating system (Figure 1).

    The average testqsort execution time (shown as the ratio run_time/fastest_time for each binary) across all 386/486 platforms tested, in order of fastest to slowest is:

    1 Coherent 4.0/cc (386dx/33 runtime = 1.01 minutes)
    10 Consensys V4 (System V.4)/cc
    187 ISC UNIX 2.2/gcc (GNU)
    203 ISC UNIX 2.2/cc (AT&T)
    339 SCO ODT 1.1.1/cc (Microsoft C)
    349 SCO ODT 1.1.1/rcc (AT&T) (386dx/33 runtime = 6.15 hours)

    AT&T UNIX System V.4 and BSD 4.x have also addressed the qsort problem, though not as successfully as Coherent.

    Dhrystone Performance

    The dhrystone tests tell a different story and one that is, unfortunately, more typical. The average relative speed (as the ratio dhrystonesPerSecond/fastest_dhrystonesPerSecond), across the 386/486 platforms tested, in order of fastest to slowest is:

    1.0 ISC UNIX 2.2/gcc (GNU) (386dx/33 dhrystones/second = 12690)
    1.0 Consensys V4 (System V.4)/cc
    0.9 SCO ODT 1.1.1/rcc (AT&T)
    0.8 SCO ODT 1.1.1/cc (Microsoft C)
    0.8 ISC UNIX 2.2/cc (AT&T)
    0.7 Coherent 4.0/cc (386dx/33 dhrystones/second = 8849)

    No floating-point tests were run because of Coherent's lack of FP hardware support.

    Reliability

    During my testing, Coherent appeared to be robust enough for a commercial platform. Indeed, during two weeks of intensive testing, software porting, and general mucking around, the (Beta test!) version never crashed.

    In one test, I intentionally trashed the root file system to test my Emergency Boot disk and root filesystem restore procedure. Although an automatic boot from the trashed hard-disk root partition failed (the system seemed unable to reboot the modified root filesystem without a sync), Coherent's fsck utility totally repaired the filesystem when run (from the Emergency Boot Floppy) on an unmounted /dev/root filesystem.

    Documentation

    Coherent's documentation is concise, easy to read, and intuitively organized. It differs from traditional UNIX documentation in that it is a single, 1,200-page manual divided into a Tutorial section (378 pages) and an alphabetically organized "Lexicon" containing commands, C Standard Library calls, built-in shell constructs, environment variables, device driver details and glossary terms.

    The Tutorial section gives those new to UNIX a general introduction to using Coherent as well as detailed information on Coherent System Administration. The comprehensive tutorials on the standard UNIX languages like awk, lex, nroff/troff, sed, and yacc are well written and interesting to read. The UUCP tutorial is tailored to Coherent's uuinstall command and includes several good configuration examples and details of modem setup. Be sure to read the section covering manual modification of UUCP configuration files, as they seem to be a curious mixture of HDB and older L.sys formats.

    The Lexicon is a concise reference for all aspects of the Coherent system. Its commands, C library functions, terms, and other useful information are in alphabetical order. Lexicon entries resemble UNIX "manpages" in that they contain syntax, description, examples, See Also, Diagnostics, and Notes sections, as appropriate. Where an entry can be used in several ways -- read, for example -- there are multiple entries: "read -- COHERENT System Call (libc)" and "read -- Command".

    Installation

    The Coherent 4.0 distribution consists of five 3.5 diskettes or six 5.25 diskettes. The Installation Guide includes comprehensive hardware compatibility, "Before you Install," and "Troubleshooting" sections as well as step-by-step instructions and helpful hints. In my installation, the only information I had to provide was:

    1. how many virtual consoles I wanted and the keyboard style 2. timezone/daylight savings info 3. whether I wanted to use the Coherent Master Boot program (yes!) 4. the disk partitioning and where Coherent was to reside 5. UUCP site and domain name (uuinstall is provided to help configure the rest of uucp) 6. my choice of passwords for root, bin uucp, etc. 7. my choice of additional user logins, passwords, shells, and home directories 8. serial port terminal/modem configurations 9. printer port selection, e.g., which LPTx or serial port 10. whether I wanted to install the online manual pages and the spell utilities

    The first installation, when I was taking all these notes, took about one hour and forty five minutes. A second installation, done for speed, took less than one hour.

    Configuration questions are accompanied by a concise explanation of the choices and their consequences.

    After you have booted the first diskette and answered the configuration questions, the hard disk is initialized, some files are loaded, and you are prompted to reboot from the hard drive. The installation continues with prompts to feed in the rest of the floppy disks.

    To update a previous installation of Coherent to Rel 4.0, you type "update" at the initial (floppy disk) boot prompt and the rest is automatic. All files not part of the distribution are left untouched and files like /.profile and user-configured files in /etc and /usr/lib/uucp are preserved.

    System Administration

    The "Using Coherent" tutorial covers most aspects of Coherent System administration. Topics include adding users, security, filesystem backup/restore, filesystem formatting, mount/umount, fsck, device drivers, printer management, cron, ps/kill, system accounting, and Coherent startup/shutdown.

    Disaster Recovery Options

    The Lexicon "booting" entry, which provides details of the boot process and precise "boot disk" preparation instructions, was a pleasant surprise. This Lexicon entry, along with those for cpio, tar, dump and restore, and the "Using Coherent" tutorial, gives you all the information you need to prepare for and recover from a root filesystem disaster.

    Listing 1 shows my shell script to automate (and document) the steps required to generate an "Emergency Boot Disk" with some disaster recovery tools. As is the case with other UNIX systems, when you boot from a floppy drive, it becomes the root device and cannot be used for input of the backup diskettes. This presents a real problem here because there is currently no tape support! Hence, the "ramroot" script.

    The ramroot script creates, initializes, and switches over to a RAMdrive root filesystem so that the boot diskette can be removed and the (boot) floppy drive used for backup and/or restore operations. A boot floppy prepared in this fashion can be used to restore a root filesystem (called /dev/root) or any other Coherent filesystem from the boot drive, a second floppy drive, or other (soon to be supported) media.

    Alternatively, the script in Listing 1 could modified to set up a small emergency boot partition on your hard disk by substituting /dev/at0x and /dev/rat0x, where x is partition id (a, b, c or d) to be initialized, for /dev/fd0 and /dev/rfd0.

    System Tuning

    Performance (kernel buffer cache) tuning is done automatically at boot-time. Other tuning and configuration parameters are set by "patching" the kernel.

    During installation, configuration changes are made directly to the kernel using the Coherent patch command, which supports direct symbolic patching of variables within executables. Kernel build files in the /conf and /conf/gen directories use this strategy.

    The Lexicon's patch command entry

    /conf/patch /coherent KBBOOT=0

    serves as a patch to the /coherent kernel's nkb device driver that disables the [Ctrl-Alt-Del] warm boot key sequence.

    While the "patching" approach may seem arcane, it is not too different from System V kernel configuration using the sdevice and stune configuration files. Some complex drivers are patched by special programs. For example, to configure a multiport serial board, you need to

  • edit the /etc/default/async file, by uncommenting the lines which describe your board configuration. The Lexicon entry for the asy driver contains copious details about the content, format, and editing of this file.

  • run the /conf/asypatch program to apply the patches to the kernel

  • run the /conf/asymkdev program to make the appropriate device names in /dev

  • reboot the new kernel

    The Lexicon entries for individual device drivers describe their configurable variables:

    asy - async port driver -- Coherent provides special commands to simplify configuration of async ports and the supported multiport serial cards. First the file /etc/default/async, which contains copious documentation of its content, is edited to reflect your configuration. Run the programs /conf/asypatch and /conf/asymkdev to complete the async configuration process.

    aha154x -- Adaptec SCSI driver: configured by the /etc/mkdev scsi command.

    at -- hard-disk-driver kernel variables: atparm, ATSREG, ATSECS. atparm is the at driver's hard-drive geometry table. It is normally patched during Coherent installation to reflect the target machine's disk configuration:

    Drive 0: atparm+0 - cylinders (short) atparm+2 - heads (short) atparm+14 - sectors per track (char)

    Drive 1: atparm+16 - cylinders (short) atparm+18 - heads (short) atparm+30 - sectors per track (char)

    For example, to set the drive 1 geometry to 829 cylinders, 10 heads, and 26 sectors per track in the "tkernel" kernel, use the command:

    /conf/patch /tkernel atparm+16=829:s\
    atparm+18=10:s atparm+30=26:c

    ATSREG controls alternate vs. normal polling of IDE controllers; ATSECS controls I/O request timeout interval

    lp -- line printer driver: LPWAIT (for ready), LPTIME (printer sleep ticks), LPTEST (for printer online)

    msg -- msg IPC driver: NMSQID (number of msg queues), NMSG (number of messages)

    nkb -- new keyboard driver: KBBOOT (controls warm boot from keyboard)

    sem -- semaphore IPC driver: NSEMID (number of semaphore IDs), NSEM (number of semaphores per ID)

    shm -- shared memory IPC driver: NSHMID (number of Shared memory IDs)

    ss -- Future Domain/Seagate SCSI driver: configured by the /etc/mkdev scsi command

    The console driver can be reconfigured to support up to eight virtual console sessions on the VGA or monochrome monitors by patching the VTVGA and/or VTMONO kernel variables. For example, the command

    /conf/patch /coherent VTMONO=8

    would allow eight sessions on the monochrome monitor. The /conf/kbd/us keyboard configuration table would also need to be modified to declare the appropriate hot-keys for the additional virtual consoles and the corresponding /dev/monox special files would have to be made with the mknod command.

    Hardware Compatibility

    Coherent 4.0 is compatible with most 386 and 486 ISA and EISA bus PC clones. Supported adapter cards include most monochrome and VGA video cards, IDE/MFM/RLL/ESDI disk controllers, and a variety of multiport serial cards, including several models from Boca Research, DigiBoard, Comtrol, Arnet, and Stargate. The list of specific clones and adapters known to work is too long to include here.

    The currently supported SCSI controllers are the Adaptec AHA1540B and AHA1542B, Seagate ST01 and ST02, and Future Domain TMC-840/841/880/881 and TMC-845/850/875/885.

    Microchannel machines are not supported.

    Technical Support

    Coherent's approach to technical support is comprehensive: unlimited free phone support, UUNET email (support@mwc.com or uunet!mwc!support), USPS Mail, and various Bulletin Boards at Mark Williams, CompuServe, BIX, and USENET (comp.os.coherent).

    I was pleased to see that many of the problems I encountered during my participation in the Beta test of 4.0 actually had been fixed in the production release.

    Shortcomings in the Current Release

    This section details problems which I encountered during the Beta test that had not yet been fixed in the production release. It is not a comparison of Coherent with other PC UNIX implementations.

    COFF Binary Compatibility

    1. COFF binaries which contain floating point instructions fail on Coherent because the kernel does not currently support hardware floating point (i.e., 80x87) or emulation when FP instructions are trapped (SIGFPE) in the absence of a coprocessor.

    Although some Interactive UNIX binaries failed with an Invalid System Call (SIGSYS) trap, FP exceptions were the problems I encountered most frequently among the shrink-wrapped UNIX applications and my own SCO and Interactive compiled programs. Programs exhibiting these problems ran correctly after recompilation with Coherent's C compiler.

    2. The Coherent 4.0 shared memory implementation is not UNIX System V compatible, although the related features, semaphores and message passing, work as expected.

    Shell Problems

    1. The Bourne Shell in the production release does not support shell functions, but a new version of the shell available on the BBS does.

    2. The Korn Shell does not support vi-style command line editing but does allow vi to be used for "fix-command" editing with the fc command.

    3. When a Korn shell script containing the expression "$*" is invoked without arguments -- e.g., ksh foobar -- "$*" expands to the exported environment instead of "".

    4. The Korn Shell r command, to re-execute commands from the command history, fails when invoked with a string but works correctly when invoked with the history number of the desired command.

    5. The r command also fails to operate as expected when attempting to append, as in the commands:

    r 18 | more
    r 16 file3

    6. The next command entered after an r command also fails because of residual input from the r command.

    While these shell problems are somewhat irritating, they are hardly terminal (pun intended).

    C Development Tools

    I encountered a few problems while porting my test sources:

    1. The default executable filename is not a.out. Setting the CCHEAD global variable to contain "-o a.out" circumvents this problem, but creates others in cases where flags mutually exclusive of object file or executable file generation (such as "-S" are used.

    2. make doesn't handle macro references of the form ${MAC_NAME} or lines with leading blanks.

    3. The /usr/include/vfork.h file is missing. I created the file /usr/include/vfork.h containing a single line:

    #define vfork fork

    which solved this specific problem.

    A number of other problems reported during the Beta test were fixed for the production release.

    Standard Library

    The vf*printf() and _doprnt() functions are missing. A version of vf*printf() is in process and will soon be posted on the BBS.

    db Debugger

    The db debugger is rather like the UNIX adb debugger and there is no source level C debugger. For a software developer, this is a serious limitation, although the speed of the C compiler relieves some of the pain. To use db, you need to be familiar with Intel assembler.

    Device Drivers

    The current release lacks support for cartridge tapes.

    Futures

    Two features listed for the "Coherent 4.x Series" -- demand-paged virtual memory and SCSI tape drive support -- are missing from release 4.0. I hope these will added shortly.

    The Future Improvements list includes an ANSI C compiler, DOS emulation, a C source level debugger, shared libraries, Graphics drivers, XWindow support, Novell Netware support, TCP/IP, streams, and NFS.

    Conclusion

    Coherent 4.0's performance and reliability, excellent documentation and free technical support, ability to run many PC UNIX iBCS2 binaries, and $99 price tag make this one of the most exciting UNIX clones I have seen.

    I believe it to be the only independently developed UNIX clone (short of BSD) that has achieved the flexibility, quality, and reliability necessary for consideration as a commercial application platform. Despite its current lack of XWindow and network support, I can easily imagine system integrators and application developers choosing Coherent as a low-priced platform for small (up to eight users) office systems running combinations of off-the-shelf Coherent, SCO, Interactive, and other PC UNIX applications.

    About the Author

    David Knight is the President of Applied Computer Sciences, Inc., a Connecticut-based consulting firm specializing in software development, UNIX networks, distributed processing, and DOS/UNIX connectivity and interoperability. David has been programming since the early sixties and has specialized in UNIX/C since 1982. He can be reached at (203) 270-XINU (voice) or via EMail at dmk@dknight or uunet!dknight!dmk.


     



  •