Re: why is p->state = TASK_UNINTERRUPTIBLE in do_fork()?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Tue Jun 20 2000 - 08:58:48 EST


In article <Pine.LNX.4.21.0006200954010.1564-100000@saturn.homenet>,
Tigran Aivazian <tigran@veritas.com> wrote:
>
>why is the process set to uninterruptible sleep for the short
>(atomic) duration until it is set to TASK_RUNNING? I see no reason for
>that.

Entirely due to hysterical raisins.

The thing is, that Linux originally had no run-queue: it just scanned
the global task array when it needed to schedule something. Shoot me.

And that task array slot was allocated early in fork.c for the new
process to avoid races, and in order to make sure that schedule()
ignored the new half-formed process, it needed to be marked
non-runnable.

Then, when everything was ready, we marked it runnable again.

These days, of course, the run-queue makes this all a non-issue. The
assignment still exists, and probably causes an extra instruction. You
can remove it if you want,

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:19 EST