Gentoo Archives: gentoo-user

From: Etaoin Shrdlu <shrdlu@×××××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ps command
Date: Thu, 24 Jul 2008 15:30:48
Message-Id: 200807241732.10353.shrdlu@unlimitedmail.org
In Reply to: Re: [gentoo-user] ps command by Alan McKinnon
1 On Thursday 24 July 2008, 17:09, Alan McKinnon wrote:
2
3 > > What does it mean a process is "sleeping", technically?
4 >
5 > It's a misnomer, it means "not running".
6 >
7 > The cpu gives the illusion of executing many tasks simultaneously. In
8 > reality, it is executing them one at a time and very rapidly (many
9 > times a second) switching between them.
10 >
11 > Normally at a given instant in time, one task is running per cpu. The
12 > rest are mostly waiting their turn or sleeping. There are various OS
13 > strategies for bringing this about - some rely on the task itself to
14 > back out after a running for a short while, sometimes the OS kernel
15 > enforces it, sometimes you have a combination. If everything is
16 > working nicely, the end result is pretty much the same.
17 >
18 > There's another state worthy of note - blocked. This is when a task is
19 > waiting for something else to happen first (most often disk or network
20 > I/O) so it won't try and execute till that other thing happens. This
21 > is not the same as sleeping. Sleeping is spinning you wheels in idle,
22 > blocked is a deliberate stop and sit back and wait.
23
24 From what I know, "blocked" is the same as "sleeping", ie waiting for
25 something to happen. Tasks that have completed their time slice and are
26 forced by the scheduler to stop, are not "sleeping"; they are
27 re-inserted in the queue of the runnable processes, and the scheduler
28 picks them up again from there when another time slice is assigned to
29 them. These processes are in the "runnable" or "ready" state.
30
31 But of course I may be wrong, so corrections welcome.

Replies

Subject Author
Re: [gentoo-user] ps command "b.n." <brullonulla@×××××.com>