On Thu, Mar 5, 2009 at 16:35, Srinivas G.
<srinivasg_at_[hidden]> wrote:
>> On Mar 5, 2009, at 8:46 AM, Srinivas G. wrote:
>>
>> > Please let me know whether the plpa_sched_getaffinity and
>> > plpa_sched_setaffinity are equivalent to the Windows
>> > GetProcessAffinityMask and SetThreadAffinityMask /
>> > SetProcessAffinityMask API.
>>
>
> Dear All,
>
> I found that these sched_setaffinity and sched_getaffinity are almost
> equivalent to the Windows SetProcessAffinityMask and
> GetProcessAffinityMask. However, I did not understand the
> SetThreadAffinityMask equivalent API. I guess, I shall need to use the
> sched_setaffinity API with thread id is the 1st argument. But, the
> argument to the sched_setaffinity is pid_t where as thread id is
> pthread_t type. My question is, shall I type cast the pthread_t to pid_t
> type like
>
> sched_setaffinity((pid_t)pthreadid, sizeof(cpu_set_t), &mask)
>
> Please let me know, how can I pass the pthread_t (thread id) type to a
> sched_setaffinity API which takes as pid_t. There is a API gettid()
> which returns the thread id of the current process. My requirement is a
> bit different that from one thread I will set the affinity of the
> another thread. So, I need to pass the thread id of a different process
> not the current process.
>
For POSIX threads there is this API:
pthread_attr_getaffinity_np(3)
pthread_attr_setaffinity_np(3)
pthread_getaffinity_np(3)
pthread_setaffinity_np(3)
Which takes a pthread_t or pthread_attr_t as argument, respectively.
Bert
> Please suggest me.
>
> Thanks and Regards,
> Srinivas G
>
> _______________________________________________
> plpa-users mailing list
> plpa-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/plpa-users
>
|