![]() |
|
| Process | Thread | Process/Thread | |
|---|---|---|---|
| Creation | 3.2ms | 0.014ms | 229 |
| Switch | 0.1-0.2ms | 0.01-0.02ms | 10 |
| Process | Thread | |
|---|---|---|
| TCB in core | 8-10k | 128 byte |
| TCB in disk | 64k | 4K |
In the OS kernel, thread (LWP) is the unit for allocating CPU. In user applications, thread is used to describe parallelism and to issue multiple system calls at the same time.
A exception is the special variable which has the dynamic scope and extent. Since the value of a special variable is restored when its dynamic scope disappears, shared access to these special variables may cause hazard. Therefore, special variables are treated as thread local variables, and they should not to be used as global variables. In order to share the variable-value binding among threads, symbol-value should be referenced.