From owner-freebsd-bugs Fri Oct 23 16:30:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA22609 for freebsd-bugs-outgoing; Fri, 23 Oct 1998 16:30:07 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA22603 for ; Fri, 23 Oct 1998 16:30:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id QAA04810; Fri, 23 Oct 1998 16:30:01 -0700 (PDT) Date: Fri, 23 Oct 1998 16:30:01 -0700 (PDT) Message-Id: <199810232330.QAA04810@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Dmitrij Tejblum Subject: Re: kern/8375: pthread_cond_wait() spins the CPU Reply-To: Dmitrij Tejblum Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/8375; it has been noted by GNATS. From: Dmitrij Tejblum To: "Daniel M. Eischen" Cc: freebsd-gnats-submit@FreeBSD.ORG, jb@FreeBSD.ORG Subject: Re: kern/8375: pthread_cond_wait() spins the CPU Date: Sat, 24 Oct 1998 03:22:31 +0400 Daniel, IMO, your _thread_kern_sched_[un]lock() is a bad idea. Theses functions defeat the idea of spinlocks. What is the need to do _SPINLOCK/_SPINUNLOCK when scheduling is blocked? Your code do it a lot. OTOH, spinlocks are designed exactly to make rescheduling harmless. And they works; the only problem is that spinlocks are released in a bit wrong time. (BTW, why you disable scheduling in pthread_cond_signal and pthread_cond_broadcast?) The whole concept of disabling the scheduler is suspicious. There are data structures, they has to be locked sometimes to provide atomic access to them; why ever disable scheduling? Just lock and unlock properly... Dima To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message