# Parallel Programming Homework 2
## Q1


The speed up is not linear! And strangely, The three-threads
case performs worse than the two-threads case! The reason might be that the workload of threads are uneven, since the total runtime depends on the runtime of the longest job.
## Q2
The following is the case with three threads.

The runtime is uneven as expected. The reason is that each pixel takes different time to render. It takes more iterations to produce a bright pixel than a dark pixel, which expain why the 1st thread takes the longest in the first view.

## Q3
To tackle such problem, we can randomize the permutation of rows, which should make the workload more uniform.

The final speedup for 4 threads is 3.74x.
## Q4
When running with 8-threads, the performance is actually slightly worse than running with 4 threads. This is likely because the server have only 4 cores, running with more than four threads will only cause more context switching, which will not benefit the performance.