程序代写代做代考 concurrency number of processes

number of processes
time (seconds)
1
1.8981
2
1.0885
4
0.6550
8
0.6405
16
0.6242
32
0.6200
64
0.7199
128
0.8977
256
0.9352
400
2.0054
Before experiment, I expect that with more than 1 process, the program will run faster. Because with multiple CPUs, different process can run concurrently to reduce time. Even with single CPU, one process can run on cpu while another process doing the IO, thus also can achieve some degree of concurrency.
From above result table, we can see that the expectation is correct, the program does run faster with multiple processes except the last one. And we can see that the speedup increase from 1 to 32 processes, and then the speedup decreases with the number of processes. The reason for this is that creating process is expensive and cost time, if we create too many processes, the cost for creating processes may be more than the time.
I also note that the speedup is huge when change from single process to 2 processes and from 2 processes to 4 processes, and the speedup is almost the same when increase from 4 to 32. I think the reason for this is that the computer which I test on has 4 CPUs.