Kernel RTOS Development Interview Questions and Answers
Last updated on 05th Oct 2020, Blog, Interview Question
Waiting for an opportunity to change your career? Trying to surpass your limits and to grow in your career? ACTE got the right offer for to build an excellent career. Embedded system is a combination of computer software and hardware that is designed to perform a specific function within a larger system/device.
1. Explain What Is Embedded System In A Computer System?
An embedded system is a computer system that is part of a larger system or machine. It is a system with a dedicated function within a larger electrical or mechanical system.
2. Mention What Are The Essential Components Of Embedded System?
Essential components of embedded system includes
- I/O circuits
- System application specific circuits
- It ensures the availability of System Memory
- It checks the Processor Speed availability
- The need to limit power lost when running the system continuously
- Real Time Operating System
- It runs a process as per scheduling and do the switching from one process to another
3. Why Embedded System Is Useful?
With embedded system, it is possible to replace dozens or even more of hardware logic gates, input buffers, timing circuits, output drivers, etc. with a relatively cheap microprocessor.
4. Explain What Are Real-time Embedded Systems?
Real-time embedded systems are computer systems that monitor, respond or control an external environment. This environment is connected to the computer system through actuators, sensors, and other input-output interfaces.
5. Explain What Is Microcontroller?
The microcontroller is a self-contained system with peripherals, memory and a processor that can be used as embedded system.
6. Mention What Is The Difference Between Microprocessor And Microcontroller?
Microprocessor is managers of the resources (I/O, memory) which lie outside of its architecture Microcontroller have I/O, memory, etc. built into it and specifically designed for control.
7. What Does Dma Address Will Deal With?
DMA address deals with physical addresses. It is a device which directly drives the data and address bus during data transfer. So, it is purely physical address.
8. Explain What Is Interrupt Latency? How Can You Reduce It?
Interrupt latency is a time taken to return from the interrupt service routine post handling a specific interrupt. By writing minor ISR routines, interrupt latency can be reduced.
9. Mention What Are Buses Used For Communication In Embedded System?
For embedded system, the buses used for communication includes
- I2C: It is used for communication between multiple ICs
- CAN: It is used in automobiles with centrally controlled network
- USB: It is used for communication between CPU and devices like mouse, etc.
- While ISA, EISA, PCI are standard buses for parallel communication used in PCs, computer network devices, etc.
10. List Out Various Uses Of Timers In Embedded System?
Timers in embedded system are used in multiple ways
- Real Time Clock (RTC) for the system
- Initiating an event after a preset time delay
- Initiating an even after a comparison of preset times
- Capturing the count value in timer on an event
- Between two events finding the time interval
- Time slicing for various tasks
- Time division multiplexing
- Scheduling of various tasks in RTOS
Subscribe For Free Demo[contact-form-7 404 "Not Found"]
11. Explain What Is A Watchdog Timer?
A watchdog timer is an electronic device or electronic card that execute specific operation after certain time period if something goes wrong with an electronic system.
12. Locality of reference:It deals with a process accessing a resource multiple times. There are three type of localities namely ?
Temporal A resource is referenced at point in time and will be referenced again in near future. spatial The concept that the likelihood of referencing a resource is higher if a resource near it has been referenced.
sequential The concept of accessing the memory sequentially.
13. List Out Some Of The Commonly Found Errors In Embedded Systems?
Some of the commonly found errors in embedded systems are
- Damage of memory devices static discharges and transient current
- Address line malfunctioning due to a short in circuit
- Data lines malfunctioning
- Due to garbage or errors some memory locations being inaccessible in storage
- Inappropriate insertion of memory devices into the memory slots
- Wrong control signals
14. Explain What Is Semaphore?
- A semaphore is an abstract datatype or variable that is used for controlling access, by multiple processes to a common resource in a concurrent system such as multiprogramming operating system. Semaphores are commonly used for two purposes
- To share a common memory space
- To share access to files
15. When One Must Use Recursion Function? Mention What Happens When Recursion Functions Are Declared Inline?
Recursion function can be used when you are aware of the number of recursive calls is not excessive. Inline functions property says whenever it will called, it will copy the complete definition of that function. Recursive function declared as inline creates the burden on the compilers execution.
16. Explain Whether We Can Use Semaphore Or Mutex Or Spinlock In Interrupt Context In Linux Kernel?
Semaphore or Mutex cannot be used for interrupt context in Linux Kernel. While spinlocks can be used for locking in interrupt context.
17. What Is The Need For An Infinite Loop In Embedded Systems?
Infinite Loops are those program constructs where in there is no break statement so as to get out of the loop, it just keeps looping over the statements within the block defined.
While(Boolean True) OR for(;;);
Embedded systems need infinite loops for repeatedly processing/monitoring the state of the program. One example could be the case of a program state continuously being checked for any exceptional errors that might just occur during run time such as memory outage or divide by zero etc.,
18. A Vast Majority Of High Performance Embedded Systems Today Use Risc Architecture Why?
- According to the instruction sets used, computers are normally classified into RISC and CISC. RISC stands for ‘Reduced Instruction Set Computing’ . The design philosophy of RISC architecture is such that only one instruction is performed on each machine cycle thus taking very less time and speeding up when compared to their CISC counterparts.
- Here the use of registers is optimised as most of the memory access operations are limited to store and load operations.
- Fewer and simple addressing modes, and simple instruction formats leads to greater efficiency, optimisation of compilers, re-organisation of code for better throughput in terms of space and time complexities. All these features make it the choice of architecture in majority of the Embedded systems.
- CISC again have their own advantages and they are preferred whenever the performance and compiler simplification are the issues to be taken care of.
19. Why Do We Need Virtual Device Drivers When We Have Physical Device Drivers?
- Device drivers are basically a set of modules/routines so as to handle a device for which a direct way of communication is not possible through the user’s application program and these can be thought of as an interface thus keeping the system small providing for minimalistic of additions of code, if any.
- Physical device drivers can’t perform all the logical operations needed in a system in cases like IPC, Signals and so on…
- The main reason for having virtual device drivers is to mimic the behaviour of certain hardware devices without it actually being present and these could be attributed to the high cost of the devices or the unavailability of such devices.
- These basically create an illusion for the users as if they are using the actual hardware and enable them to carryout their simulation results.
- Examples could be the use of virtual drivers in case of Network simulators,also the support of virtual device drivers in case a user runs an additional OS in a virtual box kind of a software.
20. What Is The Need For Dmac In Es?.
- Direct memory access is mainly used to overcome the disadvantages of interrupt and progam controlled I/O.
- DMA modules usually take the control over from the processor and perform the memory operations and this is mainly because to counteract the mismatch in the processing speeds of I/O units and the procesor. This is comparatively faster.
- It is an important part of any embedded systems,and the reason for their use is that they can be used for bursty data transfers instead of single byte approaches.
- It has to wait for the systems resources such as the system bus in case it is already in control of it
21. What Is Endianness Of A System And How Do Different Systems Communicate With Each Other?
- Endianness basically refers to the ordering of the bytes within words or larger bytes of data treated as a single entity.
- When we consider a several bytes of data say for instance 4 bytes of data,XYZQ the lower byte if stored in a Higher address and others in successively decreasing addresses, then it refers to the Big Endian and the vice versa of this refers to Little Endian architecture.
- Intel 80×86 usually follows Little Endian and others like IBM systems follow Big Endian formats.
- If the data is being transmitted care has to be taken so as to know as to which byte,whether the higher or the lower byte is being transmitted.
- Hence a common format prior to communication has to be agreed upon to avoid wrong interpretation/calculations.
- Usually layer modules are written so as to automate these conversion in Operating systems.
22. How Are Macros Different From Inline Functions?
- Macros are normally used whenever a set of instructions/tasks have to be repeatedly performed. They are small programs to carryout some predefined actions.
- We normally use the #define directive in case we need to define the values of some constants so in case a change is needed only the value can be changed and is reflected throughout.
- #define mul(a,b) (a*b)
- The major disadvantage of macros is that they are not really functions and the usual error checking and stepping through of the code does not occur.
- Inline functions are expanded whenever it is invoked rather than the control going to the place where the function is defined and avoids all the activities such as saving the return address when a jump is performed. Saves time in case of short codes.
- inline float add(float a,float b)
- return a+b;
- Inline is just a request to the compiler and it is upto to the compiler whether to substitute the code at the place of invocation or perform a jump based on its performance algorithms.
Get Ramped Quickly on Kernel RTOS Training from Industry Experts
- Instructor-led Sessions
- Real-life Case Studies
23. What Could Be The Reasons For A System To Have Gone Blank And How Would You Debug It?
Possible reasons could be:
- PC being overheated.
- Dust having being accumulated all around.
- CPU fans not working properly .
- Faulty power connections.
- Faulty circuit board from where the power is being drawn.
- Support Drivers not having being installed.
- Debugging steps which can be taken are:
- Cleaning the system thoroughly and maintaining it in a dust-free environment. Environment that is cool enough and facilitates for easy passage of air should be ideal enough.
- By locating the appropriate support drivers for the system in consideration and having them installed.
24. Explain Interrupt Latency And How Can We Decrease It?
- Interrupt latency basically refers to the time span an interrupt is generated and it being serviced by an appropriate routine defined, usually the interrupt handler.
- External signals, some condition in the program or by the occurrence of some event, these could be the reasons for generation of an interrupt.
- Interrupts can also be masked so as to ignore them even if an event occurs for which a routine has to be executed.
Following steps could be followed to reduce the latency
- ISRs being simple and short.
- Interrupts being serviced immediately
- Avoiding those instructions that increase the latency period.
- Also by prioritizing interrupts over threads.
- Avoiding use of inappropriate APIs.
25. How To Create A Child Process In Linux?
Prototype of the function used to create a child process is pid_t fork(void);
- Fork is the system call that is used to create a child process. It takes no arguments and returns a value of type pid_t.
- If the function succeeds it returns the pid of the child process created to its parent and child receives a zero value indicating its successful creation.
- On failure, a -1 will be returned in the parent’s context, no child process will be created, and errno will be set.
- The child process normally performs all its operations in its parents context but each process independently of one nother and also inherits some of the important attributes from it such as UID, current directory, root directory and so on.
- Significance of watchdog timer in Embedded Systems.
- Watchdog timer is basically a timing device that is set for predefined time interval and some event should occur during that time interval else the device generates a time out signal.
- One application where it is most widely used is when the mobile phone hangs and no activity takes place, in those cases watchdog timer performs a restart of the system and comes to the rescue of the users.
- It is used to reset to the original state whenever some inappropriate events take place such as too many commands being given at the same time or other activities that result in malfunctioning of the GUI. It is usually operated by counter devices.
26. If You Buy Some Rtos, What Are The Features You Look For In?
- Deterministic operating system having guaranteed worst-case interrupt latency and context-switch times.
- Documentation providing for the minimum, average, and maximum number of clock cycles required by each system call.
- Interrupt response times should be very minute.
- Context switch time should be very low.
- Compatibility with several plugin devices.
- Overall it should be very reliable.
27. Why Is Java Mostly Used In Embedded Systems?
- Java was mainly designed and conceptualised for code that can work on different platforms without any hassles and also for being secure enough so as to not harm or corrupt other modules of code.
- Features like exception handling, simple syntax and Automatic Garbage collection all work in its favour as the language for use in ES’s.
- Also that it is widely used in the form of Java applets makes it very popular confining it to the limits of JVM. It is Dynamic in nature.
- Its use is also being exploited in enterprise systems in the form of J2EE, J2SE, J2ME in case of mobile applications.
28. What Are The Commonly Found Errors In Embedded Systems?
- Damage of memory devices due to transient current and static discharges.
- Malfunctioning of address lines due to a short in the circuit.
- Malfunctioning of Data lines.
- Some memory locations being inaccessible in storage due to garbage or errors.
- Improper insertion of Memory devices into the memory slots.
- Faulty control signals.
29. What Is The Need For Having Multibyte Data Input And Output Buffers In Case Of Device Ports?
- It’s normally the case that some devices transfer the output either in a bursty or a sequential manner and also during input entry. If we take the example of keyboards, all the data entered is stored in a buffer and given at a time or one character at a time.
- In case of networking there may be several requests to access the same resource and all these are queued in a buffer and serviced in the order they are received. Hence to avoid the input/output units from getting overloaded with requests, we use multibyte buffers.
30. What Is The Difference Between Hardware Design And Software Design?
- Hardware design is designed with the collaboration of interconnected parallel components that inherits the properties of each other. Whereas, Software design is designed with sequential components, that are based on objects and threads.
- Hardware design structure doesn’t change dynamically and it can’t be created, modified or removed easily. Whereas, Software design structure can be changed dynamically and re-usability features, used to define the components. It also includes easy creation, modification and removal of the components from the software.
- Hardware design focuses on individual components that are represented using analytical model that uses the transfer functions. Whereas, Software design represent the components using computation model that can have abstract execution engine or it can use the virtual machine that are non-deterministic.
31. what is a non reentrant code?
Re entrant code is code which does not rely on being executed without interruption before completion. Reentrant code can be used by multiple, simultaneous tasks. Reentrant code generally does not access global data. Variables within a reentrant function are allocated on the stack, so each instance of the function has its own private data. Nonreentrant code, to be used safely by multiple processes, should have access controlled via some synchronization method such as a semaphore.
32. how is RTOS different from other OS?
A RTOS offers services that allow tasks to be performed within predictable timing constraints
33. Is unix a multitasking or multiprocessing operating system? whats the difference between the two?
unix is a multitasking operating system, multiprocessing means it can run on multiple processors, the multiproceesing os coordinates with multiple processors running in parallel.
34. what is a core dump?
A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally includes the program counter and stack pointer, memory management information, and other processor and operating system flags and information a fatal error usually triggers the core dump, often buffer overflows, where a programmer allocates too little memory for incoming or computed data, or access to null pointers, a common coding error when an unassigned memory reference variable is accessed
35. what is stack overflow and heap overflow?
stack overflow occurs when when the program tries to access memory that is outside the region reserved for the call stack
call stack contains the subroutines called, the local variables
overflow occurs when too many functions are called,huge amount of local variables are allocated
36. windows also has multiple processes has process priotities switches between multiple process, how RTOS is different from that?
RTOS has predictable timing constranints
37. how will u create a process in UNIX or our OS OSE?
We can use thr fork system call to create a process in UNIX and in OSE the system call create_process is used.
38. what is a flat memory model and a shared memory model?
In a flatmemory model the code and data segment occupies single address space.
in a shared model the large memory is divided into different segments and needs a qualifier to identify each segment
in a flat memory model the programmer doesnt need to switch for data and code
39. what is paging, segmentation y do we need it?
Paging is a techinque where in the OS makes available the data required as quickly as possible. It stores some pages from the aux device to main memory and when a prog needs a page that is not on the main memory it fetches it from aux memory and replaces it in main memory. It uses specialised algorithms to choose which page to replace from in main memory.
It deals with a concept where the data is temperorarily stored in a high speed memory for faster access. This data is duplicated in cache and the original data is stored in some aux memory. This concepts brings the average access time lower.
Segmentation is a memory management scheme. This is the technique used for memory protection. Any accesses outside premitted area would result in segmentation fault.
This technique enables noncontiguous memory to be accessed as if it were contiguous. Same as paging.
40. why do we require semaphore?
For process synchronization, it is a mechanism to invoke the sleeping process to become ready for execution. Its mechanism where a process can wait for resources to be available.typical example is producer consumer process. The producer process creates resources and signals the semaphore saying resource is available. Consumer process waiting on the semaphore gets the signal that resource is available.
41. what are the different types of semaphores and where they are used?
Binary semaphore and counting semaphore. Binary semaphore is same as mutex. Binary semaphore tries to protect only one resource.
Counting semaphore is used in case of multiple resource. For ex: we have 4 printers then the counting semaphore value will be init to 4. When it reaches 0, the task waiting on the semaphore is suspended.
42. what are the different inter process communications?
Semaphore, mutex, message passing, shared memory, socket connections
43. what is present in .bss ?
The bss section contains uninitialized data, and is allocated at runtime. Until it is written to, it remains zeroed
44. what are the different segments of a program (code, data,stack,heap etc) ?
Memory Segments: Code segment
This phrase used to refer to a portion of memory or of an object file that contains executable
computer instructions. It is generally readonly segment.
This is one of the sections of a program in an object file or in memory, which contains the global variables that are initialized by the programmer. It has a fixed size, since all of the data in this section is set by the programmer before the program is loaded. However, it is not readonly, since the values of the variables can be altered at runtime.
This segment of memory is part of data segment that contains uninitialized data (static variables). These are initialized to 0 and later assigned values during runtime.
This segment of memory is a special stack which stores information about the active subroutines of a task. It contains the return address to be branched to after a subroutine has finished execution. It contains local variables of the subroutines and the parameters that are passed to those sub routines.
The segment of memory which is used for dynamic memory allocation is known as heap. It is the responsibility of the programmer to deallocate it after its use. Or alternatively it will be garbage collected by the OS.
45. what is priority inversion?
In a scenario where a low priority task holds a shared resource (example semaphore) 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. This scenario is averted by the OS by increasing the priority of the lowproi process until it completes the task and releases the resources.
Are you looking training with Right Jobs?Contact Us
- IOT Tutorial
- Linux Tutorial
- Linux Kernel Tutorial
- NetApp Tutorial
- Linux Programming For Beginner’s
- What is Dimension Reduction? | Know the techniques
- Difference between Data Lake vs Data Warehouse: A Complete Guide For Beginners with Best Practices
- What is Dimension Reduction? | Know the techniques
- What does the Yield keyword do and How to use Yield in python ? [ OverView ]
- Agile Sprint Planning | Everything You Need to Know