Re: List of running processes in C++
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Mon, 14 Jul 2008 16:21:17 -0700 (PDT)
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
.
- Follow-Ups:
- Re: List of running processes in C++
- From: jbo5112
- Re: List of running processes in C++
- References:
- List of running processes in C++
- From: jbo5112
- Re: List of running processes in C++
- From: David Schwartz
- Re: List of running processes in C++
- From: jbo5112
- List of running processes in C++
- Prev by Date: Re: Pls sanity check: semtimedop(2) for FreeBSD
- Next by Date: unix information
- Previous by thread: Re: List of running processes in C++
- Next by thread: Re: List of running processes in C++
- Index(es):
Relevant Pages
|