Difference between use of while() and sleep() to put program into sleep mode

后端 未结 2 945
一整个雨季
一整个雨季 2021-01-26 12:22

I have created a shared object and access it from two different program and measuring the time.

DATA array is the shared object between two processes.<

2条回答
  •  渐次进展
    2021-01-26 12:29

    I my opinion we can't predict the cache behavior as per your case.

    It also depends upon your H/W which, you have not mentioned (like how many CPU cores(physical or logical) are present).

    We can't say that program_2 will be scheduled on the same core and just after program_1 because it totally depends upon OS scheduler. So program_2 may use cache filled by program_1 or not.

    It's possible that the cache is flushed out due to some other program which was scheduled just after program_1.

提交回复
热议问题