From: "Richard Nairn" <Richard@nairnconsulting.ca>
To: "Darío Mariani" <mariani.dario@gmail.com>,
linux-c-programming@vger.kernel.org
Subject: Re: Thread scheduling on an SMP
Date: Thu, 23 Dec 2004 10:08:48 -0700 [thread overview]
Message-ID: <opsjg0kyykizdgzp@mail.nairnconsulting.ca> (raw)
In-Reply-To: <84bd26ef04122305146c8f8a89@mail.gmail.com>
If I am reading your question correctly, you are talking about schedular
affinity. You can set which processors you would like to assign pid's to.
You need a kernel after 2.5.8 for thiese functions...
Excerpt:
#include <sched.h>
int sched_setaffinity(pid_t pid, unsigned int len, unsigned long *mask);
int sched_getaffinity(pid_t pid, unsigned int len, unsigned long *mask);
DESCRIPTION
sched_setaffinity sets the CPU affinity mask of the process denoted by
pid. If pid is zero, then the current process is used.
The affinity mask is represented by the bitmask stored in mask. The least
significant bit corresponds to the first logical processor number on the
system, while the most significant bit corresponds to the last logical
processor number on the system. A set bit corresponds to a legally
schedulable CPU while an unset bit corresponds to an illegally schedulable
CPU. In other words, a process is bound to and will only run on processors
whose corresponding bit is set. Usually, all bits in the mask are set.
The argument len is the length of the data pointed to by mask. Normally
this is the size of a word on the system. For compatibility with future
versions of the Linux kernel, since this size can change, the bitmask
supplied must be at least as large as the affinity mask stored in the
kernel.
The function sched_getaffinity writes into the pointer supplied by mask
that is size len the affinity mask of process pid. If pid is zero, then
the mask of the current process is returned.
On Thu, 23 Dec 2004 10:14:17 -0300, Darío Mariani
<mariani.dario@gmail.com> wrote:
> Hello:
> I have a machine with 4 processors, and I wold like to make the
> following: Set 1 processor to do general stuff using the default
> scheduler and the other three working on my program exclusively, with
> the realtime or my own thread scheduler.
> Is this possible?, thanks for any comment or links to documentation
> you can give me.
>
> Darío
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
| Richard Nairn Specializing in Linux
| Nairn Consulting Web / Database Solutions
| Calgary, AB
| Richard@NairnConsulting.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-12-23 17:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-23 13:14 Thread scheduling on an SMP Darío Mariani
2004-12-23 17:08 ` Richard Nairn [this message]
2004-12-24 13:14 ` file deletion Andy
2004-12-23 13:49 ` Jan-Benedict Glaw
2004-12-27 3:50 ` J.
2004-12-30 11:26 ` Glynn Clements
2004-12-30 12:04 ` wwp
2005-01-01 11:09 ` Andy
2004-12-31 17:55 ` Jan-Benedict Glaw
2005-01-06 7:07 ` Linux source code: malloc.c Venkatesh Joshi
2005-01-06 9:11 ` Steven Smith
2005-01-06 15:27 ` davidgn
2005-01-06 16:10 ` Steven Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=opsjg0kyykizdgzp@mail.nairnconsulting.ca \
--to=richard@nairnconsulting.ca \
--cc=linux-c-programming@vger.kernel.org \
--cc=mariani.dario@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).