EM-ODP  3.7.0
Event Machine on ODP
Scheduler

Event Machine event scheduling related services. More...

Functions

void em_atomic_processing_end (void)
 
void em_ordered_processing_end (void)
 
void em_preschedule (void)
 
em_sched_context_type_t em_sched_context_type_current (em_queue_t *queue)
 

Detailed Description

Event Machine event scheduling related services.

Most of the event scheduling is a system dependent implementation but the common services here can be used for performance tuning etc.

Do not include this from the application, event_machine.h will do it for you.

Function Documentation

◆ em_atomic_processing_end()

void em_atomic_processing_end ( void  )

A hint to release an atomic processing context.

This function can be used to release the atomic context before returning from the EO receive function.

After this API call is the scheduler allowed to schedule another event from the same atomic queue (or atomic group) that established the current atomic context, to another (or same) core.

When an event has been received from an atomic queue, the scheduler is allowed to schedule another event from the same atomic queue to another, or same, core after this API call. This increases parallelism and may improve performance - however, the exclusive processing and ordering might be lost. Note, however, that this is a hint only, the scheduler is still allowed to keep the atomic context until scheduling the next event.

Can only be called from within the EO receive function.

The call is ignored if the currently active scheduling context type is not atomic (EM_SCHED_CONTEXT_TYPE_ATOMIC, see em_sched_context_type_current()).

Pseudo-code example:

receive_func(void* eo_ctx, em_event_t event, em_event_type_t type,
em_queue_t queue, void* q_ctx)
{
if(is_my_atomic_queue(q_ctx))
{
// this needs to be done atomically:
update_sequence_number(event);
// do other processing (potentially) in parallel:
do_long_parallel_work();
}
}
See also
em_receive_func_t(), event_machine_queue.h
Examples
atomic_processing_end.c, queue_types_ag.c, queue_types_local.c, and scheduling_latency.c.

Definition at line 34 of file event_machine_scheduler.c.

◆ em_ordered_processing_end()

void em_ordered_processing_end ( void  )

A hint to allow release of the ordered processing context.

This function can be used to tell the scheduler that all events to be sent under the current ordering context are already sent. Events sent after this are no longer required to be kept in order. This may increase system performance. It permits early release of the ordering context, but an EM implementation is still allowed to keep it until scheduling the next incoming event.

Can only be called from within the EO receive function.

The call is ignored if the currently active scheduling context type is not ordered (EM_SCHED_CONTEXT_TYPE_ORDERED, see em_sched_context_type_current()).

The ordering context cannot be resumed after it has been released.

See also
em_receive_func_t(), event_machine_queue.h
Examples
ordered.c.

Definition at line 60 of file event_machine_scheduler.c.

◆ em_preschedule()

void em_preschedule ( void  )

A hint to start scheduling for this core

This is a performance optimization hint with no functional effect. A hint is given to the scheduler to start scheduling the next event for the calling core as it is about to end processing of the current event. This can be used to reduce the latency of scheduling. Depending on the actual scheduler implementation, this may be a no-operation.

Examples
atomic_processing_end.c.

Definition at line 83 of file event_machine_scheduler.c.

◆ em_sched_context_type_current()

em_sched_context_type_t em_sched_context_type_current ( em_queue_t *  queue)

Return the currently active scheduling context type

Returns the current scheduling context type (none, ordered, atomic) and optionally the queue that determines the context. Note, that the scheduling context type is not the same as the queue type since the scheduling context type could have been released by the user, or inherited by local queue processing.

This function is mainly for handling local queues that inherit the scheduling context that was active for the sending EO. The scheduling context can be unpredictable unless the processing chain is carefully crafted. This function will return the active scheduling context type and queue of the last event from the scheduler (i.e. the scheduled queue of the EO that sent the event to the first local queue in the chain).

Parameters
[out]queueif not NULL, set to the queue that determines the current sched context
Returns
current context type
See also
em_queue_create(), em_sched_context_type_t
Examples
queue_types_ag.c.

Definition at line 89 of file event_machine_scheduler.c.

em_atomic_processing_end
void em_atomic_processing_end(void)
Definition: event_machine_scheduler.c:34
em_event_type_t
uint32_t em_event_type_t
Definition: event_machine_types.h:85