Implementing TLS: step 1
Igor Sysoev
is at rambler-co.ru
Sat Jun 21 02:50:22 PDT 2003
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/
More information about the freebsd-threads
mailing list