From: Anders Blomdell <anders.blomdell@domain.hid>
To: xenomai-help <xenomai@xenomai.org>
Subject: [Xenomai-help] How should rt_task_delete(NULL) be used?
Date: Tue, 04 Mar 2008 20:42:30 +0100 [thread overview]
Message-ID: <47CDA626.4010604@domain.hid> (raw)
Why does the following program grow it's VMSIZE? This is the output I get:
[child = 0, 0] VmSize: 1912 kB
[child = 1, 1] VmSize: 1980 kB
[child = 2, 2] VmSize: 2048 kB
[child = 3, 3] VmSize: 2116 kB
[child = 4, 4] VmSize: 2184 kB
[child = 5, 5] VmSize: 2252 kB
[child = 6, 6] VmSize: 2320 kB
[child = 7, 7] VmSize: 2388 kB
[child = 8, 8] VmSize: 2456 kB
[child = 9, 9] VmSize: 2524 kB
[child = 10, 10] VmSize: 2592 kB
[child = 11, 11] VmSize: 2660 kB
[child = 12, 12] VmSize: 2728 kB
[child = 13, 13] VmSize: 2796 kB
[child = 14, 14] VmSize: 2864 kB
[child = 15, 15] VmSize: 2932 kB
[child = 16, 16] VmSize: 3000 kB
[child = 17, 17] VmSize: 3068 kB
[child = 18, 18] VmSize: 3136 kB
[child = 19, 19] VmSize: 3204 kB
But I would have expecte dthe size to remain constant (API docs says: "Terminate
a task and release all the real-time kernel resources it currently holds." ...
"If task is NULL, the current task is deleted.")
Versions used are:
# uname -r ; cat /proc/xenomai/version
2.6.24.3-ipipe
2.4.2
#include <sys/mman.h>
#include <native/cond.h>
#include <native/mutex.h>
#include <native/task.h>
#include <native/timer.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static void child(void *arg)
{
int n = (int)arg;
printf("[child = %2d", n);
fflush(stdout);
rt_task_delete(NULL);
}
int main(int argc, char *argv[])
{
int i;
RT_TASK task_main;
RT_TASK task;
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_task_shadow(&task_main, "main", 1, T_FPU);
for (i = 0 ; i < 20 ; i++) {
if (rt_task_create(&task, NULL, 0, 1, 0)) {
fprintf(stderr, "Failed to create task\n");
exit(1);
}
if (rt_task_start(&task, &child, (void*)i)) {
fprintf(stderr, "Failed to start task\n");
exit(1);
}
rt_task_sleep(1000000000L);
{
int fd;
char *p1 = NULL, *p2 = NULL;
char buf[4000];
fd = open("/proc/self/status", O_RDONLY);
if (read(fd, buf, 4000) > 0) {
p1 = strstr(buf, "VmSize");
if (p1) { p2 = strstr(p1, "\n"); }
if (p1 && p2) { printf(", %2d] %1.*s\n", i, p2 - p1, p1); }
}
close(fd);
}
}
exit(0);
}
Regards
Anders
--
Anders Blomdell Email: anders.blomdell@domain.hid
Department of Automatic Control
Lund University Phone: +46 46 222 4625
P.O. Box 118 Fax: +46 46 138118
SE-221 00 Lund, Sweden
next reply other threads:[~2008-03-04 19:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-04 19:42 Anders Blomdell [this message]
2008-03-04 20:19 ` [Xenomai-help] How should rt_task_delete(NULL) be used? Gilles Chanteperdrix
2008-03-04 20:54 ` Anders Blomdell
2008-03-04 21:57 ` Gilles Chanteperdrix
2008-03-05 7:44 ` Anders Blomdell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47CDA626.4010604@domain.hid \
--to=anders.blomdell@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.