I have a 4-CPU Box running RedHat Enterprise 3 up 2 WS. I am attempting to use the nptl/pthread.h library. The only information to date I received on it is in the header file.

What I am trying to do is assign a thread to a CPU using the pthread_attr_setaffinity call. A sample code was written that allowed me to assign up to 4 threads onto whatever CPU. Half the time it seems to work through monitoring top and the other time the loads goes to another CPU. For example, request CPU 0 & 1-- I get 0 & 2, request CPU 0 & 1 & 2 & 3-- I get 0 & 1 & 2 & 3, etc...

Does anybody have additional information on pthread_attr_setaffinity? It's not in the info pages. To me it seems to not fully work. Also does any body know of a tool to monitor thread to CPU, i.e. like top?

Thanks,