logo       

Re: handling disk IO within asio programs: msg#00007

lib.boost.asio.user

Subject: Re: handling disk IO within asio programs

On 11/14/06, Christopher Kohlhoff <chris-34HiQXrhQN1Wk0Htik3J/w@xxxxxxxxxxxxxxxx> wrote:
Jose <jmalv04-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> Is the following  reasoning correct ?
> For file IO (compared to the services example) it is best to
> create a new thread for every completed write otherwise I
> don't see how a single background thread can scale (or keep a
> thread pool)

Hmm, I think one thread per write is too much. How about a
thread pool calling io_service::run() on the "hidden"
io_service, and use a strand per file object to make sure that
the writes don't get out of order or corrupt each other.

Hi Chris,

By "completed write"  I meant  file,  so it would be analogous to
the resolver_service that uses one thread for every dns query.

On the other side, if I use a single file to store multiple files then
I could probably use your logger service.

Regarding your services example, you mentioned before:
"The missing element in that example is posting the completion handler back
to the application."

Why should I post the completion handler back ?  And why don't you
post the completion handler back in your services example ?

Many thanks
jose


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/asio-users
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise