From owner-freebsd-hackers Mon Mar 6 6:30:59 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.datais.com (mail.targetnet.com [207.245.246.3]) by hub.freebsd.org (Postfix) with ESMTP id 46C5F37B723 for ; Mon, 6 Mar 2000 06:30:21 -0800 (PST) (envelope-from james@targetnet.com) Received: from james by mail.datais.com with local (Exim 3.02 #1) id 12RyW7-000LvE-00; Mon, 06 Mar 2000 09:29:51 -0500 Date: Mon, 6 Mar 2000 09:29:51 -0500 From: James FitzGibbon To: stefan parvu Cc: Titus von Boxberg , freebsd-hackers@FreeBSD.ORG Subject: Re: Pthread blocking I/O Message-ID: <20000306092951.A76191@targetnet.com> References: <38C3BF60.55CF16CC@schuett-inhouse.de> <38C3BE39.36CDDA55@comptel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre1i In-Reply-To: <38C3BE39.36CDDA55@comptel.com> Organization: Targetnet.com Inc. Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * 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