Thread: pthreads and resources

  1. #1
    Registered User
    Join Date
    Jan 2006

    pthreads and resources

    I'm working on a server for a chat program i'm writing, and so far i have it structured to where a loop in main does nothing but sit and wait for a connection, set up the socket stuff, and create a new thread to handle the client, etc.. I've written a little app that shows me the max number of threads per process i'm able to have from limits.h, and it comes up as 16384.

    Now, I know I definitely won't have that many users when i first launch the program, but I want the program to be as scalable as possible. I know that even if I were to have 16364 clients connected and using the service, the server would have plenty of ram left, and I defiitely don't want to waste those resources.

    What is it exactly that limits the number of possible pthreads if ram isn't the issue?

    What could I do to overcome this obstacle? Would a mixture of forks and pthreads be the best solution? Maybe have a top level process that does nothing but create more processes when the other(s) have used up all available pthreads? I'd appreciate any help you could offer.
    Last edited by ubermensch; 02-07-2006 at 02:27 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    How about formatting your posts for readability?

  3. #3
    Registered User
    Join Date
    Jan 2006
    Done. Thanks for the help :/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Yet another n00b in pthreads ...
    By dimis in forum C++ Programming
    Replies: 14
    Last Post: 04-07-2008, 12:43 AM
  2. programming with pthreads in linux
    By kris.c in forum C Programming
    Replies: 4
    Last Post: 07-21-2006, 01:10 AM
  3. pthreads
    By JagWire in forum Windows Programming
    Replies: 2
    Last Post: 07-07-2002, 12:52 PM