National Taipei University of Technology 108-2 Homework-II for OS
06/01/20-電子系
1. Coding independent threads can speed up the running of programs. Let us conduct an ex- periment to experience the features and skill of multithreading. You need to code two differ- ent styles of programs to perform a “matrix multiplication” in the same programming lan- guage (e.g. C language), as follows.
In the first program, you just code it following the traditional for-looping skill.
In the second program, you need trying to code it by using the new multithreading skill.
Q1: Point out the major parts in the threaded program to highlight its differences with for-loops.
Q2: Record your experimental results at least 3 rounds execution in the below table, and state how you can count the running time of programs in ms.
Q3: State your discovering and comments on this exercise of coding threaded programs.
Name:
Coding Skill
Lines of Code
Execution Time (ms)
Average Ex- ecution Time
1-round
2-round
3-round
【A】 For-loops
【B】 Multithread
Differences
【B – A】
* Note that you need to take some pictures of the running screen on LCD, and appendix your two source codes in your report.
Due date: July 2, 2020.
C.-C. Tuan #2261
OS homework-2
CAB 3535 3560 6035
a 3.5i6.6j, b 6.68.8i3.5j ij ij