Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

While reading through the Linux Kernel Development by Robert Love, I went through the following line :

The kernel stores the list of processes in a circular doubly linked list called the task list.

I would like to know what is the size of this Task list.

share|improve this question
    
So does he write about the file, in which it is defined? –  user unknown Apr 17 '11 at 11:43
1  
I don't understand the question. Do you mean the number of elements in the list? It's the number of tasks, of course. Do you mean the size occupied by the task list? The nodes are stored in the task data structure, so each takes sizeof(struct task_struct) bytes, but that includes the nodes and all other data. Or did you mean the maximum length of the list? Then the list structure isn't a limiting factor, the limiting factor would be either the limit on PIDs (only 15 bits by default) or the available memory. –  Gilles Apr 17 '11 at 12:21
    
@Gilles: I meant the maximum length of the circular doubly linked list? Or does it have such a restriction or will it grow continuously? –  Sen Apr 17 '11 at 13:27
    
your question should be rephrased as "what is doubly linked list?" And that it can be trivially easy answered by web search. –  alex Apr 18 '11 at 6:15

1 Answer 1

up vote 3 down vote accepted

The task list is stored in a circular doubly linked list; each node is a struct task_struct. The list structure is specifically in the tasks field. There's no separate object in memory to represent the list: each node contains pointers to the previous and next node (some_task->tasks.prev and some_task->tasks.next).

This data structure doesn't have an inherent maximum size. The limiting factor as far as the number of tasks is concerned will be either the available memory for tasks structures and other resources consumed by the tasks, or the number of process (more precisely, task group) identifiers, which are limited to 15 bits by default.

Read chapter 5 of Linux Kernel Development, or chapter 11 of Linux Device Drivers , for more information on this data structure in the Linux kernel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.