Floating point
calculations are not
allowed within the
kernel. However the
FC-EDF algorithm requires
floating point calculation
or the PID-Controller, for
the conversion from
the miss ratio
to the utilization.
There were two
approaches to solve
this problem
1. Implement a floating-point math library based
on integer arithmetic
2. Change the calculations integer arithmetic
We chose
to follow the
second method and
converted all floating-point calculations
into integer calculations
based on a
max and min integer value.
RT-Linux does
not have a
notion of a
job and if
there is a
job that misses
its deadline we
need to abort
the job and
because of this
there has to
be a way
of resetting the
job. One way to
do
this is to
save the program
counter when the
job begins and
then when the
job has to
be aborted reset
the program counter
to this value.
This is the
approach that we
under took. The
task calls setjmp just
before it starts
the loop for
iterations , which
represent the jobs,
the environment value
that is obtained
is passed to
the RT-Linux kernel
in pthread_create and
this environment is
used by the
scheduler when ever
it wants to
abort the job
to reset the
PC and the
SP and the
other registers. We
implemented a version
of the setjmp and
the longjmp functions
in assembly.
RT-Linux supports
floating point calculations
in real time
threads however it
does not allow
floating point calculations
in the kernel
and because of
this we had
to change all
the calculations of
the PID controller
to integer arithmetic.
Task abortion is simple in RT-Linux with a
simple call to pthread_exit. However there are issues
with this as pthread-exit calls rtl_posix_cancel
and this function sets a signal as pending on the task and expects the task to
be scheduled next. In this case if the utilization of the
other tasks is very high than this task will never be scheduled and thus the
task will never come out of the rtl_posix_cancel
function. In the normal case this will not effect
anything however as we are detecting deadline misses we will print deadline
misses for this task inspite of the task being
rejected by the admission controller. Thus we needed the addition of an
additional bit that was set when the task is rejected called the rejected bit.
And this bit is check when the deadline detections are performed.