Skip to main content

RTOS Real time operating system interview questions

RTOS Real time operating system interview questions 



RTOS
1.What is a Real-Time System?
Ans:Real time system means is system which is having time critical application . System should accept and complete the task without buffer .
RTOS

Definition 1:
A real-time system is one that must process information and produce a response within a specified time, else risk severe consequences, including failure. That is, in a system with a real-time constraint it is no good to have the correct action or the correct answer after a certain deadline: it is either by the deadline or it is useless!
Definition 2 (modified from The Oxford Dictionary of Computing):
Any system in which the time at which output is produced is significant. This is usually because the input corresponds to some event in the physical world, and the output has to relate to that same event. The lag from input time to output time must be sufficiently small for acceptable timeliness
Definition 3 (Young 1982):
Any information processing activity or system which has to respond to externally generated input stimuli within a finite and specified period.
Examples:
ABS, aircraft control, ticket reservation system at airport, over-temperature monitor in nuclear power station, mobile phone, oven temperature controller, Doppler blood-flow monitor, ECG/arrhythmia monitor
2.Does the RTOS give you a flexible set of scheduling policies?
Ans:Yes Scheduler flexibility enables a wider
3.Does the RTOS use the dynamic object’s address as its identifier?
Ans:yes
4.Are interrupts handled with a macro/function or do you have to write your own prologue (entry) and epilogue (exit)?

5. How does the RTOS synchronize with events? Do your event synchronization objects automatically clear with a task release or can events be missed? Can multiple tasks wait on a single event? Can a single task wait on multiple events?
6. Does the RTOS allow you to count both periodic or aperiodic ticks?
7. Can the RTOS count ticks other than time?
8. Are Timers/Alarms globally available so that they can be used by multiple tasks or are they tied to a single task? Does the RTOS allow you to define future actions to be taken when any counter reaches a predefined value?
9. Does the RTOS manage RAM with a heap that can create non-deterministic response and fragmentation?
10.Does the RTOS provide multiple data passing options?
11. Does the RTOS allow data to be passed between tasks and ISRs (or just between tasks)?
12. How does the RTOS provide exclusive access to resources? Does it use binary semaphores or mutexes?
13. Does the RTOS have a mechanism to prevent priority inversion—when a low priority task has control of a resource that is required by a higher priority task?
14. How the RTOS is coded. Is it designed for deterministic operation? Does it ensure low system overhead? Low latency? Responsive services?
15. Write a code to connect Hardware interrupt to ISR?
16. What is priority inversion ? and What is the solution ?
17. Explain Priority Inheritance
18. Explain various types of Scheduling
19. Which RTOS supports Non-Preemptive scheduling ? Why other scheduling methods are supported by such OSes?
20. RTOS vs OS21. what is a non re-entrant code?
22. Is unix a multitasking or multiprocessing operating system? whats the difference between the two?
23. What is stack overflow and heap overflow?
24. What is a core dump?
25. Windows also has multiple processes has process priotities switches between multiple process, how RTOS is different from that?
26. what is paging, segmentation Why do we need it?
27. write a code to check wther a stack grows upwards or downwards?
28. Why do we require semaphore mutex?
  1. write a small piece of code protecting a shared memory variable with a semaphore?

  1. What is priority inversion ?
Ans: In scheduling, priority inversion is the scenario where al low priority task holds a shared resource that is required by a high priority task. This causes the execution of the high priority task to be blocked until the low priority task has released the resource, effectively "inverting" the relative priorities of the two tasks. If some other medium priority task, one that does not depend on the shared resource, attempts to run in the interim, it will take precedence over both the low priority task and the high
priority task.
The solution to this is "Priority Inheritance" and "Priority
Ceiling".
Priority inheritance. Increase low priority threads priority to the level of high priority thread's for the duration low priority thread requires to get executed and release the resource


  1. What are the solutions for priority inversion ?
Ans: The solution to this is "Priority Inheritance" and "Priority Ceiling".
Priority inheritance. Increase low priority threads priority to the level of high priority thread's for the duration low priority thread requires to get executed and release the resource

  1. What is priority inheritance ?
Ans:Priority inheritance. Increase low priority threads priority to the level of high priority thread's for the duration low priority thread requires to get executed and release the resource

  1. What is priority ceiling ?
Ans:
  1. What is deadlock ?
Deadlock is a situation in which the processes waits for the other resource which is occupied by another process in a loop for example take processes P1 and P2 and resources R1 and R2 in the deadlock condition

