Max. Thread Amount of Windows XP and / or Windows Server 2003

  • Thread starter Thread starter roni schuetz
  • Start date Start date
R

roni schuetz

Hi @ll,

I'm working on a web project which has to use multiple channels to
connect to receive several sources at once. The problem is, that I'm
not aware of the maximum amount of Threads i can allocate to my
channels.

Can i open 10 threads, 100 threads even 1000?

is there a general answer to it. my dev. environment runs on win. xp
and the application will run on a ms server 2003.

Kind regards,
Roni Schuetz
 
You can open a whole lot of threads (I believe the actual hard limit is
maxshort) but this would not work very well as your threads would just
context switch each other to death. It should be sufficient to say that you
can open as many as you need but remember the more you open, the more
context switching will have to occur.

Cheers,

Greg
 
I guess at least number of channels (of source of data) would be
limited.
You can break your functionality into out of process workers (separate
exe files), which you invoke them for each channel, and internally they
handle one channel in a multi-threaded way.

Monitor.exe -> Reads Number of Sources and Configs.
-> Invokes ChannelHandler.exe
ChannelHandler.exe -> Handles one channel, as info provided by the
monitor.
-> Does work using multiple threads and all that
synchronization and collaboration amongst the threads.
 
Greg,
Be aware that each thread consumes 1Meg of virtual address space. In XP,
that means just short of 2048 threads will run you out of memory no matter
how much you have (any process is limited to 2Gig of user space). Now, if
you create 2000 threads it takes FOREVER to exit them all (I'm talking
minutes!) so anyone trying anywhere near that many is nuts.
Bob
 
If you use a ThreadPool then you can specify how many it should actually
run at once.
Remember that each processor only truly runs one thread at a time. The OS
will emulate threads, but if you're on a 2 CPU machine then the third
thread will not run in parallel (although if you run two DUO's then you
will get 4 threads :) ), so plan any channel buffering carefully.

Cheers,
Jason
 
Back
Top