Prev: Help flag for widgets
Next: expr oddity?
From: Bob Techentin on 11 May 2010 10:37 I may soon have an opportunity to work with a massively multi-threaded supercomputer (http://www.cray.com/products/xmt/). You can think of these systems as a million threads running rampant through a terabyte of memory. And they key to performance is lots of threads. Since I'm basically failure averse, and just a little terrified of the thought of a million POSIX threads, I've been thinking about the possibilities of using the Tcl threading model. I found some info in the wiki on thread-specific data structures, some benchmarks, and guidance. But I can't seem to find any information about inherent limitations on the number of threads that you can have. Can I make an application with a million threads? Thanks, Bob
From: Arjen Markus on 11 May 2010 10:55 On 11 mei, 16:37, Bob Techentin <techentin.rob...(a)mayo.edu> wrote: > I may soon have an opportunity to work with a massively multi-threaded > supercomputer (http://www.cray.com/products/xmt/). You can think of > these systems as a million threads running rampant through a terabyte > of memory. And they key to performance is lots of threads. > > Since I'm basically failure averse, and just a little terrified of the > thought of a million POSIX threads, I've been thinking about the > possibilities of using the Tcl threading model. > > I found some info in the wiki on thread-specific data structures, some > benchmarks, and guidance. But I can't seem to find any information > about inherent limitations on the number of threads that you can have. > > Can I make an application with a million threads? > > Thanks, > Bob I do not think there is any limit to the number of threads you can use, but be aware that each thread has its own interpreter. It might get a bit heavy memory-wise if you have a lot of commands loaded per interpreter. Regards, Arjen
From: tom.rmadilo on 11 May 2010 11:59 On May 11, 7:37 am, Bob Techentin <techentin.rob...(a)mayo.edu> wrote: > I may soon have an opportunity to work with a massively multi-threaded > supercomputer (http://www.cray.com/products/xmt/). You can think of > these systems as a million threads running rampant through a terabyte > of memory. And they key to performance is lots of threads. > > Since I'm basically failure averse, and just a little terrified of the > thought of a million POSIX threads, I've been thinking about the > possibilities of using the Tcl threading model. > > I found some info in the wiki on thread-specific data structures, some > benchmarks, and guidance. But I can't seem to find any information > about inherent limitations on the number of threads that you can have. > > Can I make an application with a million threads? Doesn't Tcl use POSIX threads? Tcl's memory model makes it very easy to design a threaded application, but you first need to answer a few questions: what will you be sharing between threads, how do you intend to initialize and manage both threads and interps. What system resources will your threads/interps compete for (such as processors, I/O, database services)? There are very few real world applications which need a million independent and active threads (of logical execution). If this is what you need, and want to use Tcl, figure out how to reduce the memory footprint for each interp. A small one meg interp times 1 million is 1TB. Startup time would be very significant. My guess is that you will run into a practical OS or system resource limitation way before you run out of memory.
From: tom.rmadilo on 11 May 2010 12:34 On May 11, 8:59 am, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > On May 11, 7:37 am, Bob Techentin <techentin.rob...(a)mayo.edu> wrote: > > Can I make an application with a million threads? > My guess is that you will > run into a practical OS or system resource limitation way before you > run out of memory. According to the Cray website, 1,027,072 threads will take 85 Cray XMT cabinets with 96 processors per cabinet, each processor supporting 128 threads. Each thread can access 4 or 8 gig of ram. (Their system max is 8024 processors.) So Tcl memory footprint will not be an issue, you can run a huge Tcl application with 1 million threads on an 85 cabinet Cray XMT system. You should look at AOLserver/NaviServer which has shared data structures (across threads). You don't need to use the HTTP server component, but the application server features (especially scheduled procedures) will help manage thread life-cycle, IPC and Intra-thread communication.
From: Alexandre Ferrieux on 11 May 2010 13:17
On May 11, 4:55 pm, Arjen Markus <arjen.markus...(a)gmail.com> wrote: > On 11 mei, 16:37, Bob Techentin <techentin.rob...(a)mayo.edu> wrote: > > > > > > > I may soon have an opportunity to work with a massively multi-threaded > > supercomputer (http://www.cray.com/products/xmt/). You can think of > > these systems as a million threads running rampant through a terabyte > > of memory. And they key to performance is lots of threads. > > > Since I'm basically failure averse, and just a little terrified of the > > thought of a million POSIX threads, I've been thinking about the > > possibilities of using the Tcl threading model. > > > I found some info in the wiki on thread-specific data structures, some > > benchmarks, and guidance. But I can't seem to find any information > > about inherent limitations on the number of threads that you can have. > > > Can I make an application with a million threads? > > > Thanks, > > Bob > > I do not think there is any limit to the number of threads you can > use, > but be aware that each thread has its own interpreter. It might get > a bit heavy memory-wise if you have a lot of commands loaded per > interpreter. There's also the (fixed, though parametrizable at thread creation) chunk of address space reserved for each thread's C stack. Dunno how far this can be reduced while staying safe. Another bottleneck might lurk in the notifier, if many of these threads have fileevents. Indeed, even if you bump up the max number of fds, select()'s intrinsic unscalability, along with several O(N) scans in the notifier's structures, will hit you :/ -Alex |