开发者

How do I/O operations block?

开发者 https://www.devze.com 2022-12-26 00:30 出处:网络
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

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消