Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2000 09:29:51 -0500
From:      James FitzGibbon <james@targetnet.com>
To:        stefan parvu <stefan.parvu@comptel.com>
Cc:        Titus von Boxberg <tboxberg@schuett-elektronik.de>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Pthread blocking I/O
Message-ID:  <20000306092951.A76191@targetnet.com>
In-Reply-To: <38C3BE39.36CDDA55@comptel.com>
References:  <38C3BF60.55CF16CC@schuett-inhouse.de> <38C3BE39.36CDDA55@comptel.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* stefan parvu (stefan.parvu@comptel.com) [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                                           james@targetnet.com
Targetnet.com Inc.                              Voice/Fax +1 416 306-0466/0452


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000306092951.A76191>