Re: Thread Scheduling question
This will help, Andy. Thanks for your inputs!
From: Ross, Andrew J <andrew.j.ross@...>
Sent: 11 May 2020 10:53
To: Gundi, Rajavardhan <rajavardhan.gundi@...>; devel@...
Subject: Re: [Zephyr-devel] Thread Scheduling question
Your understanding is correct. If a higher priority thread is available to run, then a preemptible thread will yield to that thread at every scheduling point.
I'm not quite sure what you are trying to mitigate, exactly. This is the desired behavior. You WANT your two custom threads to run instead of your main thread, that's why they're higher priority. I think you might want to revisit the priority design in your app, basically. The priorities you've assigned to your threads don't reflect what you want them to do.
If you just need the custom threads to get out of the way at startup, why not just have them sleep a bit, or (much better) block on a semaphore or whatever waiting for main to signal them to begin. Or you can change priorities at runtime -- have main start at a very high priority but then lower itself, for example. Or launch the threads dynamically via k_thread_create() at runtime once you know it's safe for them to run...
On 5/10/2020 9:24 PM, Raj Gundi wrote: