Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Many recent posts, such as Locked threads and tcp timeouts confront the problem of blocking IO operations. While I'm not a kernel or low level C expert, I would like to know how did we get into a position where IO can block a whole process, without having the ability to send a interrupt signal to it, or easily code around it?

My thoughts are the following:

Dosn't the socket method is_connected give you the ability to detect if the socket is stuck? Couldn't is_connected be made to bounce a message off the other end? Thereby indicating whether the lines went down. Then you could do a is_connected test before each read. That is not perfect, is wasteful of time, but would work for small data transfers, considering how fast the lines are now.

Would it be that wasteful in low level IO code, to have it listen for an interrupt in it's read loop, and have that timed out with an alarm?

On linux, the only sure fired method for avoiding the blocking IO problem is to make sure the code is forked off, and kill -9 it's pid

Concerning it's problems in threads, is this blocking IO problem the reason venerable old masters like merlyn refused to jump onto the threads bandwagon, saying that forks and shared memory segments work just fine. You can keep your problem prone threads. :-)

I've touched on quite a few points here, all connected in sub space by the blocking IO problem, and even gave thought it may be in there like a StuxNet device, to give external devices the ability to lock up programs. A very useful tool for network engineers to have.

So before I put on my titanium foil hat, would someone care to explain why blocking IO should even be a problem? Is it in the processor design itself?

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to how did blocking IO become such a problem? by zentara

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-05-22 19:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found