简体   繁体   中英

What kind of DataStructures can enable parallel processing

Binary Tree: For example, if we need to process Tree datastructure parallely. We can spawn one thread to process left node, and another thread to process right node. Now both can independently run on the same data strucuture.

It is certainly not possible to have same kind of parallelism for linked list.

I am thinking, if there are any other data structures, that gives us the flexibility for acheiving parallelism similar to a binary tree ?

What type of parallelism? You can always read in parallel but for writes it's more complicated. If the only thing that is being changed is the data stored in the node there is no reason why you can't parallelize a LinkedList or an Array by creating a lock for each individual node rather than the entire list. But if the connections of the structure is affected then there are more things to worry about.

The answer depends on what you are trying to do and how you set up the locks, conditions etc but nothing is inherently parallelizable or uparallelizable.

When you talk about parallel processing two things come in my mind 1) Task Parallelism 2) Data Parallelism. I will talk about the second here.

Check superset of Trees: Graphs. Many huge data problems based on Wisdom of Crowd/Collective Intelligence can be modelled as a Graph. Parallel processing of Graph using Map Reduce framework will be interesting for you to go through.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM