How do RTOS kernel keep track of time ?
Every kernel provides a mechanism to keep track of time. This is done by a hardware timer which interrupts the CPU periodically.
The ISR for this timer invokes a service provided by the kernel, which is responsible to update time dependent variables. This ISR is generally called a Clock Tick ISR. Kernel maintains a special list to keep track of tasks that are waiting for the time to expire. This is called delayed task list.
Q: What is a RealTime System ?
A: A Real-time system is defined as a system where the response time for an event is predictable and deterministic with minimal latency.
Q: How is RTOS different from a general operating system?
A:
TaskScheduling:
RTOS generally have priority-based preemptive scheduling, which allows high-priority threads to meet their deadlines consistently. Whereas In a GPOS, the scheduler typically uses a "fairness" policy to dispatch threads and processes onto the CPU. Such a policy enables the high overall throughput required by desktop and server applications, but offers no assurances that high-priority, time-critical threads will execute in preference to lower-priority threads.
Preemetive Kernel:
In RTOS, kernel operations are preemptible. And so the RTOS kernel must be simple and elegant as possible.
Mechanisms to Avoid Priority Inversion:
This occurs when a lower-priority thread can inadvertently prevent a higher-priority thread from accessing the CPU. VxWorks specifically has protection for this.
Q: What is a task in VxWorks?