Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > The Linux Kernel
Reload this Page Move process to CPU/Core?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

The Linux Kernel Compiling, theory, programming or other discussion about the linux kernel

Reply
 
Thread Tools Display Modes
Old 04-29-2008   #1 (permalink)
Hoehrer
Just Joined!
 
Join Date: Jan 2007
Posts: 11
Move process to CPU/Core?

With all those Mutli-Core-CPU and Multi-CPU hardware popping up everywhere I really wonder if and how one can define that one process has to use a defined Core/CPU.

The reason I ask is because I wonder if it would be possible to make a separation of CPU-insensitive processes and applications I want to use right now.
I know there is the Linux scheduler that does a pretty good job with that, but it would be pretty cool if one can control this in some way.

Sorry if this should be in another forum, but I thought it is mostly kernel-related, isn't it?

Werner

PS: I do not yet have the hardware to test this yet - I'm just curious
Hoehrer is offline   Reply With Quote
Old 04-29-2008   #2 (permalink)
digvijay.gahlot
Just Joined!
 
Join Date: Mar 2008
Location: Hyderabad
Posts: 88
Each process has cpu_affinity which is a mask of the CPUs on which the process is allowed to run.
If you wish to run your process on a particular CPU all you have to do is just set the cpu_affinity of the process.
digvijay.gahlot is offline   Reply With Quote
Old 04-29-2008   #3 (permalink)
Hoehrer
Just Joined!
 
Join Date: Jan 2007
Posts: 11
Ohhh, many thanks for that info digvijay.gahlot.

Just for the curious, there are some nice command line tools like taskset for that:
"taskset - retrieve or set a processes's CPU affinity Linux Man Page"

Something like this (untested) should work fine:
Code:
taskset  -c1,2 <command>	# Start a process and limit it to 2. and 3. CPU.

taskset  -c1,2 -p<pid>	# Change affinity of existing process to only run on 2. and 3. CPU
Werner
Hoehrer is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 11:04 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0