regarding Blocking I/O
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > regarding Blocking I/O




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    regarding Blocking I/O  
kris


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-13-07 12:23 PM


Hi I just want to know is there any concept of blocking I/O in unix.

In what way this can be implemented while writing the applications.






[ Post a follow-up to this message ]



    Re: regarding Blocking I/O  
William Pursell


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-13-07 06:22 PM

On Jul 13, 12:29 pm, kris <raghavakrishn...@gmail.com> wrote:
> Hi I just want to know is there any concept of blocking I/O in unix.

Yes.

> In what way this can be implemented while writing the applications.

By default, pretty much all I/O is blocking.  If you want to
get non-blocking I/O, you have to set your file descriptor
non-blocking.  If you do nothing and just use fread/fwrite,
they will block until completed.  If you use read/write,
your writes will block, but your reads will return a short
count if no data is available.






[ Post a follow-up to this message ]



    Re: regarding Blocking I/O  
David Schwartz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-16-07 12:20 PM

On Jul 13, 11:20 am, William Pursell <bill.purs...@gmail.com> wrote:

> By default, pretty much all I/O is blocking.  If you want to
> get non-blocking I/O, you have to set your file descriptor
> non-blocking.  If you do nothing and just use fread/fwrite,
> they will block until completed.  If you use read/write,
> your writes will block, but your reads will return a short
> count if no data is available.

Your reads will return a short count if less data is available than
you asked for. They will block if no data is available, unless it is
clear that no data could ever become available.

The exception is reading from normal files. They will sort of block
and sort of not block. For example if you try to read past the end of
a local file, it will not block in case new data is appended. If you
try to read before the end of a remote file, it will block until all
the requested data is received.

DS






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:53 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register