From owner-freebsd-arch@FreeBSD.ORG Tue Oct 21 20:21:46 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1462716A4B3 for ; Tue, 21 Oct 2003 20:21:46 -0700 (PDT) Received: from sohgo.tanimura.dyndns.org (IP1A0619.kng.mesh.ad.jp [211.13.103.239]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9747743FDF for ; Tue, 21 Oct 2003 20:21:43 -0700 (PDT) (envelope-from tanimura@tanimura.dyndns.org) Received: from sohgo.tanimura.dyndns.org (localhost [IPv6:::1]) ESMTP id h9M3LfB6041132 ; Wed, 22 Oct 2003 12:21:41 +0900 (JST) Received: (from uucp@localhost) (8.12.9/3.7W-submit-carrots-Tokyu-Meguro) with UUCP id h9M3LeP4041131 ; Wed, 22 Oct 2003 12:21:40 +0900 (JST) Received: from urban.nkth.tanimura.dyndns.org (localhost [IPv6:::1]) with ESMTP id h9M3JGI1005225 ; Wed, 22 Oct 2003 12:19:16 +0900 (JST) Message-Id: <200310220319.h9M3JGI1005225@urban> Date: Wed, 22 Oct 2003 12:19:16 +0900 From: Seigo Tanimura To: arch@FreeBSD.org User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 13) (Rational FORTRAN) (i386--freebsd) Organization: My Home MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII cc: Seigo Tanimura Subject: Who should set the priority of a select(2)ing thread being waken up? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2003 03:21:46 -0000 In good old days, only a socket and a pipe were the major file descriptors being select(2)ed. As select(2) was just a socket operation, it was sufficient to set the priority of select(2)ing process to PSOCK(*1), I suppose. Nowadays, quite a few drivers support select(2) as well, including sound, usb, scsi controllers, and so on. I am not convinced whether a process should select(2) those devices at PSOCK as we do for a socket. Suppose that a process select(2)s for a pcm device and a socket at once. If the process is waken up by the pcm driver at PSOCK, another process at a better priority may preempt the first one, which can result in dropping some pcm data. Maybe it would be better if the caller of selwakeup() could determine the priority of a process or a thread. That would let us raise the priority to PRIBIO if pcm data was ready, while the priority would stay at PSOCK if the socket was ready. (*1) I broke that in 5-CURRENT when I modified select(2) and poll(2) to use a conditional variable. -- Seigo Tanimura