P1 -R1 waits for R2
P2 -R2 waits for R1 so
both processes waits for the other resource to get free for
their complete operation.
This is not the only case for occurence of deadlock..for a dead lock to occur there are 3 necessary conditions and 1 sufficient condition..so totally 4..the 3 necessary conditions are..
1)Mutual Exclusion
2)Non-Preemption
3)Hold and wait
and the sufficient condition for deadlock to occur is Circular wait.so to occur a deadlock all 4 conditions must be happened at a time..either of the case is not present..deadlock will not occur..
In such cases - One can avoid deadlocks by following methods
1) Prevention
2) Detection
3) Avoidance
4) Recovery


36. What is the famous diners problem ?
37. What is mutex ?
38. What is spinlock ?
39. Where are spinlocks used ?
40. What do you mean by atomic operations ?
41. what is a semaphore ?
42. What are the types of semaphore ?
43. What is binary semaphore ?
44. What is a counting semaphore ?
45. What is message queue ?
46. What is the role of a scheduler ? How does it function ?
47. What is the difference between a normal OS and RTOS ?
48. What is preemption ?
49. What is preemptive multi-tasking/time-sharing ? What is its difference with co-operative multi-tasking/time-sharing ?
50. Threads are described as lightweight because switching between threads does not involve changing the memory context – True/False ?
51.What are the factors considered for a RTOS selection ?
52. What is the use of the method of temporarily masking / disabling interrupts ? When is it used ? What should be taken care while doing this method ?
53. Since, disabling/masking of interrupts can be done whent the critical section is ONLY SHORT,What method can be used if the critical section is longer than few source lines or if it involves few lengthy loopings ?
54. Difference between semaphores and disabling/masking of interrupts method ?
55. Binary semaphore is equivalent to Mutex – True/False. How ?
56. How can you avoid deadlocks incase of semaphore based designs ?
57. What is Message passing method ? What is its advantages ?
58. Tell about the design of Interrupt Handler and Scheduler in RTOS ?
59. What is interrupt latency ?
60. Even if we never enables interrupts in the code, the processor automatically disables them often during hardware access – True/False ? In this case how to reduce interrupt latency ?
71. When should we re-enable the interrupts in an ISR and why ?
72. How do you measure the latency of your system ?
73. What are First Level Interrupt handlers and Second level Interrupt handlers ?
74. What could be the typical design/implementation of FLIH and SLIH ?
75. Reentrant interrupt handlers might cause a stack overflow from multiple preemptions by the same interrupt vector – True / False ?
76. What kind of memory allocation procedure is good for embedded systems ?
77. Is there any RTOS that has non-preemptive scheduling ?
78. What is reentrant code ?
79. What is preemptive multitasking ?
80. What does timeslice refer to ?
81. If the time slice is too short then the scheduler will consume too much of processing time – True / False
82. What is I/O bound ? What is CPU bound ?
83. What is non-preemptive multitasking ?
84. CFS uses ‘nanosecond’ granularity accounting, the atomic units by which individual process share the CPU instead of previous notion of ‘timeslice’ – True/False .
85. When will you use binary semaphore ?
86. When will you choose busy-wait instead of context switch ?
87. What are the possible scenarios in which context switching of threads can occur ?
88. Can you use mutex/semaphore inside an ISR ?
89. Explain a scenari that could cause deadlock ? What is the best solution for a deadlock ?
90. Will the performance of your application improve if it has only a single thread and it is running on multiple cores of a processor ?
91. What will happen if there are more threads requesting for CPU resource such as time ?
92. What is Gang Scheduling and how is it useful ?
93. Can you sleep in interrupt handler ?
94. What is the main drawback for not considering Linux as realtime / RTOS ?
95. What is the drawback in using semaphore for synchronization ? How does spinlock help in overcoming it ?
96. What does a semaphore consist of ? and What does a spinlock consist of ?
97. Why spinlocks are useless in uniprocessor systems ?
98. What is timeslice ?
99. What is the difference between multiprogramming and multiprocessing ?
100. What is parallel programming ?
101. What are the types of IPC mechanisms ?
102. What are the types of synchronization problems and what are the resources that can cause such problems ?
103. What is data race ?
104. What is Indefinite Postponement / Indefinite blocking or starvation ?
105. What are the synchronization relationships that are present in a multithreaded or mulitprogramming applications ?
106. How Many Processes or Threads Are Enough for an application ?
107. Tell the advantages and disadvantages of Co-operative multitasking.
108. When should we use mutex and when should we use semaphore ?

/>

Comments

Popular posts from this blog

CAN INTERVIEW QUESTIONS

Qualifiers and Modifier in C

CAN INTERVIEW QUESTIONS 2

What is UDS protocol

Memory mapping in c

TOP IOT PLATFORMS