Thomas.Doerfler at embedded-brains.de
Tue Apr 17 06:36:16 UTC 2007
> 1.What about other resources,such as files opened by the thread?
> 2.Linux provide a routine "do_exit" which releases all the resources
If you look at your two questions, maybe the answer is already within:
Linux provides the service you are looking for, but it is a service
based on a __process__. If you have a Linux process which is
multi-threaded, Linux would not be able to distinguish, which thread
owns which resources. AFAIK, memory and other resources are shared
between multiple threads in the same process.
RTEMS on the other hand does not support multiple processes, it is a
multi-threaded, but not multi-process OS. It only keeps track of the
resources that the OS has hardwired with a given thread, like the task
control block, the task stack etc.
It would be possible to maintain a list of resources that have been
allocated by a task, but at least some of the OS objects are
intentionally shared between various threads, so when the thread that
created a objetc is deleted, this does not automatically mean that all
its objects should be deleted.
Maintaining such a list would have a big impact on the realtime
performance of RTEMS.
So, as an RTEMS user it is your responsibility to keep track of the
resources a certain task owns.
> holded by the process to exit. Why don't rtems provide a similar fuction?
> Thomas Doerfler wrote:
>> it is always the responsibility of the application to free any
>> associated with a certain task. Deleting a task from the outside
>> (asynchronously to its internal state) is dangerous. It might make
>> sense to ask the task to delete itself (sending it a signal or an
>> event), then this task can decide when to do the actual deletion
>> and it
>> can make sure that any resources are returned/cleaned up.
>> Please note that this is also the case for Unix tasks: it is good
>> practice for a task to install a signal handler, which captures
>> like "kill". When such a signal arrives, the task can e.g. delete any
>> temporary files, tore its own state etc.
>> WuHao schrieb:
>>> The rtems_task_delete routine does some deletions and free
>>> actions,however not include semaphore releases.When we delete a
>>> which is holding some semaphores/mutexes,it may cause problem in my
>>> opinion.Does the kernel do the semaphore releases in other place
>>> or not
>>> do that at all?
>>> rtems-users mailing list
>>> rtems-users at rtems.com
embedded brains GmbH
Thomas Doerfler Obere Lagerstr. 30
D-82178 Puchheim Germany
Tel. : +49-89-18 90 80 79-2
Fax : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request
More information about the users