Re: List of running processes in C++



On Jul 14, 2:30 pm, jbo5112 <jbo5...@xxxxxxxxx> wrote:

They are data processing programs that are either getting run by a
scheduler (e.g cron) or an administrator.  I suppose I could make an
account that these programs always run as, and have them run with
setuid.  It's more work than it's worth in C++ to check /proc for the
information.  It's also not completely uncommon for user X to be
limited by what users Y, Z, A, B, and C are doing.  FTP and HTTP
servers typically limit the number of total number of simultaneous
connections so the machines aren't overloaded.  If you have a
development server where you compile a large program (like Open
Office), you won't want 20 users trying to use every processing core
for this at the exact same time.  If you have a machine to certify
your code with a 10 hr test run, you'll probably want to make sure
that only one person is doing that at a time.  I do understand that
this isn't normal Unix behavior at all and it is something that is
constantly happening with Windows.  I've just run in to one of those
situations where I need to limit usage for performance.

So your question is not "how can I keep two instances of my program
from running at once" it's "how can I ensure there are sufficient
resources for my program"? Is that correct?

It depends on what your outer problem is. What goes wrong if two
copies run at once? The solution is to find the *right* way to prevent
that.

Nothing will break if two copies of the program are run at once.  They
are just data processing programs that require a lot of memory.  If
more than one or two copies are run (depending on the exact program
and data) everything will grind to a halt, especially if the two
copies are running on the same data.

Ahh, so is the question "how can I keep two programs from operating on
the same data"?

 In that case Oracle has to block
and track the duplicate data, and the program has to additionally
track the errors.  I suppose there would be a disaster scenario that
so many copies are running and using so much virtual memory that the
system will never keep up with the schedule, sending the system will
go on a downward spiral, but that is unlikely.  I'm just wanting to
limit the system to running one because that is an easy limit, and
typically all it can handle.  There is only a handful of people who
would be able to run the programs anyway.

Ahh, so perhaps the question is, "how can I verify the resources my
program needs are going to be available?"

I don't suppose these programs fit the Unix paradigm very well, and
hadn't thought about it being so different.  They are more of a
specialty program, maybe like something on a rendering farm.

Figure out what the actual question is. Spend some time thinking about
it. Then post some specific details, and we can give you the right
solution. You may need to look at the CPU usage history, you may need
to look at memory availability, you may need to look at your own
system-wide tracking for your specific application.

But you have to really think about what it is you want to do first.

DS
.



Relevant Pages

  • Re: [Xen-devel] Re: [ANNOUNCE] Xen high-performance x86 virtualization
    ... > oversubscribe the resources they've got, ... We use a proportional fair-share scheduler (Borrowed Virtual ... Memory: Each guest is allocated a share of memory when it is started ... other virtualization of x86 that is capable of running full OSes. ...
    (Linux-Kernel)
  • kernel panic - not syncing: out of memory and no killable processes
    ... Kernel panic - not syncing: Out of memory and no killable processes... ... Re-tune the scheduler latency defaults to decrease worst-case latencies ... # Device Drivers ...
    (Linux-Kernel)
  • IO controller discussion (Was: Re: [PATCH 01/10] Documentation)
    ... address the memory consumption problem (I still need to review your ... scheduler level, and control IO applying proportional weights / absolute ... Anyway, there's no need to provide this with a single IO controller, we ... With proportional weights the whole bandwidth is allocated if no one ...
    (Linux-Kernel)
  • Re: IO controller discussion (Was: Re: [PATCH 01/10] Documentation)
    ... address the memory consumption problem (I still need to review your ... scheduler level, and control IO applying proportional weights / absolute ... Anyway, there's no need to provide this with a single IO controller, we ... With proportional weights the whole bandwidth is allocated if no one ...
    (Linux-Kernel)
  • Re: IO controller discussion (Was: Re: [PATCH 01/10] Documentation)
    ... address the memory consumption problem (I still need to review your ... If there's only a global limit on dirty pages, any cgroup can exhaust ... scheduler level, and control IO applying proportional weights / absolute ... Anyway, there's no need to provide this with a single IO controller, we ...
    (Linux-Kernel)