Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using gettimeofday(), determine how long it takes to start a new process with fork(). Insure that you make at least one thousand measurements before declaring
Using gettimeofday(), determine how long it takes to start a new process with fork(). Insure that you make at least one thousand measurements before declaring the required time.
I have this so far but I am not sure if I am doing it right. Please correct mine or write one by yourself.
#include
int main() { struct timeval start, end; for(int i=0;i<1000;i++) // loop will run n times (n=1000) { gettimeofday(&start,0); fork(); gettimeofday(&end,0); printf("time: %lu ",end.tv_usec - start.tv_usec); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started