📝 Types of parallelism data vs task parallelism (33 MCQs)
Two Approaches to Dividing Work Across Processors
Data parallelism and task parallelism are two approaches to organising parallel computation in multicore operating systems. Data parallelism divides a dataset into separate portions and applies the same operation to each portion. Task parallelism assigns different operations or functions to separate execution threads. Both approaches expose independent work that operating system schedulers can distribute across available processor cores.
Why Computational Work Requires Different Partitioning Strategies
Parallel applications differ in whether their workload contains repeated operations over large datasets or distinct activities with different responsibilities. Data partitioning suits uniform calculations, whereas task partitioning suits applications with multiple functional components. Choosing an unsuitable approach can introduce communication overhead, uneven execution times, dependencies, and idle processor cores.
Data Partitioning and Independent Task Assignment
In data parallelism, a dataset is divided among worker threads, each applying the same computation to its assigned portion. In task parallelism, threads perform different operations, potentially on shared or separate data. The scheduler executes runnable threads on available cores, while synchronisation coordinates results and dependencies between concurrently running tasks.
Comparing Matrix Processing with Web Server Tasks
Consider a matrix containing 4,000 rows. Four threads can each process 1,000 rows using the same multiplication operation, demonstrating data parallelism. In a web server, separate threads may handle authentication, database access, logging, and response generation, demonstrating task parallelism. The first divides data; the second divides responsibilities.
Throughput, Workload Distribution, and Execution Dependencies
Data parallelism works effectively for scientific calculations, image processing, and large numerical datasets with independent elements. Task parallelism suits servers, multimedia applications, and systems containing distinct activities. Data parallel workloads may suffer from uneven partition sizes, while task parallelism can encounter dependencies and different execution durations. Both require appropriate synchronisation and resource management.
Misconceptions About Data and Task Parallelism
'Data parallelism means every thread uses different operations' is incorrect because threads generally apply the same operation to different data. 'Task parallelism requires every task to access different data' is incorrect because tasks may share information. 'The two approaches cannot be combined' is incorrect because applications can use both forms together.
Exam Focus: Identifying Parallelism from Application Scenarios
Classify examples according to whether work is divided by dataset or by functional responsibility. Trace how four cores process matrix partitions and how independent server activities execute concurrently. Questions may ask you to compare workload distribution, identify dependencies, select a parallelisation approach, or explain how data and task parallelism can coexist.
Key Terms of Data and Task Parallelism
- Data parallelism - Same operation on separate data.
- Task parallelism - Different operations executed concurrently.
- Partitioning - Dividing work into smaller portions.
- Worker thread - Thread performing assigned work.
- Dependency - Requirement controlling execution order.
- Synchronization - Coordination between parallel activities.
📝 All Types of parallelism data vs task parallelism MCQs
Q1. A program applies the same brightness adjustment to every pixel in four separate image regions. Which form of parallelism is being used?
📖 Explanation: Data parallelism divides a dataset into portions and applies the same logical operation to each portion. Here, every worker adjusts different pixels using the same brightness formula, so the work is data-oriented.
Q2. A video application assigns audio decoding to one worker, subtitle synchronization to another, and frame rendering to a third. Which form of parallelism is primarily demonstrated?
📖 Explanation: Task parallelism distributes distinct operations among concurrent workers. Audio decoding, subtitle synchronization, and frame rendering have different responsibilities, so their division is task-oriented rather than the same computation over separate data partitions.
Q3. A team labels an application data-parallel merely because it runs on eight cores. What additional information is needed to justify that classification?
📖 Explanation: Core count alone does not identify the type of parallelism. Data parallelism is defined by the work distribution: multiple workers apply the same logical operation to different portions of a dataset, rather than performing unrelated functions.
Q4. A validation program assigns each processor a different group of customer records, but every processor applies the same validation rules. Which classification fits the design?
📖 Explanation: The workers receive different portions of the records but perform the same validation computation. This is data parallelism; different input values or record groups do not change the shared logical operation being applied.
Q5. Two workers calculate the square and cube of every value in the same array. Which statement best describes this arrangement?
📖 Explanation: Task parallelism distributes distinct operations across workers, and those workers may access the same data. Computing squares and cubes are different functions, so sharing one array does not make this design data parallel.
Q6. A matrix application divides rows among four workers, each applying the same transformation. A separate worker also writes completed results to disk. Which description captures the design?
📖 Explanation: The matrix rows are partitioned and processed with one common transformation, which is data parallelism. Writing results is a separate responsibility, so the application also contains task-level work alongside the data-parallel computation.
Q7. A program sums an array of 12,000 independent values using four workers. If the array is divided evenly, how many values should each worker process?
📖 Explanation: An even partition gives each worker the same number of array elements. The calculation is , so each worker sums 3,000 values before the partial results are combined.
Q8. A scientific program computes two statistics over the same measurements: one worker calculates the mean while another calculates the maximum. Which design most directly expresses task parallelism?
📖 Explanation: The workers perform different statistical functions, even though they access the same measurement set. Assigning the mean and maximum calculations to separate workers distributes tasks rather than distributing one identical operation across data partitions.
Q9. A data-parallel image filter gives one worker 10,000 pixels and another worker 1,000 pixels. Does this unequal partition change the type of parallelism?
📖 Explanation: The classification depends on workers applying the same operation to different data portions, not on equal portion sizes. Unequal partitions can still be data parallel, but they may create load imbalance and idle cores.
Q10. A pair of workers processes the same customer dataset. One checks credit limits while the other generates account summaries. Which statement is most accurate?
📖 Explanation: Task parallelism is based on distributing different operations, not necessarily different datasets. The credit check and summary generation are distinct functions, and they may operate on the same customer records while running concurrently.
Q11. A program applies an identical blur operation to separate video-frame regions. Which property is essential to classify this as data parallelism?
📖 Explanation: Data parallelism requires a common operation across separate data portions, not identical data values. Each worker can blur a different frame region using the same algorithm, provided dependencies between regions are handled correctly.
Q12. A research application assigns object detection, object classification, and report compression to separate workers. Which feature makes this task-oriented rather than straightforward data parallelism?
📖 Explanation: The defining distinction is the work assigned to each worker. Detection, classification, and compression are different functions, so the design distributes responsibilities rather than applying one repeated computation to separate portions of data.
Q13. A system divides a dataset into eight chunks. Each chunk is processed independently, but the algorithm selected for a chunk depends on its contents and may differ from other chunks. What is the strongest classification?
📖 Explanation: Partitioning the input does not by itself establish data parallelism. Because different chunks may require different algorithms, the workers perform distinct operations; the design has task-oriented characteristics despite its data partitioning.
Q14. A matrix is divided into four blocks. Each worker sorts its own block, then a final worker merges the four sorted outputs. Which description best captures the computation?
📖 Explanation: The four block sorts apply the same operation to separate data portions, exposing data parallelism. The merge depends on all sorted outputs, so it forms a later stage that cannot complete before those tasks finish.
Q15. A data-analysis application gives one worker the square calculation and another the logarithm calculation for the same input records. Which classification is most appropriate?
📖 Explanation: The operations assigned to the workers are different: one computes squares and the other logarithms. Task parallelism allows distinct functions to run concurrently and does not require their input datasets to be different.
Q16. A tax-processing service distributes customer batches among workers using the same tax formula. Another worker independently generates an audit summary. Which interpretation is best?
📖 Explanation: Customer batches use the same tax computation on separate data portions, which is data parallelism. The audit summary is a distinct function, so the application combines data-level and task-level parallel work.
Q17. A program applies the same transformation to 4,000 independent records using four workers. Each record requires 2 microseconds of computation, and the records are evenly distributed. Ignoring overhead, how long does the computation take?
📖 Explanation: Each worker receives 1,000 records. At 2 microseconds per record, each worker needs microseconds, or 2 milliseconds. All four portions run concurrently, so their common duration determines the computation time.
Q18. Four workers sum separate, equally sized portions of an array. Each produces one partial sum. What operation completes the overall data-parallel calculation?
📖 Explanation: Each worker computes a result for its own data partition. A reduction combines those partial sums into the final total; the combining stage has its own cost and must wait for the required partial results.
Q19. A four-worker system processes 1,200 records with the same algorithm. One worker receives 600 records and each of the other three receives 200. What equal redistribution would give each worker the same record count?
📖 Explanation: The total is 1,200 records, so an even allocation gives records to each worker. This removes the stated count imbalance, although differences in record-processing cost may still affect completion times.
Q20. A data-parallel benchmark reports worker count and throughput: (1, 30) ; (2, 55) ; (3, 72) ; (4, 80) ; (5, 80), where throughput is measured in jobs per second. What trend is shown?
📖 Explanation: Throughput rises from 30 to 80 jobs per second, then remains at 80 when a fifth worker is added. The plateau indicates that another worker provides no measured gain, possibly because of a bottleneck or saturation.
Q21. A program reports total completion time for data-parallel work as worker count and elapsed time: (1, 80 ms) ; (2, 42 ms) ; (3, 30 ms) ; (4, 24 ms) ; (5, 24 ms). What does the change from four to five workers indicate?
📖 Explanation: The reported time is 24 ms with both four and five workers. Thus the fifth worker produces no measured improvement, suggesting that additional parallel capacity is not useful for this workload under the tested conditions.
Q22. A load chart shows worker identifier and assigned records: (1, 600) ; (2, 200) ; (3, 200) ; (4, 200) ; (5, 0). Which conclusion is justified?
📖 Explanation: Worker one receives 600 records while three others receive 200 each and one receives none. This uneven distribution can leave processors idle while the most heavily loaded worker continues, reducing parallel efficiency.
Q23. A student says that an application uses data parallelism because it has eight cores. What is the flaw in this reasoning?
📖 Explanation: The flawed step is inferring work structure from hardware quantity. Eight cores may execute the same operation on separate data partitions or different functions; classification requires examining what the workers actually do.
Q24. A student observes four processors executing four tasks and concludes the program must use task parallelism. Which correction is most accurate?
📖 Explanation: The flawed step is treating the existence of four tasks as proof of distinct operations. If each worker performs the same computation on a different data block, the defining pattern is data parallelism.
Q25. A student claims that task-parallel workers must always operate on completely different datasets. Which statement corrects the misconception?
📖 Explanation: The claim incorrectly ties task identity to data ownership. Task parallelism distributes distinct operations, and those operations may access a common dataset or separate datasets depending on the application's requirements and dependencies.
Q26. A student says that any application processing a large dataset is automatically data parallel. Which example disproves the claim?
📖 Explanation: A large dataset does not determine the parallelism type. Detection, classification, and compression are different functions, so assigning them to separate workers is task-oriented even when their information originates from one dataset.
Q27. A program divides data into eight chunks, but each worker applies a different algorithm to its assigned chunk. A student classifies it as pure data parallelism because the data was partitioned. What was overlooked?
📖 Explanation: The flawed step is using partitioning alone as the classification test. Data parallelism requires the same logical operation across data portions; when workers use different algorithms, task-level distinctions are also present.
Q28. A server processes independent requests, but every worker repeatedly reads a shared status table and waits for another worker to update it. Why might adding workers fail to improve performance?
📖 Explanation: Workers may spend substantial time waiting for shared information rather than completing requests. Contention and synchronization reduce useful parallel work, so increasing worker count can fail to improve throughput despite independent request handling.
Q29. A data-parallel program updates array element i using the already updated value of element i-1. Why can assigning adjacent elements to different workers cause incorrect results?
📖 Explanation: The update for each element depends on a preceding result, so iterations are not independent. Running them without respecting that dependency can expose stale or incomplete values and violate the required computation order.
Q30. An image application has three independent activities: loading files, applying a filter, and writing output. Within filtering, the same operation is applied to many independent pixel blocks. Which interpretation is correct?
📖 Explanation: Loading, filtering, and writing are distinct activities, exposing task parallelism. Within filtering, workers apply one operation to separate pixel blocks, exposing data parallelism; both forms can coexist in one application.
Q31. A team must choose between dividing a uniform matrix calculation across data blocks and assigning separate workflow functions to different workers. Which information is most useful when estimating the better design?
📖 Explanation: The best design depends on how independently its work can proceed and how evenly it can be distributed. Dependencies, communication, coordination overhead, and task costs affect performance beyond core count or dataset size.
Q32. A web service assigns authentication, database querying, and logging to separate workers. The database query cannot begin until authentication succeeds. Which design statement is most accurate?
📖 Explanation: Authentication, querying, and logging are distinct functions, so the design exposes task parallelism. However, the query depends on successful authentication and must respect that ordering, while independent logging may proceed separately.
Q33. A program processes 2,400 records using four workers, each applying the same operation. Each record takes 1 ms, and each worker receives 600 records. A final merge takes 100 ms. Ignoring overhead, what is total completion time?
📖 Explanation: Each worker processes records, requiring 600 ms. The workers run concurrently, then the final merge adds 100 ms, giving ms total under the stated assumptions.