Presentation is loading. Please wait.

Presentation is loading. Please wait.

Priority Inversion Higher priority task is blocked by a lower priority one. May be caused by semaphore usage, device conflicts, bad design of interrupt.

Similar presentations


Presentation on theme: "Priority Inversion Higher priority task is blocked by a lower priority one. May be caused by semaphore usage, device conflicts, bad design of interrupt."— Presentation transcript:

1 Priority Inversion Higher priority task is blocked by a lower priority one. May be caused by semaphore usage, device conflicts, bad design of interrupt handlers, poor programming and system design.

2 Problems with Priority Inheritance Nested critical regions –PI protected critical regions should not contain inheriting blocking operations Mixed inheriting and non-inheriting operations –PI protected critical regions should not contain non-inheriting blocking operations either Performance –PI protected critical regions must be relatively costly in terms of compute time or they perform worse than the simplest alternative (disable all preempts during the critical region). Operating system performance –PIP adds significant complexity to the operating system

3 Other Solutions to Priority Inversion Make the operation using the resource atomic and fast Remove the contention Explicitly schedule the operations according to priority

4 RT O/S Strategies Add non-real-time services to a real-time kernel (e.g., VXworks, QNX) Modify a standard kernel to make it pre- emptable (e.g., RT-IX) A simple real-time executive runs a non-real- time kernel as its lowest priority task, using a virtual machine layer to make the standard kernel pre-emptable (e.g., RT-Linux)

5 RT-Linux Approach to Real-Time RT kernel runs non-RT Linux as the lowest priority Interrupts are handled by the RT kernel and passed to the Linux task when no RT tasks Software emulates the interrupt control hardware for non-RT Linux –Interrupts are queued up

6 RT-Linux Approach to Real-Time RT and non-RT tasks communicate through lock-free queues and shared memory –Queues accessed like character devices via POSIX read/write/ioctl calls –Shared memory accessed via POSIX mmap calls Non-RT Linux used for –Booting, device drivers, networking, file systems, Linux process control

7 RT-Linux Approach to Real-Time Worst case interrupt latency on 486/33 Mhz PC is < 30 microsec Example application: data acquisition –RT task with polling or interrupts –Non-RT task for logging, display, networking –Queue to transfer data from RT task to non-RT task

8 RT-Linux Approach to Real-Time Design premise 1: Keep the RT kernel simple –No dynamic memory allocation –No address space protection –Fixed priority scheduler –No protection against impossible schedules –Synchronization between RT tasks with hard interrupt disabling and shared memory –FIFO queues connect RT tasks to non-RT tasks –Use non-RT Linux for other operations

9 RT-Linux Approach to Real-Time Design premise 2: Keep RT kernel flexible –Modules can be replaced E.g., alternative scheduling (EDF, RM) E.g., semaphore module –Runtime reconfigurable E.g., Can run tests with different scheduling

10 What is POSIX? (Ch. 10, Shaw) IEEE’s Portable Operating System Interface for Computer Environments, which supports: Threads Mutexes Semaphores Shared Memory Messages Signals Clocks & Timers Asynchronous I/O Memory Locking

11 POSIX.1c function calls pthread_atfork pthread_attr_destroy pthread_attr_getdetachstate pthread_attr_getinheritsched pthread_attr_getschedparam pthread_attr_getschedpolicy pthread_attr_getscope pthread_attr_getstackaddr pthread_attr_getstacksize pthread_attr_init pthread_attr_setdetachstate pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setschedpolicy pthread_attr_setscope pthread_attr_setstackaddr pthread_attr_setstacksize pthread_cancel pthread_cleanup_pop pthread_cleanup_push pthread_condattr_destroy pthread_condattr_getpshared pthread_condattr_init pthread_condattr_setpshared pthread_cond_broadcast pthread_cond_destroy pthread_cond_init pthread_cond_signal pthread_cond_timedwait pthread_cond_wait

12 POSIX.1c function calls pthread_create pthread_detach pthread_equal pthread_exit pthread_getschedparam pthread_getspecific pthread_join pthread_key_create pthread_key_delete pthread_kill pthread_mutexattr_destroy pthread_mutexattr_getprioceiling pthread_mutexattr_getprotocol pthread_mutexattr_getpshared pthread_mutexattr_init pthread_mutexattr_setprioceiling pthread_mutexattr_setprotocol pthread_mutexattr_setpshared pthread_mutex_destroy pthread_mutex_init pthread_mutex_lock pthread_mutex_trylock pthread_mutex_unlock pthread_once pthread_self pthread_setcancelstate pthread_setcanceltype pthread_setschedparam pthread_setspecific pthread_sigmask pthread_testcancel


Download ppt "Priority Inversion Higher priority task is blocked by a lower priority one. May be caused by semaphore usage, device conflicts, bad design of interrupt."

Similar presentations


Ads by Google