Despite a lot of efforts we were unable to get RED Linux to run. The first problem was that the kenerl could not be compiled the reason being that it required an old version of the gcc compiler. i.e the egcs compiler. On getting the kernel compiled we could not get the kernel to boot
It kept complaining about too many processes and after a lot of failed attempts we were forced to give up on RED-Linux. The other options for implementing the FC-EDF scheduler was to make a simulator, however the challenge of kernel coding and the opportunity to work on a real time kernels scheduler was not worth missing so we decided to work on the RT-Linux kernel.
Below is the architecture of RT-Linux , the idea is basically to add an additional layer of software between the hardware and the linux kernel. The Linux kernel runs as a non-real time task under RT-Linux. RT-Linux intercepts all the interrupts and then passes these on to Linux. Each RT-Linux task is composed of a real time part and a non-real time part. The real time part works as a kernel module and is loaded using the insmod function.
Inorder for the Real time part and the non-real time part that runs as a normal linux process to communicate RT-Linux provides the functionality of real time FIFOs.
RT-Linux as is implemented creates the following issues for our use.
The following is
a brief description
of the RT-Linux
scheduler and its,
various functions.
INIT_MODULE -
1. This function
sets up the
Linux task called
sched->rtl_linux_task this
represent the linux kernel
as a task
and this is
added to the
task list.
2. This has
the initialization procedures.
IT sets up
the handler to
handle the periodic
clock interrupts this
is done by rtl_setclockhandler
(s->clock, rtl_sched_timer_interrupt) ==
0) thus it
makes rtl_sched_timer_interrupt the
function that is
called when the
timer expires.
RTL_SCHED_TIMER_INTERRUPT -
Just calls the
scheduler.
SCHED_IRQ_HANDLER
- This is
the handler that
catches all the
interrupts other than
the timer. This checks
the ZOMBIE_QUEUE ,
i.e. all that
tasks that have
completed. This zombie
queue is traversed
and the tasks
that have completed
and have a
tack that is allocated
to them have
their cleanup procedures
scheduled.
PTHREAD_EXIT - calls
the rtl_schedule function,
thus the next
task is scheduled
after one completes.
__rtl_setup_timeout(th,timeout) - This
function is used
to set the
bit by using
( actually it
is a macro)
set_bit (RTL_THREAD_TIMERARMED, &(th) -> threadflags);
i.e. the RTL_THREAD_TIMERARMED bit. This bit is
checked by the
scheduler. This is
called whenever the int pthread_make_periodic_np
(pthread_t
p, hrtime_t start_time, hrtime_t period)
is called and
also when int pthread_wait_np(void) is
called. This function
also sets the
resume time to
be equal to
the timeout passed
to it .
PTHREAD_CREATE - Sets
all the thread
parameters however it
assumes that the
task is NOT
periodic, the task
has to be
made periodic by
calling make_periodic. After thread
creation this calls rtl_schedule();
SIGNALLING
Any events that have to be indicated to a task when it is not running is done Via Signals, the signals are handled through two
bit
arrays in the
thread structure, ie. the pending and
the blocked signals.
Whenever a signal
is to be sent to
a thread then
that threads pending
bit is set.
This bit array
is checked for
the task that
is to be
scheduled in the
scheduler and the do_signal
handler is called(done
at the end
of the scheduler
after the scheduling
decision has been
made) , this
handler based on
the type of
the signal performs
the appropriate handling.
RTL-SCHEDULE -
Does
the following
1. Find the
highest priority task(new_task) in
the task queue
that can be
scheduled next .
i.e. now >
t->resume_time (
where resume time
is the time
that the task
is to re/start)
2. Then it
finds the highest
priority task that
can preempt this
task(new_task)
in the future.
if it
finds one such
task then it
sets the schedulers
one-shot timer to
interrupt it at
the time
when the scheduling
decision has to
be made because
this new higher
priority
task starts. Otherwise
if such a
task is not
found then set
the one-shot timer
to a
constant hardcoded value.
3. Check if
the new_task is
not the same
as the current
running task. If not
then swap the
task out provided
its not the linux kernel ,
if it is then make
the rt-system-idle.( This
means that
there are no real
time tasks because
the Linuxs priority
is lowest and
if this
is the highest
priority task )
4. If the
task is the
to be scheduled
and if the
task has some
pending signals then
the
scheduler calls the generic signal handler do_signal to handle the signals.
Coming up
Last revised: Date