Commit 132011c6 by Tobias Langer

Added global task queue.

parent e3916b5a
...@@ -126,6 +126,12 @@ void mtapi_initialize( ...@@ -126,6 +126,12 @@ void mtapi_initialize(
local_status = MTAPI_ERR_NODE_INITFAILED; local_status = MTAPI_ERR_NODE_INITFAILED;
} }
#ifdef EMBB_HARD_REALTIME
embb_mtapi_task_queue_initialize_with_capacity(
&node->global_task_queue,
node->attributes.max_tasks);
#endif
if (local_status == MTAPI_SUCCESS) { if (local_status == MTAPI_SUCCESS) {
/* initialize scheduler for local node */ /* initialize scheduler for local node */
node->scheduler = embb_mtapi_scheduler_new(); node->scheduler = embb_mtapi_scheduler_new();
...@@ -200,6 +206,9 @@ void mtapi_finalize(MTAPI_OUT mtapi_status_t* status) { ...@@ -200,6 +206,9 @@ void mtapi_finalize(MTAPI_OUT mtapi_status_t* status) {
} }
embb_atomic_destroy_int(&node->is_scheduler_running); embb_atomic_destroy_int(&node->is_scheduler_running);
#ifdef EMBB_HARD_REALTIME
embb_mtapi_task_queue_finalize(&node->global_task_queue);
#endif
/* free system instance */ /* free system instance */
embb_mtapi_alloc_deallocate(node); embb_mtapi_alloc_deallocate(node);
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include <embb_mtapi_log.h> #include <embb_mtapi_log.h>
#ifdef EMBB_HARD_REALTIME
#include <embb_mtapi_task_queue_t.h>
#endif /*EMBB_HARD_REALTIME*/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -71,6 +75,9 @@ struct embb_mtapi_node_struct { ...@@ -71,6 +75,9 @@ struct embb_mtapi_node_struct {
embb_mtapi_queue_pool_t * queue_pool; embb_mtapi_queue_pool_t * queue_pool;
embb_atomic_int is_scheduler_running; embb_atomic_int is_scheduler_running;
mtapi_affinity_t affinity_all; mtapi_affinity_t affinity_all;
#ifdef EMBB_HARD_REALTIME
embb_mtapi_task_queue_t global_task_queue;
#endif /*EMBB_HARD_REALTIME*/
}; };
#include <embb_mtapi_node_t_fwd.h> #include <embb_mtapi_node_t_fwd.h>
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <embb_mtapi_thread_context_t.h> #include <embb_mtapi_thread_context_t.h>
#include <embb_mtapi_task_context_t.h> #include <embb_mtapi_task_context_t.h>
#include <embb_mtapi_task_t.h> #include <embb_mtapi_task_t.h>
#ifdef EMBB_HARD_REALTIME
#include <embb_mtapi_task_queue_t.h>
#endif /*EMBB_HARD_REALTIME*/
#include <embb_mtapi_action_t.h> #include <embb_mtapi_action_t.h>
#include <embb_mtapi_alloc.h> #include <embb_mtapi_alloc.h>
#include <embb_mtapi_queue_t.h> #include <embb_mtapi_queue_t.h>
...@@ -631,6 +634,12 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task( ...@@ -631,6 +634,12 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task(
assert(MTAPI_NULL != node); assert(MTAPI_NULL != node);
#ifdef EMBB_HARD_REALTIME
if (scheduler->mode == GLOBAL_EDF) {
embb_mtapi_task_queue_push(&node->global_task_queue, task);
pushed = MTAPI_TRUE;
} else {
#endif /*EMBB_HARD_REALTIME*/
if (embb_mtapi_action_pool_is_handle_valid( if (embb_mtapi_action_pool_is_handle_valid(
node->action_pool, task->action)) { node->action_pool, task->action)) {
embb_mtapi_queue_t* local_queue = MTAPI_NULL; embb_mtapi_queue_t* local_queue = MTAPI_NULL;
...@@ -692,6 +701,9 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task( ...@@ -692,6 +701,9 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task(
embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1); embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1);
} }
} }
#ifdef EMBB_HARD_REALTIME
}
#endif /*EMBB_HARD_REALTIME*/
return pushed; return pushed;
} }
...@@ -59,6 +59,10 @@ enum embb_mtapi_scheduler_mode_enum { ...@@ -59,6 +59,10 @@ enum embb_mtapi_scheduler_mode_enum {
WORK_STEAL_VHPF = 0, WORK_STEAL_VHPF = 0,
// Local First. Steal if all local queues are empty. // Local First. Steal if all local queues are empty.
WORK_STEAL_LF = 1, WORK_STEAL_LF = 1,
#ifdef EMBB_HARD_REALTIME
// Global EDF. No work stealing
GLOBAL_EDF = 2,
#endif /*EMBB_HARD_REALTIME*/
NUM_SCHEDULER_MODES NUM_SCHEDULER_MODES
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment