Re: AW: [ROOT] TThread: What can be done in a thread?

From: Marc Hemberger (hemberger@realtech.de)
Date: Tue Oct 30 2001 - 15:57:03 MET


Hi Joern,

Joern Adamczewski wrote:

> .... (By the way, what is TMonitor::Select in a thread
> good for if each thread can receive from his dedicated TSocket anyway?)

The overhead of thread creation for each socket (possibly one for receive, one for
sending) is sometimes okay. In other cases, I would prefer a Select() within one
thread which does the same job. Let me explain:

On some platforms, it is absolutely necessary to be very cautious with threads. I
have application development experience on HP-UX, AIX, Tru64, SUN and Linux
respoectively. On Linux, as the Go4 platform, it might be okay to be so generous
with threads. On other Unixes, I would not dare to do so. E.g. the standard setting
in HP-UX 11.00 for the maximum number of threads in a process is 64. For Linux it
is by default 256, so you are probably safe.

But, when this number is exhausted, it's game over. So you can calculate now in
Go4, how many clients you can have in your server. Second point: each thread
created has a stack size of 2MB on Linux by default (100 kB on HP, Tru65 and AIX).
This might not be a problem nowadays with large memory, but you should also take
that into account for your server.

I could give you the numbers also for the other OS's, if you like. And if you want,
I can give you a hint on literature on especially the topic of concurrent and
networked objects.

But never mind,

Greetings,

Marc

--
-----------------------------------------------
realTech system consulting GmbH
Dr. Marc Hemberger      Tel.: (+49)6227/837-315
Development             Fax: (+49)6227/837-291
Industriestrasse 39c    mailto:hemberger@realTech.de
69190 Walldorf, Germany http://www.realTech.de



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET