[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Dynamic allocation confusion
In RTL you need to be in Linux mode to use kmalloc. A RT task cannot
safely use kmalloc directly, but it can arrange to have a linux function
allocate memory for it. In RTLinux V2 (beta series,coming to an end, I hope)
the easiest method is to generate a soft interrupt for a linux handler that can do the malloc.
The best and fastest way to allocate dynamically from RT mode is to preallocate
in initialization and then use the resources as needed in RT mode.
The theory here is that if you need the complex and average case efficient
functionality of kmalloc, you cannot at the same moment need hard realtime
response and so you should do this work in Linux kernel or user mode.
On Wed, Oct 06, 1999 at 09:07:02AM -0400, peter lawford wrote:
> Hi,
>
> I'm confused about whether or not I can dynamically allocate memory in
> my RT processes; and if I can then what am I NOT allowed to use the
> memory for. I'm currently using RTLinux 1.3.
> The RTL kernel uses kmalloc(X, GFP_KERNEL) to dynamically allocate
> memory for task stacks, and I figure I'll use this too, but maybe this
> call can only be made at initialization:
>
> "- RTAI has support for dynamic thread creation, whereas in RTLinux all
> the threads must be created at init_module time."
> -Steve Papacharalambous, 10/6/99
>
> On the other hand, the man pages for RTL say
>
> "The parent task can send a one-integer value data to the new
> task."
> - rt_task_init man page
>
>
> Indicating that threads can be created dynamically. Then again, the IPC
> code for v1.3 tells me that
>
> "'sem' must point to a * statically allocated structure."
> "'mq' must point to a * statically allocated structure."
> - rtl_ipc.c
>
> but I want to dynamically create space for tasks, semaphores and message
> queues, on an as-needed basis. Can I do this? Can I do it if I have a
> restriction that I'll never kfree the memory until I unload the module?
>
>
> Thanks in advance,
> - Peter
> --- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
> ----
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/~rtlinux/
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/