🎓 BookMCQ
← Back to 4. Threads in Operating System

📝 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.
11
Easy
11
Medium
11
Hard

📝 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?

A.Data parallelism, because one operation is applied to different data partitions ✅
B.Task parallelism, because each region must use a different algorithm
C.Sequential execution, because pixels are stored in one image
D.Task parallelism, because each processor receives a separate memory address
💡 Difficulty: easy | ✅ Correct: A

📖 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?

A.Data parallelism, because every worker processes part of one video file
B.Instruction-level parallelism, because machine instructions execute concurrently
C.Task parallelism, because the workers perform distinct operations ✅
D.Data parallelism, because all workers receive identical input arrays
💡 Difficulty: easy | ✅ Correct: C

📖 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?

A.Whether all cores have identical clock frequencies
B.Whether the cores apply the same operation to different portions of data ✅
C.Whether the operating system has eight active processes
D.Whether the computer contains more than one processor package
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Task parallelism, because the record groups contain different customers
B.Sequential processing, because validation rules are identical
C.Task parallelism, because each processor receives a different input file
D.Data parallelism, because the same computation is applied to separate record groups ✅
💡 Difficulty: medium | ✅ Correct: D

📖 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?

A.It is data parallelism because both workers read one array
B.It is sequential because both operations use the same input values
C.It is task parallelism because the workers perform different operations on the data ✅
D.It is not parallelism because the dataset is not divided
💡 Difficulty: easy | ✅ Correct: C

📖 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?

A.It combines data parallelism within the matrix transformation with a distinct output task ✅
B.It is only task parallelism because writing uses a different function
C.It is only sequential because the results are eventually written to disk
D.It is neither form because the workers use shared memory
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.1000
B.2000
C.4000
D.3000 ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: An even partition gives each worker the same number of array elements. The calculation is 12000/4=300012000/4=3000, 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?

A.Give each worker half the measurements and have both calculate the mean only
B.Assign the mean and maximum calculations to separate workers ✅
C.Make both workers calculate both statistics in a fixed sequence
D.Copy the measurements into two files and run the same calculation on each
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Yes, unequal partitions automatically make the work task parallel
B.Yes, because data parallelism requires identical input values
C.No, it remains data parallelism, although imbalance may leave one worker running longer ✅
D.No, because every worker must receive exactly one pixel
💡 Difficulty: easy | ✅ Correct: C

📖 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?

A.It is task parallelism because the workers perform different functions on possibly shared data ✅
B.It is data parallelism because both workers read the same dataset
C.It cannot be parallel because both workers access the same records
D.It is data parallelism because each function uses customer information
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.Each worker must use a different algorithm on its region
B.Each worker must process the entire video independently
C.The frame regions must contain identical pixel values
D.Workers apply the same logical operation to distinct portions of the data ✅
💡 Difficulty: easy | ✅ Correct: D

📖 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?

A.All workers access information originating from the same dataset
B.The workers have different functional responsibilities rather than repeating one operation on data partitions ✅
C.The application contains more than one input file
D.The tasks are executed by threads instead of processes
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Pure data parallelism, because chunking alone determines the type
B.Sequential execution, because different algorithms cannot run concurrently
C.Task-oriented parallelism is present because workers may perform different operations, even though the input is partitioned ✅
D.No parallelism is possible unless every chunk has the same size
💡 Difficulty: hard | ✅ Correct: C

📖 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?

A.The block sorts expose data parallelism, followed by a dependent merge stage ✅
B.The entire computation is task parallelism because sorting and merging have different names
C.The block sorts must execute sequentially because the output is one matrix
D.The merge can finish before any block has been sorted
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.Data parallelism, because the records are separate values
B.Task parallelism, because the workers execute different operations on the data ✅
C.Sequential processing, because both operations use the same records
D.Data parallelism, because both results are numerical
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.The entire service is only task parallelism because it has an audit worker
B.The entire service is only data parallelism because tax records are partitioned
C.The design combines data parallelism across customer batches with task parallelism for the audit activity ✅
D.The design is sequential because tax calculation must use a formula
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.0.5 milliseconds
B.2 milliseconds ✅
C.4 milliseconds
D.8 milliseconds
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Each worker receives 1,000 records. At 2 microseconds per record, each worker needs 1000×2=20001000\times2=2000 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?

