From owner-freebsd-threads@FreeBSD.ORG Sat Jun 21 02:50:21 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 D658E37B401 for ; Sat, 21 Jun 2003 02:50:21 -0700 (PDT) Received: from park.rambler.ru (park.rambler.ru [81.19.64.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3DB2B43F75 for ; Sat, 21 Jun 2003 02:50:20 -0700 (PDT) (envelope-from is@rambler-co.ru) Received: from is.park.rambler.ru (is.park.rambler.ru [81.19.64.102]) by park.rambler.ru (8.12.6/8.12.6) with ESMTP id h5L9oEmF068762; Sat, 21 Jun 2003 13:50:14 +0400 (MSD) Date: Sat, 21 Jun 2003 13:50:14 +0400 (MSD) From: Igor Sysoev X-Sender: is@is To: Julian Elischer 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: Sat, 21 Jun 2003 09:50:22 -0000 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 ? Igor Sysoev http://sysoev.ru/en/