Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program #1 #include #include int main(int argc, char *argv[]) { unsigned int i,j; while(1) { j = 1; for (i = 1; i { j

image text in transcribed

Program #1

#include

#include int main(int argc, char *argv[])

{

unsigned int i,j;

while(1)

{

j = 1;

for (i = 1; i

{

j = j*i;

}

}

} Program 2 #include

#include int main(int argc, char *argv[])

{

unsigned int i;

int count = 0;

struct timeval tv;

while(1)

{

for(i = 0; i

{

gettimeofday(&tv, NULL);

printf("%lu sec, %lu usec ", tv.tv_sec, tv.tv_usec);

}

count++;

printf("round %d complete ", count);

}

}

Write a CPU bound C program (Program 1) and an I/O bound C program (program2 using printf statements within the while(1) loop) and compile both of them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions