On Fri, Apr 7, 2017, at 11:53 AM, Jon Elson wrote: > On 04/07/2017 10:29 AM, Gene Heskett wrote: > > What I want, but don't know if I can get, is to have the > > servo thread running at the highest priority, fully > > capable of interrupting the jog-thread, but the jog-thread > > cannot interrupt the servo thread as its not that time > > critical. How best to do that, given the tools available? > > Thanks Peter and everybody. Cheers, Gene Heskett > Faster threads will, in theory, interrupt slower threads. > But, the way RTAPI threads are set up, at least with RTAI, > the slower threads will be forced to run at multiples of the > faster thread period. Therefore, I think, the slower threads > will actually never get interrupted. I think they will just > get tacked onto the end after the faster thread runs. >
Slower threads can get interrupted, if they take a long time to complete. Suppose you have a 1mS servo thread that takes 170uS to run. And a 10mS "jog thread" to use Gene's example, that takes 1300uS to run. starting at time 0, the servo thread will run it will finish at 170uS, then the jog thread will start at 1000uS, the servo thread will interrupt the jog thread, even though the jog thread has only run for 830uS and still has 470uS of work to do the servo thread will take its 170uS, and finish at 1170uS the jog thread will resume where it left off, and run for another 470uS, finishing its work at 1640uS non-realtime code will run from 1640uS to 2000uS at 2000uS, the servo thread will run for 170uS non-realtime code will run from 2170uS to 3000uS and so on, until 10000uS, when the process repeats If a slow thread has lots to do, it can and will be interrupted by faster threads. Thread priority in HAL is automatically set up with the fastest threads having the highest priority so they can interrupt slower threads. -- John Kasunich jmkasun...@fastmail.fm ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users