4.2.2 Types of Parallelism
In general, there are two types of parallelism: data parallelism and task
parallelism. Data parallelism focuses on distributing subsets of the same data
across multiple computing cores and performing the same operation on each
core. Consider, for example, summing the contents of an array of size N. On a
single-core system, one thread would simply sum the elements [0] . . . [N − 1].
On a dual-core system, however, thread A, running on core 0, could sum the
elements [0] . . . [N/2 − 1] while thread B, running on core 1, could sum the
elements [N/2] . . . [N − 1]. The two threads would be running in parallel on
separate computing cores.
Task parallelism involves distributing not data but tasks (threads) across
multiple computing cores. Each thread is performing a unique operation.
Different threads may be operating on the same data, or they may be operating
on different data. Consider again our example above. In contrast to that
situation, an example of task parallelism might involve two threads, each
performing a unique statistical operation on the array of elements. The threads
again are operating in parallel on separate computing cores, but each is
performing a unique operation.
4.2.2 Types of ParallelismIn general, there are two types of parallelism: data parallelism and taskparallelism. Data parallelism focuses on distributing subsets of the same dataacross multiple computing cores and performing the same operation on eachcore. Consider, for example, summing the contents of an array of size N. On asingle-core system, one thread would simply sum the elements [0] . . . [N − 1].On a dual-core system, however, thread A, running on core 0, could sum theelements [0] . . . [N/2 − 1] while thread B, running on core 1, could sum theelements [N/2] . . . [N − 1]. The two threads would be running in parallel onseparate computing cores.Task parallelism involves distributing not data but tasks (threads) acrossmultiple computing cores. Each thread is performing a unique operation.Different threads may be operating on the same data, or they may be operatingon different data. Consider again our example above. In contrast to thatsituation, an example of task parallelism might involve two threads, eachperforming a unique statistical operation on the array of elements. The threadsagain are operating in parallel on separate computing cores, but each isperforming a unique operation.
การแปล กรุณารอสักครู่..