A.Discard three partial sums because only one worker can return a result
B.Repeat the entire array calculation separately on every worker
C.Combine the partial sums using a reduction operation ✅
D.Convert each partial sum into a different task identifier
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.300 records per worker ✅
B.400 records per worker
C.200 records per worker
D.600 records per worker
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The total is 1,200 records, so an even allocation gives 1200/4=3001200/4=300 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?

A.Throughput decreases whenever a worker is added
B.Throughput increases initially and then reaches a plateau after four workers ✅
C.Throughput grows linearly with every added worker
D.The workload cannot use data parallelism because throughput stops increasing
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.The fifth worker doubles the available data
B.The work has become task parallelism automatically
C.The fifth worker reduces completion time by another 24 milliseconds
D.The fifth worker provides no measured reduction in elapsed time ✅
💡 Difficulty: hard | ✅ Correct: D

📖 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?

A.The assignments are balanced because four workers receive data
B.The first worker must finish first because it has the largest partition
C.The distribution is highly imbalanced, so other workers may become idle before worker one finishes ✅
D.The chart proves that the application uses task parallelism rather than data parallelism
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.Data parallelism can only run on exactly two cores
B.Core count does not reveal whether workers repeat one operation on separate data or perform different tasks ✅
C.Eight cores always imply task parallelism
D.The number of cores determines which dataset is shared
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.Four processors always indicate data parallelism
B.A program cannot combine multiple forms of parallelism
C.Task parallelism is possible only when tasks access different files
D.If all four processors apply the same operation to separate data blocks, the design is data parallelism ✅
💡 Difficulty: hard | ✅ Correct: D

📖 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?

A.Task parallelism requires every worker to use an identical operation
B.Task parallelism cannot use shared memory
C.Different tasks may operate on the same data or on different data ✅
D.Workers performing different operations must execute sequentially
💡 Difficulty: hard | ✅ Correct: C

📖 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?

A.A worker applies the same filter to each independent block
B.Four workers each sum a separate portion using the same addition operation
C.Several workers apply one validation rule to different customer batches
D.Separate workers perform detection, classification, and compression on information from one large dataset ✅
💡 Difficulty: medium | ✅ Correct: D

📖 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?

A.Data parallelism requires the same operation across the partitions; differing algorithms introduce task-level distinctions ✅
B.Data parallelism requires every partition to contain identical values
C.Task parallelism requires one worker to process the complete dataset
D.Different algorithms cannot execute on different cores
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.Shared data automatically changes the work into data parallelism
B.Identical request handlers guarantee linear speedup
C.Contention and synchronization delays can outweigh the benefit of concurrent workers ✅
D.Task parallelism cannot be used in a server
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.The dependency can require an ordering between updates, so workers may use values that are not ready ✅
B.Data parallelism cannot be applied to integer arrays
C.Different workers must always use different algorithms
D.Adjacent elements are automatically stored in separate address spaces
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.Only data parallelism exists because pixels are processed in blocks
B.The application combines task parallelism across activities with data parallelism inside filtering ✅
C.Only task parallelism exists because the application has three activities
D.Neither type applies because the activities use one image file
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Only the number of processor cores
B.Only the programming language used by the application
C.Only the total size of the input dataset
D.The independence, dependencies, workload balance, computation cost, and coordination required by each design ✅
💡 Difficulty: hard | ✅ Correct: D

📖 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?

A.The three tasks are data parallel because they handle one request
B.The database task must run before authentication to avoid waiting
C.The functions expose task parallelism, but the authentication dependency constrains when the query can start ✅
D.Task parallelism requires all workers to start and finish at exactly the same time
💡 Difficulty: easy | ✅ Correct: C

📖 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?

A.600 ms
B.700 ms ✅
C.2,400 ms
D.2,500 ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Each worker processes 2400/4=6002400/4=600 records, requiring 600 ms. The workers run concurrently, then the final merge adds 100 ms, giving 600+100=700600+100=700 ms total under the stated assumptions.

🔗 Related Topics (MCQs)