Abstract
Achieving optimal $O(\log n)$ time complexity for parallel sorting has historically been demonstrated on the Concurrent-Read Exclusive-Write (CREW) PRAM model. However, the more restrictive Concurrent-Read Owner-Write (CROW) model, which better reflects the constraints of distributed memory systems, typically incurs an $O(\log n)$ overhead for memory-writing operations, resulting in $O(\log^2 n)$ sorting times. This paper presents a novel parallel merge sort algorithm that achieves $O(\log n)$ time on the CROW PRAM. By utilizing doubly-linked lists and a "divided-merging" technique supported by dynamic processor allocation, the algorithm bypasses the traditional requirement of knowing an element's final array index prior to writing.
Introduction
In parallel computing theory, the Parallel Random Access Machine (PRAM) serves as a foundational model for algorithmic analysis. Within this framework, the Concurrent-Read Exclusive-Write (CREW) model is widely used, allowing any processor to write to any memory location provided no conflicts occur. A more constrained and realistic variant is the Concurrent-Read Owner-Write (CROW) model. In CROW, every memory cell is assigned a permanent "owner" processor; only this owner is permitted to write to that specific cell.
The primary challenge in implementing a standard merge sort on a CROW PRAM is the data-movement bottleneck. In traditional array-based merge sorts, such as Cole’s algorithm, an element's final rank is calculated during the merge step, and the element is then written to that specific index. In a CROW environment, the processor holding the element rarely owns the memory cell corresponding to its new rank. Resolving these ownership conflicts typically adds a logarithmic factor to the time complexity. This research introduces a methodology to close this performance gap, achieving $O(\log n)$ time complexity in a restricted writing environment.
Methodology
Data Structures and Ownership
To overcome the limitations of fixed-index arrays, the authors replace traditional arrays with doubly-linked lists. Each node in the list consists of three memory locations: the value, a predecessor pointer, and a successor pointer. Crucially, each node is owned by a specific processor. This structure allows the algorithm to manipulate the sequence of elements by updating pointers and creating new nodes rather than moving data to pre-assigned array indices.
Divided-Merging and the 3-Cover Property
The core of the algorithm is the "Divided-Merging" technique. Instead of performing a global merge of two sorted lists, the algorithm partitions the lists into small segments called "divisions." The size of these divisions is strictly bounded by a constant, facilitated by a "3-cover" property. This property ensures that any division contains a manageable number of items, allowing a single processor to read the division, sort the elements locally, and establish new ownership for the merged result in $O(1)$ time per level of the recursion tree.
Non-Fixed Sampling
Efficiency across the levels of the recursion tree is maintained through a flexible sampling strategy. Unlike standard parallel merge sorts that might sample every $k$-th element, this algorithm employs a non-fixed sampling range (typically between 3 and 6 elements). This flexibility is essential for maintaining the inductive invariants required for constant-time merging at each level.
Processor Spinning
To handle the dynamic nature of the linked lists while adhering to the owner-write restriction, the algorithm utilizes "processor spinning." This mechanism allows an existing processor to create and initialize a new processor. This capability is used to dynamically grow the data structure, ensuring that every new node in the merged list has a corresponding owner processor ready to perform the necessary write operations.
Key Insights
- Ownership as a Constraint: The fundamental insight is that if data cannot be moved to a specific address, the algorithm must instead move the ownership or create new owned locations. By utilizing linked lists and processor spinning, the algorithm avoids the need to pre-calculate global array indices.
- Constant-Time Local Operations: By ensuring that divisions remain small through the 3-cover property, the work required by any individual processor during a merge step is reduced to $O(1)$. This allows the overall time complexity to be dominated by the depth of the merge tree ($O(\log n)$).
- Inductive Invariants: The algorithm relies on complex inductive assumptions to ensure that predecessor and successor pointers always point to a neighborhood close enough to the target item, enabling constant-time lookups.
Results and Complexity
- Time Complexity: The algorithm achieves a parallel time complexity of $O(\log n)$, which is the theoretical lower bound for comparison-based sorting in PRAM models.
- Processor Complexity: The algorithm requires $O(n \log n)$ processors. While this is higher than the $O(n)$ processors used in the most efficient CREW algorithms, it represents a significant theoretical milestone for the CROW model.
- Theoretical Validation: The authors demonstrate that the Divided-Merging step maintains the necessary sampling invariants to ensure constant-time performance per level of the recursion.
Discussion and Limitations
While this algorithm provides a significant theoretical result, there are several areas for further development. First, the algorithm is not "work-optimal"; a work-optimal algorithm would require only $O(n / \log n)$ processors to achieve $O(\log n)$ time. Second, the practical implementation of "processor spinning" and the management of a massive number of doubly-linked list pointers would likely introduce significant constant-factor overheads in a real-world distributed system.
Finally, the authors note that the full technical proofs for certain lemmas—specifically those regarding the logic of pointer movement—are extensive and were deferred to the full technical report. Future work may focus on reducing the processor count and exploring the empirical performance of these structures in distributed memory environments.
Summary updated