From mboxrd@z Thu Jan 1 00:00:00 1970 From: doug@cs.dartmouth.edu (Doug McIlroy) Date: Tue, 15 Jul 2014 19:43:49 -0400 Subject: [TUHS] the sin of buffering [offshoot of excise process from a pipeline] Message-ID: <201407152343.s6FNhnUT001960@coolidge.cs.dartmouth.edu> Yes, an evil necessary to get things going. The very definition of original sin. Doug Larry McVoy wrote: >>>> For stdio, of course, one would need fsplice(3), which must flush the >>>> in-process buffers--penance for stdio's original sin of said buffering. >>> Err, why is buffering data in the process a sin? (Or was this just a >>> humourous aside?) >> Process A spawns process B, which reads stdin with buffering. B gets >> all it deserves from stdin and exits. What's left in the buffer, >> intehded for A, is lost. Sinful. > It really depends on what you want. That buffering is a big win for > some use cases. Even on today's processors reading a byte at a time via > read(2) is costly. Like 5000x more costly on the laptop I'm typing on: