Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Thread Local Area (TLA) and Thread Stack Size (Xss)?

As i read from:

http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/tune_app_thruput.html#wp998772

the TLA is: Thread Local Areas (TLAs) are chunks of free memory used for object allocation. The TLAs are reserved from the heap and given to the Java threads on demand, so that the Java threads can allocate objects without having to synchronize with the other Java threads for each object allocation.

I supposed that the Thread Stack area is used for this purpose (and also keep the stuck calls).

What exactly is the difference?

like image 342
mspapant Avatar asked Oct 17 '12 06:10

mspapant


2 Answers

As the definition says the Thread Local Area is a portion of the heap where each thread can allocate objects. All threads access the same heap: Thread 1 can access objects created by Thread 2 and vice-versa; TLA separates the heap only for object allocation: each thread can only allocate objects in that area, but can access any object in the heap.

The thread stack is a portion of the stack; each thread has its own stack and the thread stack size mentions the size of the stack. A thread cannot access the stack of other threads.

like image 175
Random42 Avatar answered Sep 22 '22 14:09

Random42


TLAs are part of the heap. Stacks are not on the heap.

See this other question if you don't understand the difference between stack and heap.

like image 21
Laurence Gonsalves Avatar answered Sep 20 '22 14:09

Laurence Gonsalves