Monday 7 June 2010

process affinity processor

Linux:


xx@XX:~$ chrt --help
chrt (util-linux-ng 2.14.2)
usage: chrt [options] [prio] [pid | cmd [args...]]
manipulate real-time attributes of a process
-b, --batch set policy to SCHED_BATCH
-f, --fifo set policy to SCHED_FIFO
-i, --idle set policy to SCHED_IDLE
-p, --pid operate on existing given pid
-m, --max show min and max valid priorities
-o, --other set policy to SCHED_OTHER
-r, --rr set policy to SCHED_RR (default)
-h, --help display this help
-v, --verbose display status information
-V, --version output version information

You must give a priority if changing policy.
Report bugs and send patches to


xx@XX:~$ taskset -pc 1 32752
pid 32752's current affinity list: 0
pid 32752's new affinity list: 1



xx@XX:$ taskset --help
taskset (util-linux-ng 2.14.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process

-p, --pid operate on existing given pid
-c, --cpu-list display and specify cpus in list format
-h, --help display this help
-V, --version output version information

The default behavior is to run a new command:
taskset 03 sshd -b 1024
You can retrieve the mask of an existing task:
taskset -p 700
Or set it:
taskset -p 03 700
List format uses a comma-separated list instead of a mask:
taskset -pc 0,3,7-11 700
Ranges in list format can take a stride argument:
e.g. 0-31:2 is equivalent to mask 0x55555555


xx@XX:$ pidstat
Linux 2.6.28-11-generic (XX) 06/07/2010 _i686_ (2 CPU)
01:44:27 PM PID %usr %system %guest %CPU CPU Command
01:44:27 PM 1 0.00 0.00 0.00 0.00 0 init
01:44:27 PM 3 0.00 0.00 0.00 0.00 0 migration/0
01:44:27 PM 4 0.00 0.05 0.00 0.05 0 ksoftirqd/0
01:44:27 PM 6 0.00 0.00 0.00 0.00 1 migration/1

pmap ==> pmap - report memory map of a process

strace ==> strace - trace system calls and signals



WINDOWS:

start cmd_process (you can set the cpu affinity)
taskmgr (you can change the cpu affinity)

No comments:

Post a Comment