From owner-freebsd-threads@FreeBSD.ORG Sun Jun 22 23:16:42 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4BC7437B401 for ; Sun, 22 Jun 2003 23:16:42 -0700 (PDT) Received: from sccrmhc11.attbi.com (sccrmhc11.comcast.net [204.127.202.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A82843FAF for ; Sun, 22 Jun 2003 23:16:41 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([12.233.125.100]) by attbi.com (sccrmhc11) with ESMTP id <2003062306164001100454sce>; Mon, 23 Jun 2003 06:16:40 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id XAA79701; Sun, 22 Jun 2003 23:16:39 -0700 (PDT) Date: Sun, 22 Jun 2003 23:16:38 -0700 (PDT) From: Julian Elischer To: Igor Sysoev In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: Implementing TLS: step 1 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2003 06:16:42 -0000 On Sat, 21 Jun 2003, Igor Sysoev wrote: > On Fri, 20 Jun 2003, Julian Elischer wrote: > > > > We can implement such scheme on x86: > > > > > > gs -> [ TP ] ---> [ TLS ] > > > [ struct kse_mailbox ] +-> [ struct kse_thr_mailbox ] > > > [ .km_curthread ] -+ > > > > > > When UTS would switch to the next thread it should set thread's TLS: > > > > > > kse_mailbox.km_curthread = NULL; > > > gs:[0] = next_thr_tls; > > > kse_mailbox.km_curthread = next_kse_thr_mailbox; > > > > yes and the last line is atomic.. But remember having a NULL curhtread > > pointer stops upcalls but it is not the ONLY thing that stops upcalls.. > > A flag TMF_NOUPCALLS (spelling?) in the mailbox will also inhibit any > > upcalls. 1:1 threads (BOUND) threads, (system scope threads?) set this > > bit, but they still can have a mailbox for other purposes. (e.g. setting > > mode flags and stuff). > > So NULL curthread is the short term (in UTS only) and atomic method to > disable upcalls while KMF_NOUPCALL flag is the long term and non-atomic (we > can not atomically update bit masks in general) method ? exactly. > > > Igor Sysoev > http://sysoev.ru/en/ > > >