Re: multithreading limits?
Re: multithreading limits?
- Subject: Re: multithreading limits?
- From: Mark Dalrymple <email@hidden>
- Date: Sun, 29 Dec 2002 14:05:23 -0500
Hi Ben,
> what are the limits, if any other than simply the power of the
computer, with
> multithreading? how many threads can you have? i'm hoping that you
can have a
> large number of them.
Depends on what you mean by a 'large number'. dozens? hundreds?
thousands?
more? On other systems I've successfully had thread counts in the high
hundreds for a threaded web server.
> what are the issues with a large number of threads?
It all depends on what you're planning on doing with them. If they're
all
computationally expensive, you're going to be wasting CPU as the
scheduler
bounces between threads. If the threads are all banging the same data
structure, you could have lock contention and serialization. Plus
all the usual "fun" with threaded programming like race conditions.
If you're mainly blocking on I/O, then having a bunch of threads will
be less of an issue. (then again, maybe multiplexing the I/O through
select() or CFRunLoop may make more sense.)
Also remember that threads take up resources. They occupy a slot in
the scheduler, each thread has a chunk of memory to use as a stack. If
you're doing cocoa stuff in each thread you'll need an autorelease
pool, etc, etc.
> are a large number of threads feasable? (the threads themselves will
be
> relatively simple/small, but i'm hoping to be able to have a lot of
them).
Probably the best thing to do is to just wade in and try it, and see
what happens.
Cheers,
++Mark Dalrymple. email@hidden
http://borkware.com
"Anyway kids, have fun, play nicely, be good. And remember - if it
ain't broke, hit it again."
-- Foon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.