Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Operating Systems Software Linux Hardware

Intel Chief Evangelist Comments on Linux Scheduler 178

ByeByeWintel writes "James Reinders is Intel's Chief Evangelist for Intel's Software Development Products. In a recent interview on Devx.com he stated: 'If I could get ONE wish fulfilled would be for OS scheduling to focus on processes, and not threads, for scheduling. And demand that processes manage their scheduling of threads ... There is a lot of opportunity for operating systems to offer these types of control in the 'running of applications' interfaces. I'd like an OS to let me specify the 'world' my application runs in (which processors, how many, etc.) These interfaces are available in Windows at run time (the task manager will let you adjust where a running task can go).'"
This discussion has been archived. No new comments can be posted.

Intel Chief Evangelist Comments on Linux Scheduler

Comments Filter:
  • I don't understand (Score:5, Informative)

    by Junta ( 36770 ) on Friday September 28, 2007 @09:01PM (#20790235)

    I'd like an OS to let me specify the 'world' my application runs in (which processors, how many, etc.) These interfaces are available in Windows at run time (the task manager will let you adjust where a running task can go).'"
    Isn't this *exactly* what numactl gives you (hint, you don't have to run numa for numactly to allow processes to be bound to specific sets of processors).
  • Re:Hello?? (Score:3, Informative)

    by Safiire Arrowny ( 596720 ) on Friday September 28, 2007 @09:34PM (#20790479) Homepage
    Oh, until the second page, which I didn't see.
  • Re:So do it (Score:5, Informative)

    by Anonymous Coward on Friday September 28, 2007 @09:36PM (#20790507)
    Way ahead of you.

    $ sudo apt-get install schedutils
    ...
    Unpacking schedutils (from .../schedutils_1.5.0-1_amd64.deb) ...
    Setting up schedutils (1.5.0-1) ...

    $ man taskset | cat
    Reformatting taskset(1), please wait...
    TASKSET(1) Linux User's Manual TASKSET(1)

    NAME
    taskset - retrieve or set a processes's CPU affinity

    SYNOPSIS
    taskset [options] [mask | list ] [pid | command [arg]...]

    DESCRIPTION
    taskset is used to set or retrieve the CPU affinity of a running pro-
    cess 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 practi-
    cal for performance reasons. Therefore, forcing a specific CPU affin-
    ity 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 corre-
    sponding 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
    are typically given in hexadecimal. For example,

    0x00000001
    is processor #0

    0x00000003
    is processors #0 and #1

    0xFFFFFFFF
    is all processors (#0 through #31)

    When taskset returns, it is guaranteed that the given program has been
    scheduled to a legal CPU.

    OPTIONS
    -p, --pid
    operate on an existing PID and not launch a new task

    -c, --cpu-list
    specifiy a numerical list of processors instead of a bitmask.
    The list may contain multiple items, separated by comma, and
    ranges. For example, 0,5,7,9-11.

    -h, --help
    display usage information and exit

    -V, --version
    output version information 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

  • Re:which processors (Score:3, Informative)

    by adrianmonk ( 890071 ) on Friday September 28, 2007 @09:40PM (#20790533)

    Doesn't Solaris do this already?

    Yes, and has for at least a decade. As has SGI's IRIX and probably a lot of other operating systems. (Linux would be included in that list based on the comments here.)

  • Processor Affinity (Score:1, Informative)

    by Anonymous Coward on Friday September 28, 2007 @09:57PM (#20790633)
    Try Robert Love's "run" command... Processes can be started or moved to any CPU or collection of CPUs.
  • Comment removed (Score:5, Informative)

    by account_deleted ( 4530225 ) on Friday September 28, 2007 @10:23PM (#20790729)
    Comment removed based on user account deletion
  • by EMB Numbers ( 934125 ) on Friday September 28, 2007 @10:25PM (#20790735)
    I think that what Intel's Evangelist wants is already available through standard POSIX pthreads and the POSIX-RT extensions.

    man pset_create, pset_assign, or pset_bind.

    I just checked and it seems that Solaris, HP-UX support this POSIX feature. Maybe it's only Linux that is non-standard: I found ythis quote: http://developers.sun.com/solaris/articles/solaris_linux_app.html [sun.com]

    "Both Linux and the Solaris OS support the notion of binding a process or thread to a processor. Linux allows binding to a set of processors for non-exclusive use of those processors. The Solaris OS allows binding to a set of processors for exclusive use, (that is, CPU fencing), but does not allow binding to a group for non-exclusive use (except via Solaris Zones?). Linux does not have a mechanism for CPU fencing, though implementations can be found on the web (see, for example, the CPUSETS for Linux page on the bullopensource.org site). The Linux system calls that are processor affinity based are sched_setaffinity(2) and sched_getaffinity(2)."
  • by paulbd ( 118132 ) on Friday September 28, 2007 @10:40PM (#20790805) Homepage

    what is being discussed is called "scheduler activations" within the CS community (or was). its an old idea. i did some work on a real-world (hah) implemention back in the early 1990's when i worked at UWashington. google it. Solaris actually added this design at least 10 years ago (plus or minus 2 years). its a very cool OS design, but can also be hard to get the implementation right; it also requires both kernel and userspace implementations.

    the basic idea is that the kernel doesn't try to decide which threads within a task/process should run. as long as the process is scheduled to have access to a CPU, whenever its about to block (e.g. on disk i/o) or to be granted a processor from another task, the kernel tells the user space scheduler what is going on. scheduling is then done in user space, where maximal knowledge about the applications internal design and thread priorities can be easily accessed.

    there are several papers on this design, ranging from Tom Anderson's "original" through reports on various implementation efforts. it was certainly fun trying to write a user space context switch routine that has to be reentrant itself, not to mention trying to deal with priority inversion issues. i think sun simply worked around the latter problem with some design assumptions/limitations, but i don't know for sure.

  • Re:which processors (Score:1, Informative)

    by Anonymous Coward on Friday September 28, 2007 @10:52PM (#20790861)
    Not only that, Sun junked the multi-level scheduler idea in Solaris 9. In Solaris 8 (unless you linked to the alternate thread library named something like /usr/lib/thread/libthread.so) a multithreaded process could have M threads, that would run on N kernel processes (light-weight processes or LWPs). The one process (the one started from main(), etc...) would schedule the threads itself on its N LWPs.

    In other words, while a call to pthread_create() would start a new, separate thread of execution in *your* process, but may or may not start a new kernel-level thread that would run your new execution thread. And a user-level scheduler would schedule your threads on your LWPs. The kernel would schedule the LWPs.

    Sun junked this because it doesn't scale well when you get into hundreds of heavyweight processes and thousands of threads and/or LWPs.

    In Solaris 9 (and the "alternate thread library in Solaris 8), each separate call to pthread_create() spawns an LWP, and there's only one scheduler - the kernel's. There's no longer on in each multithreaded app. (And yes, there were ways to get this one-to-one behavior in Solaris 8 and earlier, but that's not the point...)

    And this guy's saying we should go back to that?

    Sorry, but Sun knows a lot more about massively parallel architecture than Intel does. Intel lives in a world where 8 CPUs is a lot.
  • by Repossessed ( 1117929 ) on Friday September 28, 2007 @11:56PM (#20791151)
    I've had no such issue with the .22 kernel, so likely this is being hammered out as time goes on.
  • Comment removed (Score:4, Informative)

    by account_deleted ( 4530225 ) on Saturday September 29, 2007 @04:44AM (#20792107)
    Comment removed based on user account deletion
  • by mce ( 509 ) on Saturday September 29, 2007 @05:59AM (#20792321) Homepage Journal

    He's an expert at (amonst other things) providing automatically optimised applicaton parallelisation in general, which as such is not available (I can know, I used to be a reaesrch team leader in a company that was working on it as well, but from a power management angle).

    What he said about OS-level schedulers is that he ideally wants them to behave in a specific way, without even saying that specifically Linux needs to be changed (again: there are hundreds of OS-es out there). He has not said that Linux is "behind" or "retarted" anything. He has not said that Intel needs volunteers to do his dirty work for free. The only person who used the word Linux during that interview was the interviewer (as usual, the /. title gets it completely wrong and the /. summary is a composition of two quotes originating from the guy's anwers to two different questions). Read and understand the bloody article before posting nonsense!

    In any case, if the thing has been available for many years and people are to be ridiculed for seemingly not knowing that, they what the hell are Ingo and Con fighting about? They must be non-experts doing useless work. Both of them.

  • Re:Ignorant Comment (Score:2, Informative)

    by boredhacker ( 1103107 ) on Saturday September 29, 2007 @07:02AM (#20792457)
    AFAIK, your information is outdated. The wikipedia article regarding NPTL [wikipedia.org] can help shed some light. Quoting the wikipedia article mentioned:

    Before the 2.6 version of the Linux kernel, processes were schedulable entities, and there was no real support for threads. However...
  • Re:which processors (Score:3, Informative)

    by TheRaven64 ( 641858 ) on Saturday September 29, 2007 @08:33AM (#20792617) Journal

    Sun junked this because it doesn't scale well when you get into hundreds of heavyweight processes and thousands of threads and/or LWPs.
    I think you are mistaken as to the reasoning. This model does scale well to large numbers of threads; much better than the 1:1 model. The problem is, C programmers don't write code that spawns thousands of threads, because C is not suited to concurrency. C programmers tend not to create more than a dozen or so threads, and so the added complexity of N:M is not needed because 1:1 can handle it well. Languages like Erlang (and, to a much lesser degree, Java), which do encourage high orders of parallelism do some optimisation of locking which can only work if the language runtime is aware of which threads / LWPs can run at the same time, and so they tend to assume a 1:1 threading model in the kernel and implement their own N:M model on top. This makes having an N:M model in the kernel somewhat pointless, since languages that can take advantage of it don't.

    By the way, NetBSD still uses an N:M model (FreeBSD tried it, but abandoned it due to code complexity issues).

  • by TheRaven64 ( 641858 ) on Saturday September 29, 2007 @08:37AM (#20792635) Journal
    If you want to play with a modern OS that does this, take a look at NetBSD. It uses an N:M threading model (scheduler activations), where each process gets one kernel thread per physical CPU, and multiplexes them by scheduling activations from the kernel and doing the multiplexing in userspace.

Always try to do things in chronological order; it's less confusing that way.

Working...