Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 6.5 KB

File metadata and controls

73 lines (54 loc) · 6.5 KB

mpmt

Multi-process and multi-thread sample program

Compile

$ make all
clang -O2 ./multi_process/multi_process_sample.c -o multi_process_sample.out
clang -O2 ./multi_process/multi_process_benchmark.c -o multi_process_benchmark.out
clang -O2 ./multi_thread/multi_thread_sample.c -o multi_thread_sample.out
clang -O2 ./multi_thread/multi_thread_benchmark.c -o multi_thread_benchmark.out

Execute

Share memory

Multi-process

$ ./multi_process_sample.out
parent n[0x7ffee36e2954]=1
child  n[0x7ffee36e2954]=1
child  n[0x7ffee36e2954]=2
parent n[0x7ffee36e2954]=2

Multi-thread

$ ./multi_thread_sample.out
main n[0x7ffee483e964]=1
sub  n[0x7ffee483e964]=1
sub  n[0x7ffee483e964]=2
main n[0x7ffee483e964]=3

Benchmark

Multi-process

$ ./multi_process_benchmark.out
....................................................................................................
processing time : 19081[µs]

Multi-thread

$ ./multi_thread_benchmark.out
....................................................................................................
processing time : 8389[µs]

Limit

Multi-process

$ ./multi_process_challenge.out
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
generated processes : 1193

Multi-thread

$ ./multi_thread_challenge.out
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
generated threads : 4095