Question: a. Assume the buffer size is 500 bytes and the clock only runs on sleep() call, for the following piece of code, how many seconds

 a. Assume the buffer size is 500 bytes and the clock

a. Assume the buffer size is 500 bytes and the clock only runs on sleep() call, for the following piece of code, how many seconds will pass before you can see something on the screen? Please justify your answer. int main(int argc, char *argv[]) { while(1) { sleep(1); /* sleep one second */ printf("abcde"); } } b. If the printf() is changed to prinf("abcde "), how many seconds will pass before you can see something on the screen? If the result is different with (a), explain why. c. Following (a), if the following code is inserted before printf(), how many seconds will pass before you can see something on the screen? If the result is different with (a), explain why. setbuf(stdout, NULL)

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!