From owner-freebsd-hackers Fri Feb 4 19:24:50 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by builder.freebsd.org (Postfix) with ESMTP id 7018241F0 for ; Fri, 4 Feb 2000 19:24:48 -0800 (PST) Received: (from daemon@localhost) by smtp04.primenet.com (8.9.3/8.9.3) id UAA02233; Fri, 4 Feb 2000 20:25:01 -0700 (MST) Received: from ip-83-040.prc.primenet.com(207.218.83.40), claiming to be "pinyon.org" via SMTP by smtp04.primenet.com, id smtpdAAAEoaiue; Fri Feb 4 20:24:53 2000 Received: from chomsky.Pinyon.ORG (localhost [127.0.0.1]) by pinyon.org (Postfix) with ESMTP id 450F65B; Fri, 4 Feb 2000 20:24:56 -0700 (MST) X-Mailer: exmh version 2.1.0 09/18/1999 To: Zhihui Zhang Cc: freebsd-hackers@FreeBSD.ORG, rcarter@pinyon.org Subject: Re: FreeBSD Posix threads In-Reply-To: Message from Zhihui Zhang of "Fri, 04 Feb 2000 12:25:17 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 04 Feb 2000 20:24:56 -0700 From: "Russell L. Carter" Message-Id: <20000205032456.450F65B@pinyon.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG % %I have searched the archive for a while and still have some confusions %about this subjects: % %(1) Some people say "For I/O bound activity, kernel threads are a really %bad idea". But I read the following passage from else where: % %Kernel threads perform better in I/O-intensive applications because system %call can be blocking for kernel threads (so there is only one %user-to-kernel and kernel-to-user transition per I/O operation rather than %two). % %So which one is the correct answer? I know there is only userland thread %in FreeBSD, but I would like to know the answer. % %(2) User threads are supposed to be faster than kernel threads in context %switch. But since we poll devices during each context switch, it is %actually slower (poll() is the extra system call). Is this correct? % %(3) Can I do cooperative thread scheduling on FreeBSD? I guess the %constant SCHED_RR (round robin) means preemptive. How about SCHED_FIFO %and SCHED_OTHER defined in posix4/sched.h? Can I choose from them? In %the case of SCHED_RR, I still do part of scheduling by routines like %yield(), cond_signal(). Am I right? % %Any help is appreciated. Excellent questions. However, what is not stated is perhaps the most important (to me, and other people burning up and showering down $$$). C++ programmers use threads to share class members. In that context, the POSIX realtime scheduling classes (SCHED_*) are quite useful, albeit abstractly for now. IMNSHO, focusing on fine-grained benchmarks ("perform better") for an execution model based on C processes may be misleading in the realistic broader picture. Russell %-Zhihui % % % % %To Unsubscribe: send mail to majordomo@FreeBSD.org %with "unsubscribe freebsd-hackers" in the body of the message % To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message