Unsorted-Discipline Priority Queues

Một phần của tài liệu High performance sequential and lock free parallel access priority queue structures (Trang 25 - 28)

An example of an unsorted-discipline priority queue is the *+,-./ 0d linked list. The elements in the list are not kept in any order of priority and usually on a first-come- first-serve basis. An Insert operation is O(1) since the new element is simply appended to the list either at the head or the tail of the list. A DeleteMin operation is however guaranteed to be Ω(n) because the entire list of n elements has to be searched to determine the element with the highest priority. It is clear that compared to the sorted-discipline linked list mentioned in Section 1.2.1., the overall complexity of the unsorted linked list is clearly higher than the sorted-discipline linked list.

The Unsorted-discipline Calendar Queue (UCQ) is also another unsorted- discipline priority queue discussed by Erickson et al. [2000]. The UCQ is similar to

the SCQ for the most part except that each bucket in UCQ consists of an unsorted linked list; each bucket in SCQ consists of a sorted linked list. Compared to the UCQ, the SCQ is by far more practical and thus more popular because the number of operations required for a basic Insert and DeleteMin operation is 1(23 4 5l63 7) and O(1) respectively in an SCQ bucket where nsublist represents the number of events in an SCQ bucket. For the case of the UCQ, the number of operations required is higher, i.e. O(1) for enqueue and guaranteed nsublist (i.e. Ω(nsublist)) operations for dequeue. Hence on average, the UCQ has higher amortized cost compared to the SCQ.

Though a UCQ may not perform as well as an SCQ, and has not been practically used, it allows for the derivation of an interesting theoretical property of the Calendar Queue. Erickson et al. employed Markov chain analysis to investigate the performance of UCQ under a static scenario where the number of active events N in the UCQ remains a constant. Generally, the number of active events may vary over time. However, the static case is an important case because it is commonly encountered in discrete event simulations. For instance, when simulating a parallel computer, if there are N processors, then there are exactly N active events in the priority queue [Erickson et al. 2000]. Another example is when we use the process- oriented Swan simulator [Thng and Goh 2004] to simulate computer network topologies; if there are N nodes, then there are exactly N active events in the priority queue.

Erickson et al. [2000] have proven theoretically that under a static scenario where the number of events N in the UCQ remains a constant, the UCQ has constant expected processing time per event if the mean of the jump (à) variable is a constant.

The jump, which has the value t e( )−t e( )0 , is a random variable sampled from some

priority increment distribution that has a mean jump à, where 8 is a newly generated event with time ( )9 8 and 80 is the current minimal time. They proved that this expected processing time depends on à and not on the shape of its probability density. They derived the expected time per event for the infinite bucket UCQ (UCQ:) and the finite bucket UCQ (UCQ;).

The best theoretical performance occurs in the UCQ: where there are an infinite number of buckets and where the array of buckets in the UCQ: spans one year time interval. The performance of the UCQ; is at best equal to that of the UCQ:. The events in the UCQ: are processed bucket-by-bucket, unlike in the UCQ; where there are a finite number of buckets. In a UCQ;, the buckets can contain events which are in the future years and thus will be processed only much later. This results in a poorer performing UCQ since the DeleteMin operation has to search through these future years events. It is also likely that after searching an entire bucket of events, there is no event with the minimum timestamp because all the events in the bucket are in the future years.

We notice that their optimized UCQ suffers from the same vulnerabilities as the SCQ, which have been mentioned earlier. In simulation models where < and/or

= can vary with time, the UCQ must undergo costly resize operations to obtain a new bucketwidth δ and a new number of buckets used. Otherwise, its performance will degrade to >(<). On top of the problems associated with the SCQ, the UCQ has an Ω(?@ ABC:@ D) cost per DeleteMin operation, where ?@AB C:@D is the number of the events in the bucket from which the event is deleted. Nevertheless, it is a well-written theoretical article which provided insights into improving the performance of the UCQ.

Một phần của tài liệu High performance sequential and lock free parallel access priority queue structures (Trang 25 - 28)

Tải bản đầy đủ (PDF)

(205 trang)