SMP: Thread Restart and Delete

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 17 13:00:21 UTC 2014


Hello,

my next topic is thread restart and delete on SMP.  For background information 
please have a look at:

http://www.rtems.org/wiki/index.php?title=SMP#Thread_Restart

http://www.rtems.org/wiki/index.php?title=SMP#Thread_Delete

http://www.rtems.org/pipermail/rtems-devel/2013-July/003509.html

http://www.rtems.org/wiki/index.php?title=SMP#Post-Switch_Actions

There are a couple of open PRs in this area:

Priority inheritance mechanism may activate a deleted task
https://www.rtems.org/bugzilla/show_bug.cgi?id=788

SMP race condition between stack free and dispatch
https://www.rtems.org/bugzilla/show_bug.cgi?id=1814

psxcancel reveals NULL pointer access in _Thread_queue_Extract()
https://www.rtems.org/bugzilla/show_bug.cgi?id=2035

Race condition in _Thread_queue_Extract_with_proxy()
https://www.rtems.org/bugzilla/show_bug.cgi?id=2151

Race condition with unified work areas
https://www.rtems.org/bugzilla/show_bug.cgi?id=2152

There are some lock order reversal problems in this area on SMP.

In addition to this the POSIX cleanup handler may be called in the wrong 
context (should be called in the context of the deleting thread).

http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html

The proposed way to fix the thread restart and delete problems is

1. implement post-switch actions,

2. use post-switch actions to implement Classic and POSIX signals,

3. use post-switch actions to implement thread restart,

4. use post-switch actions to implement thread delete,

5. call thread restart and delete extensions in the context of the restarting 
or deleting thread,

6. add ability to disable thread restart and deletion to all threads (not only 
POSIX API),

7. disable/enable thread restart and delete in internal mutex obtain/release,

8. protect workspace/heap/objects allocation/free with the allocator mutex (NOT 
disabled thread dispatching),

9. add a zombi list of threads for final cleanup (work on demand during thread 
create).

It may make sense to add this also to the RTEMS 4.11 release.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list