cuflow/gflexq.h Global Work Queue with Flexible Priority
[[deprecated] Old SMP Work Scheduling]

Data Structures

struct  cuflow_gflexq
struct  cuflow_gflexq_entry

Typedefs

typedef struct
cuflow_gflexq_entry
cuflow_gflexq_entry_t

Functions

void cuflow_gflexq_init (cuflow_gflexq_t flexq, cuflow_priority_t initpri)
cuflow_gflexq_t cuflow_gflexq_new (cuflow_priority_t initpri)
cuflow_priority_t cuflow_gflexq_priority (cuflow_gflexq_t flexq)
void cuflow_gflexq_raise_priority (cuflow_gflexq_t flexq, cuflow_priority_t min_priority)
void cuflow_gflexq_raise_priority_glck (cuflow_gflexq_t flexq, cuflow_priority_t min_priority)
void cuflow_gflexq_sched (cuflow_gflexq_t flexq, cuflow_workq_fn_t fn)
void cuflow_gflexq_sched_glck (cuflow_gflexq_t flexq, cuflow_workq_fn_t fn)
void cuflow_gflexq_enter (cuflow_gflexq_t flexq, cuflow_gflexq_entry_t entry)
void cuflow_gflexq_enter_glck (cuflow_gflexq_t flexq, cuflow_gflexq_entry_t entry)
void cuflow_gflexq_leave (cuflow_gflexq_entry_t entry)
void cuflow_gflexq_leave_glck (cuflow_gflexq_entry_t entry)

Detailed Description

Deprecated:
Use cuflow/sched.h provides a simpler and more efficient alternative.

This module provides a data structure cuflow_gflexq, a work queue linked to the global work queue at a modifiable priority. These queues are hierachical, each queue can have several subqueues, and several queues can share the same subqueue. The hierachical structure is used to bump up the priority of all dependent calculations when a high priority job requires the calculation represented by a queue (and its subqueues).

The main purpose of all this is to implement promises, which present a high-level interface for work-sharing between threads and guard the result so that it is not accessed before it is finished.


Function Documentation

void cuflow_gflexq_enter ( cuflow_gflexq_t  flexq,
cuflow_gflexq_entry_t  entry 
)

Set flexq as the work queue for subsequent cuflow_gworkq_sched operations, and save the current state to entry for restoration with cuflow_gflexq_leave. Several context may enter the same queue, which implies that one queue can have several parent queues. When the priority of a parent queue is raised, it affects all subqueues recursively.

void cuflow_gflexq_enter_glck ( cuflow_gflexq_t  flexq,
cuflow_gflexq_entry_t  entry 
)

Same as cuflow_gflexq_enter, but assuming gworkq-lock is held.

void cuflow_gflexq_init ( cuflow_gflexq_t  flexq,
cuflow_priority_t  initpri 
)

Construct flexq with initial priority initpri.

void cuflow_gflexq_leave ( cuflow_gflexq_entry_t  entry  ) 

Drop the current work queue and restore the state saved in entry, as obtain from the matching cuflow_gflexq_enter. This operation also unlinks the subqueue, so that it will no longer be affected by changes to the priority of its no-longer parent.

void cuflow_gflexq_leave_glck ( cuflow_gflexq_entry_t  entry  ) 

Same as cuflow_gflexq_leave, but assuming gworkq-lock is held.

cuflow_gflexq_t cuflow_gflexq_new ( cuflow_priority_t  initpri  ) 

Return an empty queue with initial priority initpri.

cuflow_priority_t cuflow_gflexq_priority ( cuflow_gflexq_t  flexq  ) 

The priority at which work on flexq will be run.

void cuflow_gflexq_raise_priority ( cuflow_gflexq_t  flexq,
cuflow_priority_t  min_priority 
)

Raise the priority of flexq and all subqueues to at least min_priority. This function will never lower the priority of any queues. This semantics is acertains that when the same work is requested by functions running at different priorities, it will be scheduled at the highest priority amoung the requestors.

void cuflow_gflexq_sched ( cuflow_gflexq_t  flexq,
cuflow_workq_fn_t  fn 
)

Schedule fn on flexq. If the queue is empty, this will cause flexq to be activated by putting it on the global queue at the predefined priority.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.