Runtime Allocation of Thread-Local Storage

TLS is created at three occasions during the lifetime of a program.

  • At program startup.

  • When a new thread is created.

  • When a thread references a TLS block for the first time after a shared object is loaded following program startup.

Thread-local data storage is laid out at runtime as illustrated in the figure titled Runtime Storage Layout of Thread-Local Storage.

Runtime Storage Layout of Thread-Local Storage


Runtime Thread-Local Storage Layout