diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-06-24 15:43:19 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-07-23 08:01:13 +0200 |
commit | d7665823b208daefb6855591d808e1f3075cedcb (patch) | |
tree | 2080d79568c92ae40f9a49f3f82095307766cb1f /cpukit/score/include/rtems/score/threadimpl.h | |
parent | score: Introduce Thread_queue_Queue (diff) | |
download | rtems-d7665823b208daefb6855591d808e1f3075cedcb.tar.bz2 |
score: Introduce Thread_queue_Heads
Move the storage for the thread queue heads to the threads. Each thread
provides a set of thread queue heads allocated from a dedicated memory
pool. In case a thread blocks on a queue, then it lends its heads to
the queue. In case the thread unblocks, then it takes a free set of
threads from the queue. Since a thread can block on at most one queue
this works. This mechanism is used in FreeBSD. The motivation for this
change is to reduce the memory demands of the synchronization objects.
On a 32-bit uni-processor configuration the Thread_queue_Control size is
now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced
the size as well).
Diffstat (limited to 'cpukit/score/include/rtems/score/threadimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/threadimpl.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index 4dcef0b7d8..7b8f89c346 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -32,6 +32,7 @@ #include <rtems/score/sysstate.h> #include <rtems/score/threadqimpl.h> #include <rtems/score/todimpl.h> +#include <rtems/score/freechain.h> #include <rtems/config.h> #ifdef __cplusplus @@ -54,11 +55,17 @@ extern "C" { */ SCORE_EXTERN void *rtems_ada_self; +typedef struct { + Objects_Information Objects; + + Freechain_Control Free_thread_queue_heads; +} Thread_Information; + /** * The following defines the information control block used to * manage this class of objects. */ -SCORE_EXTERN Objects_Information _Thread_Internal_information; +SCORE_EXTERN Thread_Information _Thread_Internal_information; /** * The following points to the thread whose floating point @@ -89,6 +96,19 @@ SCORE_EXTERN struct _reent **_Thread_libc_reent; RTEMS_CONTAINER_OF( node, Thread_Control, Resource_node ) #endif +void _Thread_Initialize_information( + Thread_Information *information, + Objects_APIs the_api, + uint16_t the_class, + uint32_t maximum, + bool is_string, + uint32_t maximum_name_length +#if defined(RTEMS_MULTIPROCESSING) + , + bool supports_global +#endif +); + /** * @brief Initialize thread handler. * @@ -154,7 +174,7 @@ void _Thread_Stack_Free( * guaranteed to be of at least minimum size. */ bool _Thread_Initialize( - Objects_Information *information, + Thread_Information *information, Thread_Control *the_thread, const struct Scheduler_Control *scheduler, void *stack_area, @@ -736,7 +756,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void) RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void ) { return (Thread_Control *) - _Objects_Allocate_unprotected( &_Thread_Internal_information ); + _Objects_Allocate_unprotected( &_Thread_Internal_information.Objects ); } /** |