E D R S I H C RSS
ID
Password
Join
자기가 생전에는 결코 그 밑에 앉아 쉴 수 없다는 사실을 잘 알면서도 그늘을 드리워 주는 나무를 심을 때에 그 사람은 적어도 인생의 의미를 깨닫기 시작한 것이다. ―D.E.트루블라드

 * 원문링크 : [http]class='underline'>DynamicMessage__Queue.html
  • doxygen 문서에서 퍼옴

template<ACE_SYNCH_DECL>
class ACE_Dynamic_Message_Queue<>
A derived class which adapts the class in order to maintain dynamic priorities for enqueued and manage the queue order according to these dynamic priorities.

The messages in the queue are managed so as to preserve a logical ordering with minimal overhead per enqueue and dequeue operation.

For this reason, the actual order of messages in the linked list of the queue may differ from their priority order.

As time passes, a message may change from pending status to late status, and eventually to beyond late status.

To minimize reordering overhead under this design force, three separate boundaries are maintained within the linked list of messages.

Messages are dequeued preferentially from the head of the pending portion, then the head of the late portion, and finally from the head of the beyond late portion.

In this way, only the boundaries need to be maintained (which can be done efficiently, as aging messages maintain the same linked list order as they progress from one status to the next), with no reordering of the messages themselves, while providing correct priority ordered dequeueing semantics.

Head and tail enqueue methods inherited from ACE_Message_Queue are made private to prevent out-of-order messages from confusing management of the various portions of the queue.

Messages in the pending portion of the queue whose priority becomes late (according to the specific dynamic strategy) advance into the late portion of the queue.

Messages in the late portion of the queue whose priority becomes later than can be represented advance to the beyond_late portion of the queue.

These behaviors support a limited schedule overrun, with pending messages prioritized ahead of late messages, and late messages ahead of beyond late messages.

These behaviors can be modified in derived classes by providing alternative definitions for the appropriate virtual methods.

When filled with messages, the queue's linked list should look like:
H T | | B - B - B - B - L - L - L - P - P - P - P - P | | | | | | BH BT LH LT PH PT 

Where the symbols are as follows:
H = Head of the entire list
T = Tail of the entire list
B = Beyond late message
BH = Beyond late messages Head
BT = Beyond late messages Tail
L = Late message 
LH = Late messages Head 
LT = Late messages Tail 
P = Pending message 
PH = Pending messages Head 
PT = Pending messages Tail 

Caveat: the virtual methods enqueue_tail, enqueue_head, and peek_dequeue_head have semantics for the static message queues that cannot be guaranteed for dynamic message queues. The peek_dequeue_head method just calls the base class method, while the two enqueue methods call the priority enqueue method. The order of messages in the dynamic queue is a function of message deadlines and how long they are in the queues. You can manipulate these in some cases to ensure the correct semantics, but that is not a very stable or portable approach (discouraged).

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.3283 sec