Question: 1) Download the following source code: http://faculty.wiu.edu/H-Bui/teaching/2016Spring/cs410/c_code/hw1/fork_hw1.c http://faculty.wiu.edu/H-Bui/teaching/2016Spring/cs410/c_code/hw1/thread_hw1.c Compile: gcc -Wall fork_hw1.c -o fork_hw1 gcc -Wall -pthread thread_hw1.c -o thread_hw1 These programs will create 1,000

1) Download the following source code:

http://faculty.wiu.edu/H-Bui/teaching/2016Spring/cs410/c_code/hw1/fork_hw1.c http://faculty.wiu.edu/H-Bui/teaching/2016Spring/cs410/c_code/hw1/thread_hw1.c Compile: gcc -Wall fork_hw1.c -o fork_hw1 gcc -Wall -pthread thread_hw1.c -o thread_hw1

These programs will create 1,000 process and 1,000 threads respectively. You will need to modify the source files to create 10,000 processes and 10,000 threads.

Use time command to measure the time for each program:

/usr/bin/time p ./fork_hw1 /usr/bin/time p ./thread_hw1

time command will execute the program and provide you with real time (wall clock time), user time (CPU time spent performing some action for the program), sys time (CPU time spent performing some system calls for the kernel on the program's behalf)

1,000 processes

1,000 threads

10,000 processes

10,000 threads

real

user

sys

Discuss why the user time for all cases is much lower than sys time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!