ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Does anyone know how to run 2 threads with round robin scheduling. & can we get the time of these threads when they are context switching. That means I want to know at how much time each thread is taking to run
Whether or not the scheduling is round-robin, ways of observing the time consumed by processes or threads do exist. (You need to tell us exactly what threading system you're using...)
Of course, even if scheduling is set up to be "round robin," you should not expect to see that "first this thread runs, then that thread runs." The scheduling discipline is, basically, a suggestion to the scheduler. Actual observed behavior depends upon the actual environment ... and, upon whether or not you are looking at it. (Yes, "the presence of the experimenter affects the experiment." If the little mice can see you, they'll stop doing what they're supposed to be doing and look back at you with a little mousey smile, hoping for another piece of cheese.)