Re: Confirmation Needed - Run Queues include both running and waiting

From: Yong Huang <yong321_at_yahoo.com>
Date: Fri, 8 Mar 2013 11:08:31 -0800 (PST)
Message-ID: <1362769711.45265.YahooMailClassic_at_web184803.mail.gq1.yahoo.com>



> the RunQueue length as reported by sar includes *both* processes on
> CPU and processes waiting for CPU.
> http://shallahamer-orapub.blogspot.com/2010/07/os-cpu-run-queue-not-what-it-appears.html
> (Particularly on Linux)

Linux may be the only one among today's popular OS's that mixes running and runnable. Not sure why it does that. Maybe to simplify the scheduler code. In Linux source code, you see lines like this

https://www.kernel.org/pub/linux/kernel/people/rml/sched/for_alan/200-sched-yield.patch

+ * yield - yield the current processor to other threads.
+ *
+ * this is a shortcut for kernel-space yielding - it marks the
+ * thread runnable and calls sys_sched_yield().
+ */
+void yield(void)
+{
+	set_current_state(TASK_RUNNING);

where "runnable" and "running" are used interchangeably.

In Windows, e.g., a thread state can be any of Ready, Standby, Running, Waiting, Transition, Terminated. (Newer verions have a few more.) Solaris has free, sleep, run (actually runnable), onproc (i.e. running), zomb, stopped.

Yong Huang

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 08 2013 - 20:08:31 CET

Original text of this message