04-12-2013
Issue using taskset on Linux
I am using taskset command to set the affinity for a process on RedHat5 machine. However I am observing some strange behavior with the taskset command.
/proc/cpuinfo for my machine shows that I have 2 cores and one processor with no support for hyperthreading.
When I run the command as
taskset -p <PID>
It returns the affinity as 3, but since I have only two cores why it is returning 3?
When I try to launch a process with setting affinity as 2/3, it gives argument error and accepts only 0 and 1 as argument.
Other strange behavior is when I run any command as "taskset -c 0 nedit", then when I query it using "taskset -p <PID>", it returns 1 (Shouldn't it return 0??)
Similarly on running a process with affinity set to 1, shows 2 when queried using taskset -p.
Can someone please explain this behavior.
10 More Discussions You Might Find Interesting
1. SuSE
I apologize in advance if this is the wrong forum for this
Alright, I am a long time Microsoft user (games of course). I have installed Linux in the past, but not on this computer. Brand new computer, have been using it extensively for the past month or so, and recently I just had the urge... (9 Replies)
Discussion started by: Wyzer1
9 Replies
2. Red Hat
If PATH is set to ../bin:../sbin:/usr/bin:/usr/local/bin (chunk of path string). Sometime when I try to execute ls command it says ../bin/ls not found. According to my understanding "ls" should be searched in all the path varibales that we set in the PATH varaibale.
Is there any reason for the... (5 Replies)
Discussion started by: hansini
5 Replies
3. Red Hat
Hi All,
I had installed Red HAt Linux on Virtual PC.
I completed installation and then 1 pop up asks for removing CD from drive and rebooting the system.
I had done same. But afetr reboot nothing is displayed on the screen.
What is the actual problem????
Kindly provide me the solution .... (1 Reply)
Discussion started by: sunray
1 Replies
4. Linux
Hi folks.
When issuing a multipath -ll on my server, i see something that is bugging me...
# multipath -ll
2000b0803ce002582 dm-10 Pillar,Axiom 600
size=129G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 0:0:0:4 sdd 8:48 active ready running... (0 Replies)
Discussion started by: Stephan
0 Replies
5. Emergency UNIX and Linux Support
Hi All,
I have an issue with linux acls, though I have implemented them I failed to foresee the issue.Now the server is in production and I would have to take down time to rectify it. And I hereby declare that this is not homework.
The situation is as such
I have a file system mounted with... (5 Replies)
Discussion started by: maverick_here
5 Replies
6. Red Hat
Hi,
:wall:
I am not able to run any utility command in Redat, Please see the below example and suggest me how I shall run this type of command.
$ su
Password:
# ifconfig
bash: ifconfig: command not found
# which ifconfig
/usr/bin/which: no ifconfig in... (3 Replies)
Discussion started by: pradipta_pks
3 Replies
7. Red Hat
Dear all,
When ever i login to linux box through putty , it is taking a long time to log in .....approx 2 min
Kindly let me know any reason behind this.... (3 Replies)
Discussion started by: jegaraman
3 Replies
8. Linux
Hi All,
typeset -Z4 curtime command is giving different result than expected inside scripts in linux.But it gives expected results outside the scripts.Can you please help us
---------- Post updated at 05:37 AM ---------- Previous update was at 05:25 AM ----------
curTime=`date +%H%M`... (5 Replies)
Discussion started by: sumqwe
5 Replies
9. UNIX for Beginners Questions & Answers
Hello,
I am on a Mac and trying to clean up some monthly files with a very simple SED:
sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt
(from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file)
then output to output.txt
Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies
10. UNIX for Beginners Questions & Answers
I was using PureVPN (with openvpn) on my windows machines and thought I'd try setting that up on linux mint 19.1 (xfce 32 bit).
I followed complete installation process given on their website and all was working fine until I had to move the renamed config file into the openvpn folder.
... (2 Replies)
Discussion started by: ericaustin
2 Replies
LEARN ABOUT POSIX
taskset
TASKSET(1) User Commands TASKSET(1)
NAME
taskset - set or retrieve a process's CPU affinity
SYNOPSIS
taskset [options] mask command [argument...]
taskset [options] -p [mask] pid
DESCRIPTION
taskset is used to set or retrieve the CPU affinity of a running process given its pid, or to launch a new command with a given CPU affin-
ity. CPU affinity is a scheduler property that "bonds" a process to a given set of CPUs on the system. The Linux scheduler will honor the
given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the
scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU
affinity is useful only in certain applications.
The CPU affinity is represented as a bitmask, with the lowest order bit corresponding to the first logical CPU and the highest order bit
corresponding to the last logical CPU. Not all CPUs may exist on a given system but a mask may specify more CPUs than are present. A
retrieved mask will reflect only the bits that correspond to CPUs physically on the system. If an invalid mask is given (i.e., one that
corresponds to no valid CPUs on the current system) an error is returned. The masks may be specified in hexadecimal (with or without a
leading "0x"), or as a CPU list with the --cpu-list option. For example,
0x00000001 is processor #0,
0x00000003 is processors #0 and #1,
0xFFFFFFFF is processors #0 through #31,
32 is processors #1, #4, and #5,
--cpu-list 0-2,6
is processors #0, #1, #2, and #6.
When taskset returns, it is guaranteed that the given program has been scheduled to a legal CPU.
OPTIONS
-a, --all-tasks
Set or retrieve the CPU affinity of all the tasks (threads) for a given PID.
-c, --cpu-list
Interpret mask as numerical list of processors instead of a bitmask. Numbers are separated by commas and may include ranges. For
example: 0,5,8-11.
-p, --pid
Operate on an existing PID and do not launch a new task.
-V, --version
Display version information and exit.
-h, --help
Display help text and exit.
USAGE
The default behavior is to run a new command with a given affinity mask:
taskset mask command [arguments]
You can also retrieve the CPU affinity of an existing task:
taskset -p pid
Or set it:
taskset -p mask pid
PERMISSIONS
A user can change the CPU affinity of a process belonging to the same user. A user must possess CAP_SYS_NICE to change the CPU affinity of
a process belonging to another user. A user can retrieve the affinity mask of any process.
SEE ALSO
chrt(1), nice(1), renice(1), sched_getaffinity(2), sched_setaffinity(2)
See sched(7) for a description of the Linux scheduling scheme.
AUTHOR
Written by Robert M. Love.
COPYRIGHT
Copyright (C) 2004 Robert M. Love. This is free software; see the source for copying conditions. There is NO warranty; not even for MER-
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AVAILABILITY
The taskset command is part of the util-linux package and is available from https://www.kernel.org/pub/linux/utils/util-linux/.
util-linux August 2014 TASKSET(1)