Implementing separate run queues in the DWCS scheduler for Linux PowerPoint PPT Presentation

presentation player overlay
1 / 14
About This Presentation
Transcript and Presenter's Notes

Title: Implementing separate run queues in the DWCS scheduler for Linux


1
Implementing separate run queues in the DWCS
scheduler for Linux
  • By Mikael Horal

2
Linux the Linux Scheduler
  • Linux is not a real-time operating system
  • However, has some support for real-time
    processes.
  • Treats real-time processes different from regular
    processes/tasks, by always assigning them a
    higher priority than a non-real-time process.

3
Linux the Linux Scheduler
  • Linux scheduler runs through (doubly linked) list
    of all runnable tasks to determine which task
    that is to run on the CPU
  • Process with highest priority is chosen
  • Lots of gotos in code. Makes modifying a bit
    harder.
  • The above also true for the DWCS scheduler in
    Linux.

4
DWCS scheduling
  • Tries to limit the number of missed deadlines
    over a finite number of periods
  • More specifically, tries to guarantee that no
    more than x deadlines are missed every y
    deadlines, for a given process (or thread).
  • Useful for e.g. multimedia applications
    applications that can tolerate a certain fraction
    of missed deadlines, but with restrictions on the
    number of  consecutive packet losses that are
    acceptable

5
DWCS scheduling
  • Compares pairs of processes and selects the
    highest priority process based on the following
    rules1. Earliest deadline first (EDF)2. Equal
    deadlines, order lowest window-constraint
    first3. Equal deadlines and zero
    window-constraints, order highest
    window-denominator first4. Equal deadlines and
    equal non-zero window-constraints, order lowest
    window-numerator first5. All other cases
    first-come-first-serve. However, in current Linux
    implementation round-robin.
  • Window-constraint x/y is dynamically adjusted

6
DWCS scheduling and Linux
  • More complex and time consuming the regular Linux
    scheduler
  • All tasks treated as DWCS tasks!
  • Implemented as a kernel module however some
    additional kernel modifications necessary
  • Some bugs!

7
Motivation
  • Important in real-time system that scheduling has
    little overhead so context-switching can be done
    fast
  • For example, if high priority task becomes
    runnable we want it to be scheduled as fast as
    possible.
  • The complexity of DWCS increases context-switch
    time - even for non-real-time tasks.

8
Approach
  • Keep a separate run-queue for real-time tasks
    more specifically DWCS tasks.
  • Add an entry to task structure pointing to the
    head of the run-queue. Must be careful when
    adding member to structure!
  • The head of a regular Linux task is the idle
    task. This only gets run if no other processes
    can run.
  • Add a new head for the DWCS-tasks. This task
    will (and must) never run.

9
Approach
  • Lots of code gets affected by this change e.g.
    add_to_runqueue, move_first_runqueue,
    setscheduler, build_proc_read_buffer.
  • Most importantly schedule and DWCS_schedule have
    to be changed.
  • First I scan through list of DWCS tasks. The list
    of non-DWCS tasks is examined only if no DWCS
    tasks was found.
  • Allows for optimizations! E.g. non-DWCS tasks no
    longer has to be treated as DWCS tasks, thus
    calculating priorities will be a lot faster.

10
Experimental Setup
  • For timing I used rdtsc (Read Time Stamp
    Counter). Intel-specific instruction that gives
    time in clock ticks (64 bit register). Must have
    resolution in ns-range!
  • Used 400 MHz Intel Pentium II Machine
  • Compare to Rhealstone Benchmark paper1. We
    have access to and can make changes in source
    code.2. We are interested mainly in how long
    time scheduling decision take not to switch
    between two processes (restoring FPU state,
    flush/restore TLB)

11
Experimental Results
12
Experimental Results
13
Experimental Results
14
Conclusions Final Thoughts
  • No revolutionary results, but exactly was I was
    expecting and looking for
  • Cache performance? The Linux task structure is
    page aligned, so it is possible that same members
    in successive task structures will be mapped to
    the same cache line cache line thrashing!
  • Future Incorporate into DWCS More testing
  • Fun project learned a lot!
Write a Comment
User Comments (0)
About PowerShow.com