* stefan parvu ([EMAIL PROTECTED]) [000306 09:19]:

> I have not so much experience using POSIX threads, but we had in
> university a project and for I/O to use threads is not so good method.
> You slow down the process. 
> 
> Some comments? Isn't so?

In my experience, threads are the perfect way to speed up an I/O bound
application.  While one thread is blocked in iowait, others can be
performing operations that do not contend for the same resource
(calculation, I/O on some other resource like a socket, etc.)

This is of course implementation dependant; if you are using a user-land
thread package like MIT pthreads, the kernel sees the entire process as one
schedulable entity, so if one thread blocks on IO, all threads block.  If
you are using a kernel-thread or hybrid implementation, the system scheduler
allows the other threads to run as described above.

FreeBSD's threading implementation in libc_r is (AFAIK) a hybrid model, and
from personal experience I have found threaded applications under FreeBSD to
be much easier to code for performance than their single-threaded
counterparts.

-- 
j.

James FitzGibbon                                           [EMAIL PROTECTED]
Targetnet.com Inc.                              Voice/Fax +1 416 306-0466/0452


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to