本段文字介绍了Unix哲学之一:Worse is Better,同时本文还解释了为什么Unix阻塞系统调用可能会返回EINTR错误。
Richard P. Gabriel suggests that a key advantage of Unix was that it embodied a design philosophy he termed "Worse is better". In the "Worse is better" design style, simplicity of both the interface and the implementation is more important than any other attribute of the system — including correctness, consistency and completeness. Gabriel argues that this design style has key evolutionary advantages, though he questions the quality of some results.
For example, in the early days UNIX was a monolithic kernel (which means that user processes carried out kernel system calls all on the user stack). If a signal was delivered to a process while it was blocked on a long-term I/O in the kernel, then what should be done? Should the signal be delayed, possibly for a long time (maybe indefinitely) while the I/O completed? The signal handler could not be executed when the process was in kernel mode, with sensitive kernel data on the stack. Should the kernel back-out the system call, and store it, for replay and restart later, assuming that the signal handler completes successfully?
In these cases Ken Thompson and Dennis Ritchie favored simplicity over perfection. The UNIX system would occasionally return early from a system call with an error stating that it had done nothing - the "Interrupted System Call" - an error number 4 (EINTR) in today's systems. Of course the call had been aborted in order to call the signal handler. This could only happen for a handful of long-running system calls, i.e. read(), write(), open(), select(), etc. On the plus side, this made the I/O system many times simpler to design and understand. The vast majority of user programs were never affected because they didn't handle or experience signals other than SIGINT/^C and would die right away if one was raised. For the few other programs - things like shells or text editors that respond to job control keypresses - small wrappers could be added to system calls so as to retry the call right away if this EINTR error was raised. Problem solved, in a simple way.
更过Unix哲学,请看:http://en.wikipedia.org/wiki/Unix_philosophy
分享到:
相关推荐
1>基于vs2010,文件比较大。 2>在使用代码之前,建议先看一下‘使用说明.txt'.
Whenever you use a computer it becomes, for better or for worse, an extension of your mind. This means that, over an extended period of time, the computer system you use changes how you think. Indeed...
formats makes matters worse, not better. Fabricators have not adopted the new formats. RS-274X remains the standard. The emergence of RS-274X as a standard for image exchange is the result of effort ...
较差的PDF 将普通的PDF文件转换为恶意文件。用于从Windows计算机中窃取Net-NTLM哈希。 参考 : https://research.checkpoint.com/ntlm-credentials-theft-via-pdf-files/https://github.com/deepzec/Bad-Pdf作者:3...
In this paper, the performance of a two-way amplify and forward (AF) multi-antenna relay network is presented, where the worse receive signal-to-noise ratio (SNR) of the two end users is ...
Google IO 2012大会上Chet Hase和Romain Guy做的主题演讲的ppt,介绍了Android绘图渲染的改进,以及如何调优渲染速度
六级易考范文50Topic 1 The Necessity of Examination As regards examination, there has been a heated ... To begin with, examination helps to tell the better-behaved from the worse-behaved students.
Even worse is the situation with the practical aspect of RL application, as it is not always obvious how to make a step from the abstract method described in the mathematical-heavy form in a research ...
This is where hardwareID is listed in the INF as a compatibleID, which is ranked worse than INF hardwareIDs. Note: INF compatibleIDs should not be confused with hardware compatibleIDs. All drivers ...
We find that the Pure MANN model performs equally to the attentional encoder-decoder for the Vietnamese to English task and ~2 BLEU worse than the attentional encoder-decoder on the Romanian to ...
nothing worse than receiving a terse message that only says `it doesn't work'. Alternatively, you may submit a bug report at https://savannah.nongnu.org/bugs/?group=freetype Enjoy! The ...
directive because it is not set or is mistyped, a default value will be used. ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, ...
worse, the license fees are pretty high. Alterantively you can, of course, use any other bignumber library - like Freelip for example. - Used Base60 conversion table (supported by MIRACL): ...
How good is it, and how much better can it be? To evaluate that question, Clément Bœsch and I set out to write a VP9 decoder from scratch for FFmpeg. The goals never changed from the original ffvp8...
为什么辛普森一家变得更糟? 尝试使用数据来确定“辛普森一家”变得更糟的答案。 首先,我有兴趣确认一个长期以来的信念,即辛普森一家多年来变得越来越糟。 其次,我有兴趣使用数据来识别导致这种情况发生的任何...
— than a statement about HTML5. But it’s really the truth: most of the people using HTML5 are treating it as HTML4+, or even worse, HTML4 (and some stuff they don’t use). The result? A real delay ...
training classes skim over these concepts or, worse, don’t cover them at all. It is my hope that this book ills this void. My goals in writing this book are twofold. My irst goal is to provide you ...
With this anthology of reports from award-winning journalist Mike Barlow, you’ll appreciate how data science is fundamentally altering our world, for better and for worse. Barlow paints a picture ...
For better or worse JavaScript is the world’s most popular programming language6 . If you have done any programming for the web, it is unavoidable. JavaScript, because of the sheer reach of the web, ...