Paul. alarm was introduced as part of Unix/TS would become most of kernel for the V7
system
As for networking driving it I can not say. But the need for alarm to be broken from sleep
was there for many other types of programs particularly if there was an interactive
component or you needed to deal with hw at the user level.
Look at the ‘expect’ code in uucico (which would later begat the whole expect tool from
NIST). Alarm was just easier to do that with than sleep.
Sent from my PDP-7 Running UNIX V0 expect things to be almost but not quite.
On Jan 10, 2019, at 6:12 PM, Paul Ruizendaal
<pnr(a)planet.nl> wrote:
I'm still happily experimenting with my combination of a V6 kernel with the 1981
tcp/ip stack from BBN, for example figuring out how one would write something like
'ping' using that API. That brought me to pondering the origins of the
'alarm()' sys call and how some things were done on the Spider network.
These are my observations:
1. First of all: I understand that early Unix version numbers and dates mostly refer to
the manual editions, and that core users had more frequent snapshots of a constantly
evolving code base.
2. If I read the TUHS archive correctly, alarm() apparently did not exist in the original
V6 edition of mid-1975. On the same basis, it was definitely there by the time of the V7
edition of early '79 (with sleep() removed) - so alarm() would seem to have appeared
somewhere in the '75-'78 time frame.
3. The network enhanced NCP Unix versions in the TUHS archive have alarm() appear next to
sleep(). Although the surviving tapes date from '79, it would seem to suggest that
alarm() may have originated in the earlier part of the '75-'78 time frame.
4. The Spider network file store program 'nfs' (source here:
http://chiselapp.com/user/pnr/repository/Spider/dir?mtime=0&type=flat&a…)
uses idioms like the below to avoid getting hung on a dead server/network:
signal(14,timeout); alarm(30);
if((read(fn,rply,100)) < 0) trouble();
alarm(0);
The 'nfs' program certainly was available in the 5th edition, maybe even in the
4th edition (the surviving 4th edition source code includes a Spider device driver).
However, the surviving source for 'nfs' is from 1979 as well, so it may include
later additions to the original design.
5. Replacing sleep() with alarm() and a user space library routine seems to have happened
only some time after alarm() appeared, so it would seem that this was an optimization that
alarm() enabled, and not its raison d'être.
So here are some questions that the old hands may be able to shed some light on:
- When/where did alarm() appear? Was network programming driving its inception?
- Did Spider programs use a precursor to alarm() before that? (similar to V5 including
'snstat' in its libc - a precursor to ioctl).
Paul