Embedded C,RTOS interview questions with answers

1) What is RTOS and why do we go for it?
     RTOS sheludes execution in a timely manner,manages system resources and provides a consistent          foundation for developing application code.
     Application code designed for RTOS could be ranging from simple digital stopwatch to complex            aircraft navigation systems.

RTOS differs from the GPOS by
  Task scheduling : RTOS like vxWorks,neclueos, uC/OSII uses a strict scheduling algorithms (like pre-     emptive scheduling) that makes the tasks meet their deadline to get the job done.
  
The sheduler decides which task run when by knowing its priorities.Whereas In a GPOS, the scheduler typically uses a "fairness" policy that offers no assurances that high-priority, time-critical tasks will execute in preference to lower-priority tasks.This policy is maintained to obtain the overall output by the desktop pc or server pc.

2) What are the different types of semaphores in vxworks RTOS? Which is the fastest?
     VxWorks supports three types of semaphores.
     1) Binary 2) mutual exclusion, and 3)counting semaphores.
     Fastest : Binary semaphore.

 3. What is priority inversion ? why priority inversion occurs?
     Tasks in RTOS's communucates between them via IPC source semphores for synchornization.
     The situation priority inversion occurs when a higher priority taks is ready to run but it is waiting for       a shared resource that is to be released by a lower priority task currently running .Now higher-                 priority task is pending on the resource and it has to wait until the lower priority task to finish.

4. What are the solutions for priority inversion ?

    1) Priority inheritance
    2) Priority ceiling