This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/6399] gettid() should have a wrapper


https://sourceware.org/bugzilla/show_bug.cgi?id=6399

--- Comment #48 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Carlos O'Donell from comment #47)
> Note that C++ is considering coroutines, and if implemented in C they would
> represent a case where we could conceptually have multiple execution
> contexts within the same OS thread. Exposing the OS tid would further
> complicate programming using these execution contexts since the tid's would
> be the same. If we stay with pthread_t, we can at least under the hood have
> a pthread_t per execution context that might be used to allow some threading
> operations to be shared between the various execution abstractions.

I'm afraid this argument isn't valid because we use %fs-relative (or
%gs-relative) addressing, instead of loading the TCB from the %fs:0 and
addressing relative to that.  As a result, a co-routine switch would have to
copy the *entire* TCB as part of the context switch, which would not offer the
performance characteristics people expect from coroutines.

We are committed to the kernel thread identity, so we might as well expose it
to applications explicitly.

There is also a possibility that coroutines will be implemented as Python-style
generators, where only select functions using a new syntactic element can
perform context switches, and there aren't any stack switches involved at all
or anything the lower-level run-time environment would notice.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]