Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2000 06:43:06 -0800 (PST)
From:      Alex Belits <abelits@phobos.illtel.denver.co.us>
To:        James FitzGibbon <james@targetnet.com>
Cc:        stefan parvu <stefan.parvu@comptel.com>, Titus von Boxberg <tboxberg@schuett-elektronik.de>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Pthread blocking I/O
Message-ID:  <Pine.LNX.4.20.0003060635220.2201-100000@phobos.illtel.denver.co.us>
In-Reply-To: <20000306092951.A76191@targetnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 6 Mar 2000, James FitzGibbon wrote:

> > 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.)

  Processes can do it better, and if i/o can be nonblocking, plain
poll()/select() loop can do even better (pathological cases of Java and
applications ported from Windows being the exception).

> 
> 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.

  Not really. What looks like blocking i/o for you can be nonblocking for
kernel if your threads support library translates it.

>  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.

  My experience is the opposite -- if data structures are complex enough
to become a pain in the ass to lock, processes allow more simple design
than threads, and nonblocking i/o usually limits complex code to some
small piece of program that can be written/optimized/debugged once, then
left alone.

-- 
Alex

----------------------------------------------------------------------
 Excellent.. now give users the option to cut your hair you hippie!
                                                  -- Anonymous Coward



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?Pine.LNX.4.20.0003060635220.2201-100000>