Measure the cost of a process switching. A possible measurement strategy is provided below as a hint:

1. Measure the cost of a process switching. A possible measurement strategy is provided below as a hint:Your test program starts with a main process which then creates two pipes with a read file descriptor and a write file descriptor in each pipe.The main process spawns a child process. Then one of the pipes is used for communication from the main process to the child process. The other pipe is used for communication in the reverse direction.The main process starts with sending the child process a single-byte message and then trying to read back from the child process. The child process starts with trying to read something from the main process and then writing a singe-byte message back. Note that process switches are forced when the main process and the child process alternate executions. This process should be repeated many times to get accurate measurement.2. Measure the cost of a thread switching. A possible measurement strategy is provided below as a hint:Two threads alternate using a shared integer num (set to be 0 initially), a mutex lock and two condition variables. Thread #1 keeps waiting for num to become 1 and then changing it to 0. Thread #1 keeps waiting for num to become 0 and changing it to 1.Additional note: You should be careful with your measurement methodology. If appropriate, you may want to take into account things like loop overhead and timer overhead (making calls to start and stop the timer can induce costs that are non-negligible when measuring the cost of a single function call)[email protected]@@@@@@@@@@@Above is the requirements, question is there are four types of get time : Realtime, Monotonic, CPU time ID, thread time iD.For both questions , which one of type is going to be used .

Leave a Reply