I am doing a real-time project. Under windows and linux(program is not necessary portable, we could turn in two versions)
I need to measure the context switch time between two threads.
I remember there is a systemcall like "sleep", which could put a thread to sleep then another one will own the cpu.(if you know about the "sleep" like syscall pliz tell me the name)but I don;t know how to discriminate the other thread from the main process.
how can I know which one will take the CPU after the first thread sleeps.
Can I just create one thread and put it to sleep, then I will know for sure that the main process will own CPU. But is the result still the context switch time?
Thanks, and sorry for my bad english. Hope you can understand me.