SCHED_RR/SCHED_FIFO and kernel threads?

From: Patrik Hägglund (patrik.hagglund_at_bredband.net)
Date: 06/16/05

  • Next message: Abhay Salunke: "Re: [patch 2.6.12-rc3] Adds persistent entryies using request_firmware_nowait"
    Date:	Thu, 16 Jun 2005 17:25:51 +0200
    To: linux-kernel@vger.kernel.org
    
    

    Hi all,

    When I use 2.6 kernels (2.6.11) and run processes whith SCHED_RR or
    SCHED_FIFO scheduling, kernel activity - in the form of kernel threads -
    gets starved. Googling gave me this thread:
    http://www.ussg.iu.edu/hypermail/linux/kernel/0411.1/0182.html, which
    discuss the topic brifely.

    As I remember it, using a 2.4 (or 2.2?) kernel it was possible to run
    processes using SCHED_RR/SCHED_FIFO scheduling classes (as defined by
    the Process Scheduling option in POSIX), at different priorities,
    whitout starving console input/output. For example, in one virtual
    terminal I stared a "supervisor" shell with SCHED_FIFO at priority 20,
    and then the job tasks I wanted to "run" in other virtual terminals, now
    still with SCHED_FIFO, but with lower priorities. If the job tasks
    dead-locked or ran into infinite loops, I just switched to the
    "supervisor" shell and killed the job tasks. I think I also - as an
    alternative - started the whole X server in "supervisor mode". I this
    way, I was able to get deterministic scheduling between tasks, and was
    still able to avoid locking the machine when things went wrong.

    However, using 2.6 kernels the "supervisor mode" doesn't work anymore.
    Using virtual terminals at the console, I'm unable to switch to another
    VT (using alt-F2), or switch window focus in X.

    Kernel threads seems to generally be scheduled in the SCHED_OTHER class
    (with the 'migration' thread as an exception).

    As I see it, "kernel activity" shall not be starved by user-space
    processes. Therefore, I was very suprised by this behaviour when I saw
    it in 2.6.11.

    Can someone explain how this is supposed to work? Is this the common
    design solution used by other operating systems that use kernel threads
    and have SCHED_RR/SCHED_FIFO scheduling (i.e. other POSIX operating
    systems with kernel threads)? Was there any discussion about the design
    when this migration of kernel acitivity into threads started?

    Regards,
    Patrik Hägglund
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Abhay Salunke: "Re: [patch 2.6.12-rc3] Adds persistent entryies using request_firmware_nowait"

    Relevant Pages

    • Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway
      ... Isn't the distinction between a kernel thread and a user task pretty ... suspend) will cause additional problems. ... The "don't freeze kernel threads" thing is an attempt to make a crude ... carry out some I/O. ...
      (Linux-Kernel)
    • swsusp: Documentation update
      ... * If you change kernel command line between suspend and resume... ... +I found some kernel threads that don't do it, ... -* systems that initialize video card into vga text mode and where BIOS ...
      (Linux-Kernel)
    • Re: [PATCH] kthread: saa7134-tvaudio.c
      ... If you don't do this kernel threads ... locking resources in the kernel long past the time when they are ... more sense to the change kernel threads. ... could have a user space parent. ...
      (Linux-Kernel)
    • Re: Xterm Hangs - Possible scheduler defect?
      ... Why would it be wrong to preempt ... >design that doesn't allow the necessary kernel threads to run on any CPU? ...
      (Linux-Kernel)
    • Re: [patch 05/11] syslets: core code
      ... do 'recvv' on datagram sockets, so I can retrieve a whole bunch of ... Whenever we talk about AIO and kernel threads some folks are rightly concerned that we're talking about a thread *per IO* and fear that memory consumption will be fatal. ...
      (Linux-Kernel)