[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: fork or printf problem



Shridhar Daithankar forced the electrons to say:
> Kernel takes care of that. printf need not worry about it. That's the
> strength of unix. That's what you mean by 'everything is a file in
> unix...'

No Sridhar, stdio handles its own buffering. I think there is an ANSI
requirement for this. Once the buffer is full, stdio calls write(2) with the
full buffer. The kernel doesn't enter this picture...

Of course, the kernel is free to buffer the write() calls, to minimise actual
disk writes. I think it does this in the case of socket writes...

Binand