Answered step by step
Verified Expert Solution
Link Copied!

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 #include #include #include #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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions