Question: write a C program that measures the latencies of various system calls. In particular, you want to know 1) the cost of CPU mode switch

write a C program that measures the latencies of various system calls. In particular, you want to know 1) the cost of CPU mode switch by measuring a light-weight system call which does very little thing in the kernel, and 2) the cost of heavier system calls which triggers a lot of activities inside the kernel.

program should measure the latencies of three system calls: getpid(), open(), and read(). Getpid() represents lightweight call, and open()/read() represent heavy system calls. For highresolution latency measurements, you should use gettimeofday() system call

with gettimeofday(), you need to measure the execution time of repetition of system calls. You then divide the time taken with how many times to arrive the individual system call latency.

Measurements should take a few seconds for each of the system calls. After measurement, your program must print out the result to standard output

latency should be time elapsed divided by repetitions.

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!