Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ps command
Date: Thu, 24 Jul 2008 15:10:26
Message-Id: 200807241709.44433.alan.mckinnon@gmail.com
In Reply to: Re: [gentoo-user] ps command by "b.n."
1 On Thursday 24 July 2008, b.n. wrote:
2
3 >
4 > I jump here to relief my everlasting UNIX ignorance.
5 >
6 > What does it mean a process is "sleeping", technically?
7
8 It's a misnomer, it means "not running".
9
10 The cpu gives the illusion of executing many tasks simultaneously. In
11 reality, it is executing them one at a time and very rapidly (many
12 times a second) switching between them.
13
14 Normally at a given instant in time, one task is running per cpu. The
15 rest are mostly waiting their turn or sleeping. There are various OS
16 strategies for bringing this about - some rely on the task itself to
17 back out after a running for a short while, sometimes the OS kernel
18 enforces it, sometimes you have a combination. If everything is working
19 nicely, the end result is pretty much the same.
20
21 There's another state worthy of note - blocked. This is when a task is
22 waiting for something else to happen first (most often disk or network
23 I/O) so it won't try and execute till that other thing happens. This is
24 not the same as sleeping. Sleeping is spinning you wheels in idle,
25 blocked is a deliberate stop and sit back and wait.
26
27 hth
28
29 alan
30
31
32 --
33 Alan McKinnon
34 alan dot mckinnon at gmail dot com

Replies

Subject Author
Re: [gentoo-user] ps command Etaoin Shrdlu <shrdlu@×××××××××××××.org>