What is the meaning of "statically distributed"?
http://linux.die.net/man/3/pthread_mutex_init
In cases where the default mutex attributes are appropriate, the PTHREAD_MUTEX_INITIALIZER macro can be used to initialize mutexes that are statically allocated. The effect shall be equivalent to dynamic initialization by calling pthread_mutex_init () with attr specified as NULL, except that no error checks are performed.
I know about dynamic allocation. What is the meaning of "statically distributed"?
My question here is understanding the meaning of "statically" allocated. I posted a quote from the man page to provide only context.
source to share
Statically allocated means the variable is allocated at compile time, not at run time. In C, this can be a global variable in file scope or a variable static
in a function.
A good overview can be found here: http://en.wikipedia.org/wiki/Static_memory_allocation
Variables on the stack (that is, local variables in functions that do not have a keyword static
) are allocated when the function is called, sometimes multiple times when the function is called recursively. Thus, they are conceptually different from static memory allocation (which only happens once per program).
source to share