• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: threads or processes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: threads or processes?


  • Subject: Re: threads or processes?
  • From: Kaelin Colclasure <email@hidden>
  • Date: Sat, 28 Jan 2006 09:05:28 -0800


On Jan 28, 2006, at 8:25 AM, John Stiles wrote:

Andrew Farmer wrote:
On 28 Jan 06, at 00:55, Andrew Bush wrote:
Im looking at writing an app that will be required to have a number of connections to a remote server going at once, up to 100-200.

Im wondering whether the best design in mac os x would be to use multiple processes...spawn one process for each server and let them do their thing...or whether I would get better performance by handling with them all in one process.

Use a single process. Cocoa will let you add a socket to a process's runloop, so you don't even have to do anything fancy to wait on input. If that doesn't work, then go with threads. Creating a process for each connection is (1) total overkill and (2) will hit the standard per-user ulimit of 100 processes.


In OS X? Are you sure?

MafiaHQ:~ jstiles$ ulimit
unlimited

At any rate, I agree that one process per connection is expensive. However, it's what Apache used to do IIRC (and maybe still does, I don't know), so it can't be /that/ awful.

While there are (debatably) several advantages to Apache's multi- process server architecture, recall that Apache was designed for portability in an era when many Unix systems did not have OS threads. And the OP implies a client implementation. The trade-offs are usually biased differently when implementing a client vs. a server.


In general I would echo Andrew Bush's recommendations. Use a runloop, or threads if you must.

-- Kaelin

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >threads or processes? (From: Andrew Bush <email@hidden>)
 >Re: threads or processes? (From: Andrew Farmer <email@hidden>)
 >Re: threads or processes? (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Warning with NEXT_ROOT environment and libgcc.a
  • Next by Date: Re: CFPreferences
  • Previous by thread: Re: threads or processes?
  • Next by thread: Re: threads or processes?
  • Index(es):
    • Date
    • Thread