views:

108

answers:

1

I am specifically referring to InputStream (Java SE) and its implementations.

How is blocking performed? I'm a little worried that they use a "busy-waiting" mechanism, as it would produce a lot of overhead. I believe they do it another way, but I'm just asking to be certain.

+5  A: 

No, they don't use busy-waiting. It's up to the implementation (which will depend on the kind of input stream you're using), but generally it's likely to use a blocking OS-level API, so the efficiency will depend on the OS.

Jon Skeet
I'm talking about socket streams in particular. Could you give more information?
someguy
@someguy: More information about what in particular? At some point, it's got to hit the OS, right? So how do blocking system calls for sockets work at the OS level for your favourite OS?
Jon Skeet