Re: Files not writing, closing files, finalize()



J. Davidson wrote:
Anyone want to know why there's [b]two[/b] layers of buffering in Java?

This is not phpBB. This is Usenet, which is generally pure text. The standard way of indicating boldness in pure text is with *a pair of asterisks.*

It's not that Java doesn't trust the OS buffering. It's because each trip through JNI to call an OS API routine is expensive.

I'm not an expert as to where the buffering is, but I'm pretty sure the call to the OS-level write routines are expensive in and of themselves.

Another fifty years from now we'll probably have a big teetering tower of abstractions and I/O will get buffered at six or seven layers instead of just two.

So? There's already high-level API buffering, filesystem buffering, and probably disk-level buffering as well. As long as they can be reasonably guarded against concurrency issues, there's no problem.

Wait, make that three. I think most modern disk controllers do some buffering of their own, because waiting for the right spot on a platter to rotate under the write head is expensive, and waiting for the head to move to a different cylinder is even more expensive.

- jenny


--
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
.



Relevant Pages

  • Re: Files not writing, closing files, finalize()
    ... Remember that something like disk access is actually very expensive, so buffering is a tremendous boost in speed. ... I think most modern disk controllers do some buffering of their own, because waiting for the right spot on a platter to rotate under the write head is expensive, and waiting for the head to move to a different cylinder is even more expensive. ...
    (comp.lang.java.programmer)
  • Re: Perl and DOS I/O
    ... I used Open2 and faced issues with output ... buffering on the C side. ... My program hangs (I believe waiting for the ...
    (comp.lang.perl.misc)
  • Re: Tour Delphi 2006 with David I.
    ... waiting for it to download rather ... than wait for the buffering on dial-up. ...
    (borland.public.delphi.non-technical)
  • Re: printf statement not executed
    ... functions does buffering, and may not print out all of your results ... The printf is executed, it's just that your "TEST" is waiting in a buffer and hasn't yet been handed to the operating system. ... Learn to program using Linux assembly language ...
    (comp.lang.c)