[lkml]   [2000]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: /proc/nzombies
Hi there.

>> I must say that I think calling the maintaining of the
>> nzombies counter "bloat" is exaggerating.

> It is, because it solves a highly specific problem while
> you could implement a solution that solves a more general
> problem (or a class of problems) that also includes the
> solution for your specific problem. VMS illustrates quite
> nicely what this can lead to.

> I would suggest that you try to implement a more general
> solution.

> Two examples:

> - implement a fast interface to extract essential ps and
> top information (e.g. a single read returns well-defined
> fixed-length records with text or binary content (your
> choice) for multiple or all processes). This would solve
> the most visible problem of /proc, namely the high
> processing overhead of top.

> The zombies counter would be as simple as:

> size = read(fd,huge_buffer,sizeof(huge_buffer));
> zombies = 0;
> for (i = PROC_STATE_OFFSET; i < size; i += RECORD_LENGTH)
> if (huge_buffer[i] == ZOMBIE_STATE)
> zombies++;

More realistically:

maxsize = get_process_count() + 100;
buffer = (ps_rec **) malloc(sizeof(ps_rec * maxsize);
size = get_process_data(buffer);
zombies = 0;
for (i=0; i<size; i++)
if (buffer[i].state == ZOMBIE)

No matter how large you make the buffer, if it's not geared to
the current number of processes, it's ripe for a buffer over-run

> - go one step back and ask yourself why zombies are a
> problem. The probable answer is because they overflow
> your process table.

Am I right in thinking that once a process achieves Zombie
status, it tays as an unschedulable zombie until killed?

If so, then an obvious solution would be to move zombies out of
the process table into a separate linked list (or perhaps into
the /proc/nzombies file) and thus free up the process slots they
used to occupy.

That would probably produce a kernel speedup as well, as the
kernel wouldn't need to scan through the zombies checking they
are zombies when it schedules...

Best wishes from Riley.

* Copyright (C) 1999, Memory Alpha Systems.
* All rights and wrongs reserved.

| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.047 / U:0.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site