From: Gary Wright Date: 2009-07-15T04:45:38+09:00 Subject: Re: Process.fork weirdness On Jul 14, 2009, at 12:23 PM, Joel VanderWerf wrote: > Ah, that makes sense. It would be only the libc and ruby buffers (in > user space) that would get copied in the fork, not network stack > buffers in kernel space. That is correct. IO data buffered in the kernel is not duplicated by a fork. > But wait... Net:HTTP uses BufferedIO#writeline on sockets. That > class doesn't itself buffer writes (only reads), but it is defined > in terms of IO#write, which is buffered, isn't it? Ruby marks IO objects associated with sockets as 'synchronized' (i.e. unbuffered). Net::HTTP wraps the underlying ruby socket with BufferedIO but my quick inspection of the code seems to indicate that BufferedIO doesn't introduce a write buffer, just some debugging scaffolding and a helper method for writing lines terminated with '\r \n'.