Subj : Re: How to bind a POSIX thread to a specific CPU? To : comp.unix.tru64,comp.programming.threads From : David Butenhof Date : Mon Jun 20 2005 01:13 pm Loic Domaigne wrote: > Hello Ioannis, > > I have cross-posted to comp.programming.threads, since there are people > hanging there known to be proficient in both (POSIX) threads and Tru64. > > Loic. > >> I am developing a multithreaded application using POSIX threads and I >> would like to bind each thread to a different processor. I found that >> there is the pthread_use_only_cpu() function which does what I need, >> but it is available only under Tru64 5.1A and later. >> >> Unfortunately, the system I am using has Tru64 5.1 and this function >> is not available. Is there another way to do this? I read some things >> about RADs (Resource Affinity Domains), but I am not certain whether >> they can be used to achieve what I like to do. To be honest, I am >> quite confused about what RADs are and how they are used and I would >> like to have some more information about them. Are RADs managed only >> by administrators? Can I create RADs from inside my application and >> bind the threads to specific processors in a RAD? If so, how is this >> done? Is there a pointer to documantation that explains step-by-step >> the usage of RADs? Or am I on a totally wrong path to implement >> binding of threads on processors? "RAD" is the term used by Tru64 UNIX for a "resource locality" on a NUMA (non-uniform memory) system -- Alpha "Wildfire" and "Marvel" hardware platforms. On a uniprocessor or traditional SMP system there's only one RAD. They're hardware-oriented, so there's no way to create or change them from software; only to control the allocation of resources among them. As for binding... the first question for Ioannis would be "why would you want to do that"? The unusual name "use_only_cpu" was carefully chosen; binding is rarely an advantage to the application, and far more likely to be harmful. (When you bind to a CPU you're still competing with other threads for access to that CPU, but you're unable to use another that's completely idle.) There ARE cases where binding is useful or even critical; but far more often binding is used by people who not only have no real idea what they're doing (or why) but who also lack the resources and knowledge to perform and understand the measurements that would prove they'd made a mistake. Anyone who really needs binding on Tru64 UNIX (especially in a NUMA environment) ought to be running V4.1B anyway, not V5.1; for a lot of reasons. If you really can't or won't upgrade, you'll need to figure out the unsupported and largely undocumented depths of the Mach core functions in Tru64 UNIX. It is possible, but it's not trivial. -- Dave Butenhof, David.Butenhof@hp.com HP Utility Pricing software, POSIX thread consultant Manageability Solutions Lab (MSL), Hewlett-Packard Company 110 Spit Brook Road, ZK2/3-Q18, Nashua, NH 03062 .