1 / 21

Cyclic Scheduling

Cyclic Scheduling. Advantages Simple implementation (no real-time operating system is required). Low run-time overhead. It allows jitter control. Disadvantages It is not robust during overloads. It is difficult to expand the schedule. It is not easy to handle non periodic activities.

israel
Download Presentation

Cyclic Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cyclic Scheduling • Advantages • Simple implementation (no real-time operating system is required). • Low run-time overhead. • It allows jitter control. • Disadvantages • It is not robust during overloads. • It is difficult to expand the schedule. • It is not easy to handle non periodic activities.

  2. Other Schedule Algorithms • Priority Scheduling • Each task is assigned a priority based on its timing constraints • We verify the feasibility of the schedule using analytical techniques • Tasks are executed on a priority-based kernel • Example: Rate Monotonic (RM) • Each task is assigned a fixed priority proportional to its rate

  3. Real Time and Linux • Linux is a standard time-sharing operating system • Good average performance and highly sophisticated services • Hardware management layer dealing with event polling or processor/peripheral interrupts • Scheduler classes dealing with process activation, priorities, time slice • Communications between applications.

  4. Real Time and Linux • Linux suffers from a lack of real time support • Changes in the kernel sources, i.e. in the interrupt handling and scheduling policies • Real time platform, with low latency and high predictability requirements • Full non real time Linux environment (access to TCP/IP, graphical display and windowing systems, file and data base systems, etc.).

  5. Timers PC’s • Specific chip to solve the problem of generating accurate time delays under software control. • 8254 • Programmable interval timer/counter • 4 I/O ports in the system software • Three are independent 16-bit, one is a control register • We configures the 8254 to match requirements (select the mode) and program one of the counters for the desired delay. • After the delay, the 8254 will interrupt the CPU.

  6. Real Time in Linux, RTAI • Use low cost general purpose computers and open-free source operating systems • RTAI means Real Time Application Interface. • Not a real time operating system • Based on the Linux kernel. • RTAI expands Linux to hard real time

  7. Real Time in Linux, RTAI • A patch to the Linux kernel which introduces a hardware abstraction layer • A broad variety of services which make real-time programmers' life easier • RTAI offers the same services of the Linux kernel core, adding the features of an industrial real time operating system.

  8. Real Time in Linux, RTAI • Is an interrupt dispatcher • RTAI traps the peripherals interrupts and if necessary re-routes them to Linux • It uses the concept of HAL (hardware abstraction layer) to get information from Linux and to trap some fundamental functions. • HAL provides few dependencies to Linux Kernel. • RTAI considers Linux as a background task running when no real time activity occurs.

  9. RT Computer Systems RTAI • Basic task management • time management and conversions • dynamic priority assignment • scheduler policy assignment • scheduling locking/unlocking • counting suspend/resume to avoid trivial deadlocks • Memory Management • shared memory for inter tasks • inter-intra user/kernel space data • sharing, dynamic memory allocations

  10. RT Computer Systems RTAI • Semaphores • Wait • Send • broadcast on • counting, binary and resources with full priority • inheritance to avoid priority inversion.

  11. RT Computer Systems RTAI • Conditional variables • wait, signal, broadcast, equivalent to the related POSIX APIs, but with an RTAI specific implementation. • Bits synchronization • Multi events/flags/signals synchronization, i.e. semaphore like operations with different logical masking/unmasking on a set of bits at call and return time.

  12. RT Computer Systems RTAI • Mailboxes • send, receive of messages with multi readers/writers capability • messages queued in either FIFO or priority order. It is possible to use overwriting and urgent sends, broadcast a single message to all task waiting to receive on a mailbox queue, preview any message before reading it.

  13. RT Computer Systems RTAI • Direct Inter-task Messages • Asynchronous: send, receive • Synchronous remote procedures calls (RPC) • rpc, receive, return.

  14. RTAI Modules • To use RTAI, you have to load the modules that implement whatever RTAI capabilities you need. • Modules: • Rtai, Main module. • rtai_sched. scheduler module, which is in charge of distributing the CPU to different tasks • Task functions • Timing functions • Semaphore functions • Mailbox functions • Inter-task communication functions • rtai_fifos.

  15. RTAI Modules • Modules • rtai_shm • Lxrt • rtai_pqueue • rtai_pthread • rtai_utils

  16. RTAI Examples The program simply generates a sine signal and displays the instant values on the screen. -------------- RT_PROCESS.C ------------------- \#include <linux/module.h> \#include <asm/io.h> \#include <math.h> \#include <rtai.h> \#include <rtai_sched.h> \#include <rtai_fifos.h> \#define TICK_PERIOD 1000000 \#define TASK_PRIORITY 1 \#define STACK_SIZE 10000 \#define FIFO 0

  17. RTAI Examples static RT_TASK rt_task; static void fun(int t) {     int counter = 0;     float sin_value;        while (1) {         sin_value = sin(2*M_PI*1*rt_get_cpu_time_ns()/1E9);         rtf_put(FIFO, &counter, sizeof(counter));         rtf_put(FIFO, &sin_value, sizeof(sin_value));         counter++;         rt_task_wait_period();     } }

  18. RTAI Examples int init_module(void) {     RTIME tick_period;     rt_set_periodic_mode();     rt_task_init(&rt_task, fun, 1, STACK_SIZE, TASK_PRIORITY, 1, 0);     rtf_create(FIFO, 8000);     tick_period = start_rt_timer(nano2count(TICK_PERIOD));     rt_task_make_periodic(&rt_task, rt_get_time() + tick_period,       tick_period);     return 0; }

  19. RTAI Examples void cleanup_module(void) {     stop_rt_timer();     rtf_destroy(FIFO);     rt_task_delete(&rt_task);     return; }

  20. RTAI Examples Scope: int main (void) {     int fifo, counter;     float sin_value;     if ((fifo = open("/dev/rtf0", O_RDONLY)) < 0) {         fprintf(stderr, "Error opening /dev/rtf0\n");         exit(1);     }     signal(SIGINT, endme);     while (!end) {         read(fifo, &counter, sizeof(counter));         read(fifo, &sin_value, sizeof(sin_value));         printf(" Counter : %d Seno : %f \n", counter, sin_value);     }     return 0; }

More Related