From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 7 06:01:52 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6233116A4CE for ; Mon, 7 Mar 2005 06:01:52 +0000 (GMT) Received: from wattres.watt.com (wattres.watt.com [66.93.133.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0E00643D2F for ; Mon, 7 Mar 2005 06:01:52 +0000 (GMT) (envelope-from steve@Watt.COM) Received: from wattres.watt.com (localhost.watt.com [127.0.0.1]) by wattres.watt.com (8.13.1/8.13.1) with ESMTP id j2761jbJ034421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Mar 2005 22:01:45 -0800 (PST) (envelope-from steve@wattres.watt.com) Received: (from steve@localhost) by wattres.watt.com (8.13.1/8.13.1/Submit) id j2761j24034420; Sun, 6 Mar 2005 22:01:45 -0800 (PST) (envelope-from steve) Message-Id: <200503070601.j2761j24034420@wattres.watt.com> X-Newsgroups: local.freebsd-hackers In-Reply-To: <20050306101423.44745.qmail@web52702.mail.yahoo.com> Organization: Watt Consultants From: steve@Watt.COM (Steve Watt) Date: Sun, 6 Mar 2005 22:01:44 -0800 X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: kamalp@acm.org X-Archived: 1110175305.788270349@wattres.Watt.COM X-Virus-Scanned: ClamAV 0.83/749/Sun Mar 6 14:29:08 2005 on wattres.Watt.COM X-Virus-Status: Clean cc: hackers@freebsd.org Subject: Re: sched_4BSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2005 06:01:52 -0000 In <20050306101423.44745.qmail@web52702.mail.yahoo.com>, Kamal R. Prasad wrote: >--- Steve Watt wrote: [ snip ] >> NPTL is a particular (less brain damaged than >> LinuxThreads) >> implementation of the POSIX thread standard. >> >> Likewise, scheduler activations are a decent >> implementation of > >doesn't that have a problem with M:N performance (M |= >N)? "Problem"? Scheduler activations may be used to build M:N systems, but that is not a requirement -- you can easily build a 1:1 (all threads are system contention scope) system with activations. Admittedly, at this point in industry experience, most threads experts will say that M:N threading usually isn't worth the implementation headaches. But there are definite classes of problem, often having to do with certain styles of user-interface design or a less-than-optimal object system, where thousands of threads are a useful developer convenience. Very many processes with thousands of threads in them will drag down a 1:1 system pretty rapidly. >> Julian> so how does that differ from what we have >> ... a >> Julian> native pthreads library? >> >> Kamal>I just said if it was conformant with NPTL, >> thread and >> Kamal>process scheduling would co-exist. >> >> Uh, as far as I understand, in NPTL, each thread >> gets a scheduler >> slot, and it is my understanding that there is >> nothing to protect >> against the issue that Julian is asking about (1000 >> threads of a >> single process *do* get 1000 times the time slices). >> > >(AFAIK) Referring to the POSIX std (and not NPTL) -if >threads were defined within process scope and not >system scope -the scheduling attributes of the process >will apply. Yes, and a system that has both system scope and process scope is usually called an M:N system. I will grant that it is possible for the kernel to be aware of all of the threads in the system (i.e. a 1:1 model) but handle contention scope correctly. I don't think anyone has built such a system, but would be happy to be proven wrong -- it'd be a useful advancement of the art. One challenge is accounting for time on threads that don't do much work when awakened before going back to sleep -- if there are 1000 process-scope threads, and all of them run for half a millisecond and block, in the aggregate you need to charge the process the entire 500mS, or the timesharing characteristics won't come out right. It's somewhat challenging to do that charging cheaply. -- Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.8" / 37N 20' 14.9" Internet: steve @ Watt.COM Whois: SW32 Free time? There's no such thing. It just comes in varying prices...