How many threads?

T

Thomas Weidenfeller

Ike said:
Is anyone aware of how any Runnables I can instantiate under Win XP? Thanks,

It depends in which wall you manage to run first. No one knows exactly,
because there are several boundaries, which not only depend on the OS,
but e.g. also on the actual hardware (amount of memory, etc.).


/Thomas
 
O

opalpa

One huge factor is what kind of threading model is available. Not only
does the count of threads available vary by way more than one order of
magnitute but the speed of creation can easily vary by two orders of
magnitude. I don't know if multiple threading models are available in
Java under XP.

http://www.geocities.com/opalpaweb/
 
G

grahamdstewart

Ike,

Why do you need to know? If you're running up against a limit it would
suggest that some re-design should be considered.

cheers

Graham
 
T

Thomas Hawtin

Ike said:
Is anyone aware of how any Runnables I can instantiate under Win XP? Thanks,

Running threads? A few thousand on 32-bit Windows. The key factor is not
memory, but virtual address space.

Each stack is contiguous. It doesn't have to be this way - a popular
procedure calling standard on ARM processors used chunks allocated on
the heap. However, having the stack in one piece is marginally faster,
particularly if you are deficient in registers.

I guess you know 32-bit machines have 4 GB logical address spaces
(typically). Some of that will be taken up by the heap and shared
libraries (DLLs) in awkward places. How man stacks, and therefore
threads, you can have depends on the address space left and the size of
the stack. You can get more threads in by lowering the stack size, which
in Sun JRE is done with -Xss. Note, only the first page needs to be
physically allocated at first. Others can be allocated on demand.

A well known benchmark that stresses number of threads is VolanoMarks.
Possibly this is responsible for the lowering of default stack sizes
(which can be a problem when, say, using serialisation).

http://www.volano.com/report/index.html

Tom Hawtin
 
R

ricky.clarkson

Is anyone aware of how any Runnables I can instantiate under Win XP

Runnables aren't threads. Runnables aren't even instantiable. You
need to implement the Runnable interface to make something that is
instantiable, and as such, the number of those implementations that you
can instantiate depends entirely on the implementation.

Normally an unbounded number.

A thread pool might be useful if you are really talking about
instantiating lots of Thread objects.
 
J

jladd

While is it good to know how many threads you can create, the other
thing to know is how to pool them,
as thread creation is expensive and in some situations reduces
performance.

Rgs, James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top