Rich Freeman on 18 Apr 2016 13:42:15 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] >32K concurrent processes


On Mon, Apr 18, 2016 at 3:32 PM, Walt Mankowski <waltman@pobox.com> wrote:
> Even with an O(1) scheduler I (and it seems many of the other posters
> in this thread) would be concerned about performance and throughput
> with that many processes. It seems to me that it's possible your
> kernel could be spending a significant amount of time scheduling
> processes.
>

Why would a kernel spend any more time switching between 32,000
processes than 2 processes?

Suppose I have one CPU core.  Suppose I have two processes that each
have an infinite demand for cpu (just have them run loops or
something).

The kernel is going to run one process for a timeslice.  Then it will
task-switch to the other for a timeslice.  Then it will switch back,
and so on.

If you have 32,000 processes all with the same demand what the kernel
does is the same.  It runs each one in turn for a slice, then it
switches.

In a single second you'll have the exact same number of task switches
either way.  Granted, in one scenario it is back and forth between two
processes, and the other it is moving around 32k of them round-robin.
It might not get to all 32k processes in a second either, but it will
still switch tasks the same number of times.  Since the scheduler is
O(1) it will spend the same amount of time doing those switches as
well.

This all assumes that memory use/etc remains constant, etc.

-- 
Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug