Hi, > In function do_fork (), i see that we allocate some pidmap. > Could someone please tell me - > what is pidmap ? > what is its use? > While creating a new process, we need to allocate and initialize a "struct pid" for it. In alloc_pid(), the kernel tries to allocate & initialize the fields of struct pid. One of the fields ("nr") is the actual NUMERIC pid (visible to user and for all other purposes) and it is initialized using alloc_pidmap(). The pidmap is just an efficient way to keep track of which all process IDs (numbers) are in use and which ones are not. Basically we keep a bitmap of all the possible PIDs (1 bit for each PID). The bit is set/unset depending upon whether the PID is alloted to some process or not. alloc_pid() determines the number by simply checking the first bit that is set in the map. Thanks, Rajat -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