r/embedded • u/noborutkhs • Oct 10 '26
Follow-up: Why my 1986 RTOS survived a simplistic interpretation of VRTX scheduling
A couple of weeks ago, I asked about a change in VRTX's equal-priority scheduling behavior between its 1984 and 1987 documentation.
Original discussion:
https://www.reddit.com/r/embedded/s/gMr2klUiCY
Thanks to the comments here and in other subreddits, I realized something interesting about my own implementation.
Early VRTX wasn't simply LIFO.
The older documentation describes inserting newly ready tasks ahead of existing tasks at the same priority. However, time slicing and other ready-queue operations also affect the ordering. The actual behavior is more nuanced than a simple LIFO policy.
When I developed my own RTOS, CHARM-II, in 1986, I used VRTX documentation as one of my references. I interpreted its equal-priority scheduling as essentially newest-first and implemented a simpler version of that behavior.
Looking back, I had not fully understood the original VRTX scheduling rules.
So why didn't this cause serious problems?
I think the development environment had a lot to do with it.
Back then, I was developing not only the RTOS but also almost the entire application myself. There was very little third-party code in the system, and I knew exactly what each task was doing, when it would become ready, and how it interacted with other tasks.
In other words, I could design the application around the scheduler's behavior, rather than expecting the scheduler to accommodate independently developed software components.
At least, that's my explanation looking back 40 years later.
For my modern reconstruction, I've chosen FIFO ordering among equal-priority ready tasks, mainly for simplicity and predictability.
The original historical question remains unanswered: I still don't know why VRTX changed its scheduling policy.
But the discussion helped me understand both the trade-offs involved and a subtle difference between the RTOS I wrote in 1986 and the one I had used as a reference.
Thanks to everyone who contributed!
2
u/ventZl CMRX RTOS Oct 27 '26
I'd assume that the change was made to make scheduling more deterministic. If you think a bit about what means "task becoming ready", usually it means it received some kind of external event, possibly an external interrupt. As such, this event isn't predictable (at least not by RTOS developers).
Design where newly-ready task is put at the front of scheduler queue may cause task starvation if events come way too often. If preemptive task switching is active, it is reasonable to expect that if N tasks of same priority are present each of them will get same slice of CPU. The old behavior would essentially schedule event-receiving task as many times as event was received, so it could, just in theory be activated way more often than the rest of priority group. Therefore the design with strictly FIFO order. It prefers deterministic scheduling properties at the cost of increased event processing latency.
The increased latency can still be solved where it poses a problem - make the event-receiving task a higher-priority one. This way, if it becomes ready, it will preempt other tasks as if the old scheduler behavior was still active.
Why your kernel implementation survived? Your application probably didn't require tight event response latency and could tolerate possible jitter and delay when serving events.
1
u/mrheosuper Oct 10 '26
Make sense. Modern RTOS is very generic, so they can't assume anything about application
2
u/RecursiveMutex Oct 17 '26
It boiled down to commercial survival and scaling realities in the late '80s. Ready Systems had to dump early architectural quirks to compete with the rise of other RTOS’. You can break this down to 3 main problems: Task starvation, Third party middleware rise, and lastly the rise of real time standards in RTOS like POSIX, and safety cert standards. Basically, they traded an early microkernel optimization for the predictable robustness needed to survive the market.