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

Re: [ProgSoc] Java threads



On Mon, 8 Feb 1999, Reardon, Benjamin wrote:

: On a Java note, I have a function that calls multiple threads. The problem
: is that there could easily be 5000+ threads in use at any one time. What
: methods are available to tell when there are sufficent system resources to
: permit an extra thread, or to put it another way, how do I know when the
: system is incapable of supporting another thread (apart from the
: program/system falling over)?

The easiest way to do this is to put a limit on the number of threads
that can run at once. You need to keep track of when a thread is started
and stopped. If the next thread to start would go over the limit, block
the caller thread with wait(), or just throw an exception - whichever is
appropriate. Also, the limit should be configurable.

Ryan Heise                             http://www.progsoc.uts.edu.au/~rheise/
=============================================================================
main(){printf("%d != %d, why?\n", sizeof('"')["'"],(sizeof('"'))["]\"\0["]);}
=============================================================================

--
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.

This list is archived at <http://www.progsoc.uts.edu.au/lists/progsoc/>