queue.h File Reference

#include <config/config_param.h>
#include <config/config_cparam.h>
#include <sys/ktypes.h>

Defines

#define RUN_Q   1
 Queue Types.

Functions

void alloc_q (queuep queue, unsigned char max_items, unsigned char qtype, unsigned short size, unsigned char qno)
void qinit (queuep queue)
void enq (queuep queue, const void *item, unsigned short key)
void deq (queuep queue, void *item, unsigned short key)
int pdelq (queuep queue, pid_t item)
void pdeq (queuep queue, pid_t *item, unsigned short key)
void penq (queuep queue, pid_t item, unsigned short key)
void prio_penq (queuep queue, pid_t item, unsigned short key)
void prio_pdeq (queuep queue, pid_t *item, unsigned short key)

Detailed Description

Queue management declarations and defines

Function Documentation

void alloc_q queuep  queue,
unsigned char  max_items,
unsigned char  qtype,
unsigned short  size,
unsigned char  qno
 

Initialize a Queue - Allocate array of memory to the Queue. Called during system initialization.

Parameters:
queue is the queue of items.
  • max_items is the maximum queue length.
  • size is size of the elements in the queue.
  • qtype is the type of Q. Each Q is allocated a static memory
  • qno is the queue number, In case of multiple queue's of the same type.
Returns:
  • Nothing
Note:
  • None

void deq queuep  queue,
void *  item,
unsigned short  key
 

Dequeue the process from the Queue, based on the schemes.

Parameters:
queue is the queue of items.
  • item is buffer where queue element is returned. If queue is empty then NULL is returned.
  • key for removing from the Queue.
Returns:
  • Queue element is returned in item.
  • Null is assigned to item if Error.
Note:
  • No error is flagged on queue being empty

void enq queuep  queue,
const void *  item,
unsigned short  key
 

enqueue the item in the Queue.

Parameters:
queue is the queue of items.
  • item is the queue element.
  • key for insertion into the Queue. Can be priority.
Returns:
  • Nothing
Note:
  • key is not used currently
  • No error is flagged if queue is full

int pdelq queuep  queue,
pid_t  item
 

Delete a pid from the Queue.

Parameters:
queue is the queue of items.
  • item is the element to delete. If queue is empty then -1 is returned.
Returns:
  • Return 0 on success and -1 on errors
Note:
  • Since the Queue implementation is array, this operation is very expensive as other entries needs to be copied.

void pdeq queuep  queue,
pid_t *  item,
unsigned short  key
 

Dequeue the process from the Queue, based on the schemes.

Parameters:
queue is the queue of items.
  • item is buffer where queue element is returned. If queue is empty then 255 is returned.
  • key for removing from the Queue.
Returns:
  • Queue element is returned in item.
  • 255 (-1) is assigned to item if Error.
Note:
  • No error is flagged if queue is empty

void penq queuep  queue,
pid_t  item,
unsigned short  key
 

Enqueue a process id in the Queue.

Parameters:
queue is the queue of items.
  • item is the queue element.
  • key for insertion into the Queue. Can be priority.
Returns:
  • Nothing
Note:
  • key is not used currently
  • No error is flagged if queue is full.

void prio_pdeq queuep  queue,
pid_t *  item,
unsigned short  key
 

Dequeue the highest priority process from the Queue.

Parameters:
queue is the queue of items.
  • item is buffer where queue element is returned. If queue is empty then 255 is returned.
  • Key for removing from the Queue (priority)
Returns:
  • Queue element is returned in item.
  • 255 (-1) is assigned to item if Error.
Note:
  • Uses queue array structure as a binary heap for implementing priority queue. 0 is highest priority
  • The priority key is not used currently. Instead the value is obtained from the ptable directly.

void prio_penq queuep  queue,
pid_t  item,
unsigned short  key
 

Enqueue a process in the Priority Queue.

Parameters:
queue is the queue of items.
  • item is the queue element.
  • Key for insertion (priority).
Returns:
  • Nothing
Note:
  • No error is flagged if queue is full.
  • Uses queue array structure as a binary heap for implementing priority queue. 0 is highest priority
  • The priority key is not used. Instead the value is obtained directly from the ptable.

void qinit queuep  queue  ) 
 

Intialize the Queue.

Parameters:
queue is the queue of items.
Returns:
  • Nothing
Note:
  • None


Generated on Thu Feb 13 14:46:24 2014 for 2014.1_doc by  doxygen 1.4.5