Linux Process
Max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 2
kernel/fork.c:fork_init()
sysctl: KERN_MAX_THREADS
proc/sys/kernel/threads-max
Links of processes
task_struct: UNIX proc structure + u area;
struct task_struct *next_task, *prev_task;
struct task_struct *pidhash_next, **pidhash_pprev;
fork(), exit() and ptrace(), must take tasklist_lock for WRITE. the writers must also disable interrupts on the local CPU
- volatile long state; /* -1 unrunnable, 0 runnable, ɬ stopped */
#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define TASK_UNINTERRUPTIBLE 2
#define TASK_ZOMBIE 4
#define TASK_STOPPED 8
#define TASK_EXCLUSIVE 32