12-17-2012
Or you can use the GNU-specific pthread_setaffinity_np() to set CPU affinities on a per-thread basis.
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Does anyone know how to setup processor affinity on Redhat AS3.0. I know how to do this on Solaris and Windows..
Thanks (2 Replies)
Discussion started by: sssow
2 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
What is the command to identify whether a processor is single core / dual core in solaris ?
Thanks. (2 Replies)
Discussion started by: RAA
2 Replies
3. UNIX for Dummies Questions & Answers
How to set the name of the group and the owner while creation of the file?
-rwxrwxr-x 1 root sys 1202 Dec 5 2002 abc.awk
like here i need to set the name of root and sys to xxx xxx
Any help is appreciated.
Thanks. (2 Replies)
Discussion started by: nehak
2 Replies
4. Solaris
First of all I'm new to solaris. Today is the first day i'm practicing zones.
In global zone i have created a two separate pools of 2CPU's and created a email-zone and a web-zone as given in a PDF. I deleted the 2 zones in the processor sets. How can i destroy the processor set and i want my... (2 Replies)
Discussion started by: breaker64
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
How can I restrict access to a set of people in a group on a directory?
Ex.. The following are the permissions on a directory (dir1)
rwxrwxr-- own1 grp1 dir1
where own1 is the owner
grp1 is the group name
and dir1 is the directory name.
So., Is there any way that only few id's in... (0 Replies)
Discussion started by: brahmi
0 Replies
6. Solaris
I configured the the pset1 with 2 different ways
1. poolcfg -c 'create pset pset1 (uint pset.min = 5; uint pset.max = 5)'
pset pset1
int pset.sys_id 1
boolean pset.default false
uint pset.min 5
uint pset.max 5
string pset.units population
uint pset.load 7
uint pset.size 5
string... (0 Replies)
Discussion started by: fugitive
0 Replies
7. Solaris
Hi Gurus
Can someone help me in explaining the below outputs .
psrinfo -p
4
/usr/sbin/psrinfo -pv
The physical processor has 4 virtual processors (0-3)
SPARC64-VI (portid 1024 impl 0x6 ver 0x93 clock 2150 MHz)
The physical processor has 4 virtual processors (8-11)
SPARC64-VI... (3 Replies)
Discussion started by: ningy
3 Replies
8. Solaris
Hi
I have a pool name yuk-pool and its associated pset is yuk-pset. It has a min value is 20 and max value is 56. But size field has 48 value . This same pool is assign to 4 local zones. Whenever Cpu usage is high on one local zone it impact the cpu usage at other local zone as well during high... (1 Reply)
Discussion started by: sb200
1 Replies
LEARN ABOUT FREEBSD
pthread_setaffinity_np
PTHREAD_AFFINITY_NP(3) BSD Library Functions Manual PTHREAD_AFFINITY_NP(3)
NAME
pthread_getaffinity_np, pthread_setaffinity_np -- manage CPU affinity
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread_np.h>
int
pthread_getaffinity_np(pthread_t td, size_t cpusetsize, cpuset_t *cpusetp);
int
pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpusetp);
DESCRIPTION
pthread_getaffinity_np() and pthread_setaffinity_np() allow the manipulation of sets of CPUs available to the specified thread.
Masks of type cpuset_t are composed using the CPU_SET macros. The kernel tolerates large sets as long as all CPUs specified in the set
exist. Sets smaller than the kernel uses generate an error on calls to pthread_getaffinity_np() even if the result set would fit within the
user supplied set. Calls to pthread_setaffinity_np() tolerate small sets with no restrictions.
The supplied mask should have a size of cpusetsize bytes. This size is usually provided by calling sizeof(cpuset_t) which is ultimately
determined by the value of CPU_SETSIZE as defined in <sys/cpuset.h>.
pthread_getaffinity_np() retrieves the mask from the thread specified by td, and stores it in the space provided by cpusetp.
pthread_setaffinity_np() attempts to set the mask for the thread specified by td to the value in cpusetp.
RETURN VALUES
If successful, the pthread_getaffinity_np() and pthread_setaffinity_np() functions will return zero. Otherwise an error number will be
returned to indicate the error.
ERRORS
The pthread_getaffinity_np() and pthread_setaffinity_np() functions may fail if:
[EDEADLK] The pthread_setaffinity_np() call would leave a thread without a valid CPU to run on because the set does not overlap with
the thread's anonymous mask.
[EFAULT] The cpusetp pointer passed was invalid.
[ESRCH] The thread specified by the td argument could not be found.
[ERANGE] The cpusetsize was either preposterously large or smaller than the kernel set size.
[EPERM] The calling thread did not have the credentials required to complete the operation.
SEE ALSO
cpuset(1), cpuset(2), cpuset_getid(2), cpuset_setid(2), pthread(3), pthread_attr_getaffinity_np(3), pthread_attr_setaffinity_np(3)
STANDARDS
The pthread_getaffinity_np and pthread_setaffinity_np functions are non-standard FreeBSD extensions and may be not available on other operat-
ing systems.
HISTORY
The pthread_getaffinity_np and pthread_setaffinity_np function first appeared in FreeBSD 7.2.
AUTHORS
The pthread_getaffinity_np and pthread_setaffinity_np functions were written by David Xu <davidxu@FreeBSD.org>, and this manpage was written
by Xin LI <delphij@FreeBSD.org>.
BSD
March 23, 2010 BSD