* [API] How many time to be context-switched? @ 2016-11-27 17:15 Ricardo Biehl 2016-11-27 18:01 ` Joel Fernandes 0 siblings, 1 reply; 3+ messages in thread From: Ricardo Biehl @ 2016-11-27 17:15 UTC (permalink / raw) To: kernelnewbies As a question I've made on Stackexchange <http://stackoverflow.com/questions/40579919/how-many-time-to-be-context-switched>: I'm developing a real-time program where scheduler's context-switches might interfere its performance. --- Suppose I need to do many consecutive (but optional) operations (I mean I'm able to cancel some of them) of the same type in every execution of a timer-oriented signal handler. Could I check how much time left until my thread get context-switched? [...] and then I can cancel/jump some operations for a better performance at all. If yes, how can I do it (in C code)? Huge thanks! -- Ricardo Biehl Pasquali ^ permalink raw reply [flat|nested] 3+ messages in thread
* [API] How many time to be context-switched? 2016-11-27 17:15 [API] How many time to be context-switched? Ricardo Biehl @ 2016-11-27 18:01 ` Joel Fernandes [not found] ` <CAAu8FsdJRDaFB4E0+s5zM=T-RicqOkm747ceGKizk5WBv4xn4Q@mail.gmail.com> 0 siblings, 1 reply; 3+ messages in thread From: Joel Fernandes @ 2016-11-27 18:01 UTC (permalink / raw) To: kernelnewbies On Nov 27, 2016 9:44 AM, "Ricardo Biehl" <rbpoficial@gmail.com> wrote: > > As a question I've made on Stackexchange > < http://stackoverflow.com/questions/40579919/how-many-time-to-be-context-switched >: > > I'm developing a real-time program where scheduler's context-switches > might interfere its performance. > --- > Suppose I need to do many consecutive (but optional) operations (I > mean I'm able to cancel some of them) of the same type in every > execution of a timer-oriented signal handler. > Could I check how much time left until my thread get context-switched? > [...] and then I can cancel/jump some operations for a better > performance at all. > > If yes, how can I do it (in C code)? > If you use SCHED_FIFO, then at the right RT priority level, you should not context switch anyway. Time quantas apply only to regular CFS tasks or when RT throttling is activated. Also note that interrupts and softirqs cause variability and interruptions no matter what you do or how you schedule. J. > Huge thanks! > > -- > Ricardo Biehl Pasquali > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161127/fecd70ed/attachment.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CAAu8FsdJRDaFB4E0+s5zM=T-RicqOkm747ceGKizk5WBv4xn4Q@mail.gmail.com>]
* [API] How many time to be context-switched? [not found] ` <CAAu8FsdJRDaFB4E0+s5zM=T-RicqOkm747ceGKizk5WBv4xn4Q@mail.gmail.com> @ 2016-11-27 19:43 ` Joel Fernandes 0 siblings, 0 replies; 3+ messages in thread From: Joel Fernandes @ 2016-11-27 19:43 UTC (permalink / raw) To: kernelnewbies Please reply always to kernelnewbies. On Nov 27, 2016 11:09 AM, "Ricardo Biehl" <rbpoficial@gmail.com> wrote: > > 2016-11-27 16:01 GMT-02:00, Joel Fernandes <agnel.joel@gmail.com>: > > On Nov 27, 2016 9:44 AM, "Ricardo Biehl" <rbpoficial@gmail.com> wrote: > >> > >> As a question I've made on Stackexchange > >> < > > http://stackoverflow.com/questions/40579919/how-many-time-to-be-context-switched > >>: > >> > >> I'm developing a real-time program where scheduler's context-switches > >> might interfere its performance. > >> --- > >> Suppose I need to do many consecutive (but optional) operations (I > >> mean I'm able to cancel some of them) of the same type in every > >> execution of a timer-oriented signal handler. > >> Could I check how much time left until my thread get context-switched? > >> [...] and then I can cancel/jump some operations for a better > >> performance at all. > >> > >> If yes, how can I do it (in C code)? > >> > > > > If you use SCHED_FIFO, then at the right RT priority level, you should not > > context switch anyway. Time quantas apply only to regular CFS tasks or when > > RT throttling is activated. > > > > Also note that interrupts and softirqs cause variability and interruptions > > no matter what you do or how you schedule. > > > > J. > > Thank you Joel! > > Another small question: Can I use pthread_cond_signal[broadcast]() (a > non async-signal-safe function) inside signal handler, given I know > pthread_cond_wait() hasn't been called at the same time? Should be, as per docs it wakes up *IF* any threads are blocked on cond. Thanks, Joel > > > >> Huge thanks! > >> > >> -- > >> Ricardo Biehl Pasquali > >> > >> _______________________________________________ > >> Kernelnewbies mailing list > >> Kernelnewbies at kernelnewbies.org > >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > -- > Ricardo Biehl Pasquali -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161127/217c00b4/attachment.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-27 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-27 17:15 [API] How many time to be context-switched? Ricardo Biehl
2016-11-27 18:01 ` Joel Fernandes
[not found] ` <CAAu8FsdJRDaFB4E0+s5zM=T-RicqOkm747ceGKizk5WBv4xn4Q@mail.gmail.com>
2016-11-27 19:43 ` Joel Fernandes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).