Yes, that's correct. TLS can be implemented pretty efficiently with a small bit of care. Regarding LLVM, it is technically possible to have multiple independent instances of LLVM in one thread. The reason that wasn't an option for the multithreaded case is that those instances can't share any code so it wouldn't be useful.
On Fri, Aug 1, 2014 at 2:17 PM, Stefan Karpinski <[email protected]> wrote: > On Fri, Aug 1, 2014 at 9:11 AM, Jameson Nash <[email protected]> wrote: >> >> There isn't much benefit to running multiple julia instances from one >> binary, since Julia uses many c libraries, and these have generally not been >> written with this in mind. > > > Yes, also a problem, although threads may raise similar issues. > >> >> It might be faster to internally pass around pointer to the TLS in a >> register, since many functions need to access the GC-frame, so we might >> still want to do that for a different reason. But the external interface can >> just pull that information out of TLS, and maintaining thread-local state is >> not the same as having independent instances in one process. > > > My understanding – and Keno can probably correct me if I'm wrong here – is > that the fast way of doing TLS basically does just store it in a register. > However, there may be situations where Julia is called in a way that it > can't use the fast TLS mechanism (e.g. when libjulia is loaded as a shared > library), in which case avoiding slow TLS lookups wherever possible would > help in those cases.
