Periodic tasks in real-time once again

Periodic tasks in real-time once again

Post by Carlos Muno » Sat, 12 Apr 1997 04:00:00



Hi you guys!!

I posted an article three days ago about implementing periodic tasks and
maybe I didn't explain the point quite allright.

I'm working according to a RT architecture my department has given to
me, and the implementation of hard real-time periodic tasks is a must. I
use the 8254 interval timer to trigger interrupts that activate those
periodic tasks. They are loaded before starting and they MUST NOT be
unloaded to save loading time -no major faults allowed-.

In order to do that I intercept the exit system call at the end of every
C program. Instead of doing the normal exit I try to leave the process
in a similar state to that one when it has just done execve, setting the
eip to the address specified in the field ex.a_entry and passed to the
function start_thread in execve, as well as setting the esp to the
address mm->start_stack where arguments and envelopes should be.

The new routine I've made is more or less:

int do_exit2(struct pt_regs *regs]
{
        regs->eip = start_ip;
        regs->esp = start_stack;
        current->state = TASK_UNINTERRUPTIBLE;
        schedule(];

Quote:}

When the process is awaken again by an interrupt from the 8254, it comes
out from the schedule(] and after returning from the system call it
should resume at the beginning of the program.

However, everything gets screwed up after the first run: the program
doesn't like the change in regs and causes a general protection error.
After that it's killed and everything stops.

Here are my questions for kernel and C gurus:

- Are the arguments and envelopes kept in the stack until a normal exit
is done?

- Is there are library similar to the crtso.s in MINIX which is linked
to the beginning of a normal user program and whose task is preparing
the arguments left in the stack by execve?

- If so, does the ex.a_entry point to the beginnig of that library or to
the beginning of the actual program?

Your help is greatly appreciated. This is part of my senior project and
I want to finish it ASAP.

Thanks a lot in advance.............CARLOS AKA SLACKER

 
 
 

Periodic tasks in real-time once again

Post by Robert W. Brew » Sun, 13 Apr 1997 04:00:00


Why not use RT-Linux?  It has periodic scheduling built-in,
and hard real-time support.  However, RT-Linux tasks
can't use normal Linux kernel services, though they can
communicate with regular Linux processes.  RT-Linux tasks
become part of the kernel address space when they are loaded,
so they are never paged out.

http://luz.cs.nmt.edu/~rtlinux/

In the plain vanilla kernel,
look into the mlockall() system call to disable paging for
user space processes, and sched_setscheduler() to use soft real-time
scheduling.

-Rob
--
Robert W. Brewer  


 
 
 

1. Real-Time task vs. device driver vs. sched_setscheduler?

I'm new to the idea of real-time operations, and I notice
that Linux supports "soft" real-time via sched_setscheduler()
and "hard" real-time via the RT-Linux kernel patches.

I'd greatly appreciate if someone could discuss the tradeoffs among
using a kernel device driver, the RT-Linux extensions, and the
sched_setscheduler() calls for a given application.  How would I know
what is a good match to an application?  Or would applications use
several of those methods together?  The examples I've seen for
RT-Linux sound like things that a device driver should handle.  Why
not use device drivers instead?  Or should the suggestion given in one
of the RT-Linux papers be followed: rewrite the time-dependent device
drivers as RT tasks?

Also, has anyone measured the maximum interrupt latency for RT-Linux?

Thanks for any insights.

-Rob
--
Robert W. Brewer  

2. alarm clock message

3. Real Time Task Switching

4. automount doesn't work on 2.6

5. "Real-Time" Time Display in Console

6. My solaris does'n have math.h.

7. Mixed Time-Share & real-Time scheduling

8. opie-2.32 on RedHat

9. real-time vs. user-time

10. Real-time (RT) process slipping time - any ideas?

11. Newbie question : Periodic executing a task

12. HOW TO build a periodic task?

13. how to make tasks periodic ?