Dennis M. Ritchie and Ken Thompson. 1974. The UNIX time-sharing system. Commun. ACM 17, 7 (July 1974), 365-375. DOI: http://dx.doi.org/10.1145/361011.361061
科学技术史课程论文我决定写 Unix, 所以去读了一下 1974 年 Ritchie 和 Thompson 的那篇介绍 Unix 的短文.
摘录一些有意思的如下
Perhaps the most important achievement of UNIX is to demonstrate that a powerful operating system for interactive use need not be expensive either in equipment or in human effort: UNIX can run on hardware costing as little as $40,000, and less than two man years were spent on the main system software.
古代人的电脑真是贵啊, 40000美元还是便宜的.
另外 Unix 和当时耗费人力众多却没有结果的 Multics, 和 “有史以来最可怕的软件开发泥潭” (人月神话语) 的 OS/360 相比 的确是又小又好. 我觉得可能就是这些当时雄心勃勃的巨大系统的恶心才让 Thompson 和 Ritchie 觉得小才是美吧.
不过我也觉得 “小就是美”, 比如Hachisuka大哥的 smallppm, 还有 tinyhttpd, tcc, lodepng 等等, 都是非常不错的.
There is a threefold advantage in treating I / O devices this way: file and device I / O are as similar as possible; file and device names have the same syntax and meaning, so that a program expecting a file name as a parameter can be passed a device name; finally, special files are subject to the same protection mechanism as regular files.
万物皆文件的好处
- 简化 I/O 接口
- 简化保护控制
- 处理文件的程序能够通用地处理设备
In the write case, n is the same as count except under exceptional conditions like I / O errors or end of physical medium on special files; in a read, however, n may without error be less than count. If the read pointer is so near the end of the file that reading count characters would cause reading beyond the end, only sufficient bytes are transmitted to reach the end of the file; also, typewriter-like devices never return more than one line of input.
解释了一下为什么 read()
和 write()
返回的值 (实际读写的字节数) 可能和输入的 count
不一样.
- I/O 到一般出错
- EOF
- 可能
read()
的设备就只有那么多字节, 比如 tty 只有一行.
ed ordinarily enters the editor, which takes requests from the user via his typewriter.
突然对 teletypewriter 有点兴趣, 去搜了一下, 大开眼界.
When an illegal action is caught, unless other arrangements have been made, the system terminates the process and writes the user’s image on file core in the current directory.
这就是吐核 (core dump) 的来历吧.
If designers of a system are forced to use that system, they quickly become aware of its functional and superficial deficiencies and are strongly motivated to correct them before it is too late.
要是你开发出来的系统自己都不用, 那怕是很难做的很好了.
A “crash” is an unscheduled system reboot or halt. There is about one crash every other day;
Total up time has been about 98 percent of our 24-hour, 365-day schedule.
我知道为什么 The Unix Hater’s Handbook 里面有那句
If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year killing everyone inside.
不禁想要吟诗一首
劳斯莱斯卖一千, 滴油绕地跑三圈, 而且每年有一次, 送你免费上西天.