On Mon, Jul 14, 2003 at 01:09:15PM -0700, Damon Hastings wrote: > Hey, that's great! I was a little concerned for a moment there. But with > it just swapping a few pointers each context switch, Pth should be much > faster than Linux Pthreads. (And I have 1GB physical RAM, so no worries > about memory consumption.) Can you give me a ballpark idea of the cost per > context switch for 150 threads, almost all of which are waiting on I/O at > any given time? And does Pth block the entire process when all its threads > are blocked? (I would assume so, if you're using a global "select" under > the covers.)
Just as a side note: That is all memory allocated by a single process, you may still need to tell the OS to allow the process to use as much memory as it requires (there are OS-specific limitations to how much a process can grow). 1G of memory is fine but will not by itself solve everything if the application requires a very large footprint. A good technique is to let the administrator decide how much threads are to be running maximum, etc for a production environment, otherwise it would be possible to perform a denial of service attack if a third party user knows how to reliably create new threads. Using a pool of threads which can each serve more than one client is a good idea, or where not adequate, always make sure to internally account and refuse the clients if they exceed the administrator-specified limit... Sorry for my babling but if you're writing a production application you will want to know this. The kernel will kill a process that exceeds it's memory limit per process. That latter is usually configurable by the unix administrator where need be, however. Matt ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ Development Site http://www.ossp.org/pkg/lib/pth/ Distribution Files ftp://ftp.gnu.org/gnu/pth/ Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]