Lecture 10 part 2 Outline in MS Word format

Page 1
Soft Real Time Systems using Linux kernel 2.6
Linux conventional scheduling
 Conventional Linux scheduling was based on Unix time-sharing
 Several processes will run in time multiplexing
 CPU time is divided into slices or quantum one for each ready
 Every running process will be switched out if it does not terminate
before it’s time slice expires
 Time sharing relies on timer interrupts transparent to the processes
 Processes also have dynamic priorities, pocesses that have been
denied the use of the CPU for a long time get a higher priority so that
they can be scheduled
Page 2
 This policy introduces non-deterministic delays which prevent
conventional Linux scheduling policy to be of use for real-time
 Linux kernel 2.6 was built on the kernel 2.5 scheduler, although
kernel 2.4 scheduler performs in O(n), the 2.6 kernel scheduler has
performance of O(1) substantially improving the scheduler
performance when the number of processes to be scheduled are
increased in the system
 Linux now supports POSIX Real Time processes in addition to the
Unix multi-processing Interactive and Batch processes
Page 3
 Linux 2.6 kernel is preemptive as oppose to previous kernels that
were non-preemptive
 Real-Time processes utilize Static Priorities that range from 1 to 99
 Static priority of a real-time process is always higher than the
dynamic priority of a conventional process
 Real-Time Scheduling policies in Linux
 Real-time FIFO process
 Real-time Round Robin process
 Linux 2.6 FIFO and RR scheduling interfaces and policies are POSIX
Page 4
 Linux does not support priority inversion or priority inheritance, a
feature used in real-time systems to prevent starvation and allow
real-time performance
 Despite lack of priority inversion or inheritance support in Linux
priority preemptive scheduling is used for front end data processing;
 Round-robin scheduling; SCHED_RR can be used to schedule
processes that need equal priority, run continuously when sample
rates are lowered
 Round-robin processes have lower priority than any of the priority
preemptive scheduled processes
 To reduce non-deterministic behaviors possible with the Linux OS,
circular swing buffers are used between the I/O processes and backend processing, the depth of these buffers is variable depending on
the I/O application
Page 5
 Kernel Priority Preemption available in Linux 2.6
Page 6
Backup charts
Scheduling system calls in Linux
 nice() Changes the priority of a conventional process from -20 to
+19, negative numbers correspond to high priority, positive, low
 getpriority(), setpriority() gets the maximum priority of a group of
conventional processes, sets the priority of a group of conventional
 sched_getscheduler(), sched_setscheduler() gets and sets the
scheduling policy of a process
 sched_getparam(), sched_setparam() gets and sets the priority of a
Page 7
Scheduling in VxWorks 5.1 and 5.4-5.5
 Supports priority based preemptive scheduling by default as well as
round robin scheduling
 Wind kernel has 256 priority levels, 0 to 255, 0 is the highest priority
 Scheduler system calls
taskLock() disables task rescheduling
 VxWroks 5.4 and higher also support POSIX Scheduling interface
Page 8
 VxWorks uses the term preemptive priority scheduling, while POSIX
standard uses the term FIFO, both describe the same priority-based
 POSIX and Linux scheduling is based on processes, Wind
scheduling is based on tasks
 A task can address memory directly while process inherits
only specific attributes from its parent process and can only
address within the process context
 POSIX scheduling algorithms are applied on a process-by-process
basis, Wind scheduling algorithm is on a system-wide basis, either
all tasks use a round-robin scheme, or all use a preemptive priority
 POSIX priority numbering scheme is the inverse of the Wind scheme
Page 9