You are asked to design an image-processing component. An image is represented as a 2D array of pixels, and the processor must apply one or more filters, such as grayscale conversion, blur, or other convolution-style transforms, to produce a new image.
First, describe a straightforward single-processor implementation. Then explain how you would extend the design to run efficiently on multiple processors or threads. Discuss:
-
core data structures and interfaces
-
how work is partitioned
-
how to handle boundary pixels for neighborhood-based filters
-
how to avoid race conditions and incorrect shared-state updates
-
synchronization and scheduling choices
-
performance trade-offs, including memory locality and scalability
-
how you would test correctness and measure speedup