1. Explain me can we use printf inside ISR?

Printf function in ISR is not supported because printf function is not reentrant, thread safe and uses dynamic memory allocation which takes a lot of time and can affect the speed of an ISR up to a great extent.

2. Tell me 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.

3. Explain what is return type of ISR?

ISR does not return anything. An ISR returns nothing because there is no caller in the code to read the returned values.

4. Tell me what is interrupt latency?

Interrupt latency is the time required for an ISR responds to an interrupt.

5. Tell me 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.

6. Tell me what are the qualifiers in C?

Volatile- it is about instructing the compiler that a variable will change

Constant- it is about instructing the compiler that a variable will not change.

7. Tell me 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.

8. Tell me can we use any function inside ISR?

We can use function inside ISR as long as that function is not invoked from other portion of the code.

9. Tell me how many types of IPC mechanism you know?

Different types of IPC mechanism are -

☛ Pipes
☛ Named pipes or FIFO
☛ Semaphores
☛ Shared memory
☛ Message queue
☛ Socket

10. Tell me can you have constant volatile variables?

Yes, we can have constant volatile variables

11. Explain me what is kernel paging?

Paging is a memory management scheme by which computers can store and retrieve data from the secondary memory storage when needed in to primary memory. In this scheme, the operating system retrieves data from secondary storage in same-size blocks called pages. The paging scheme allows the physical address space of a process to be non continuous. Paging allows OS to use secondary storage for data that does not fit entirely into physical memory.

12. Explain 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

13. Suppose 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.

14. Tell me can a pointer be volatile?

If we see the declaration volatile int *p, it means that the pointer itself is not volatile and points to an integer that is volatile. This is to inform the compiler that pointer p is pointing to an integer and the value of that integer may change unexpectedly even if there is no code indicating so in the program.

15. Tell us what is the need for an infinite loop in embedded systems?

Embedded systems require infinite loops for repeatedly processing or monitoring the state of the program. For instance, the case of a program state continuously being verified for any exceptional errors that might just happen during run-time such as memory outage or divide by zero, etc.

16. Tell me why cannot arrays be passed by values to functions?

In C, the array name itself represents the address of the first element. So, even if we pass the array name as argument, it will be passed as reference and not its address.

17. Do you know what is priority inheritance?

Priority inheritance is a solution to the priority inversion problem. The process waiting for any resource which has a resource lock will have the maximum priority. This is priority inheritance. When one or more high priority jobs are blocked by a job, the original priority assignment is ignored and execution of critical section will be assigned to the job with the highest priority in this elevated scenario. The job returns to the original priority level soon after executing the critical section.

18. Tell me what is the function of simple thread poll in embedded system?

Simple thread poll allow the ready output to be passed for checking by giving it to the bus that is free and then the output is sent along the thread. The bus can send the output depending on the time that has been given and during the transfer the user won't be able to perform any other operation. The input is given after finding out the bus is free or not and if it free then a check is made to see that the input exists or not. This thread poll is easy to understand but it is not efficient method to allow the data to be put over the bus manually. The problem of not doing multi-tasking can occur due to doing one task at a time. The method is only be used when input/output occurs at interval that are infrequent.

19. Please explain can structures be passed to the functions by value?

Passing structure by its value to a function is possible, but not a good programming practice. First of all, if we pass the structure by value and the function changes some of those values, then the value change is not reflected in caller function. Also, if the structure is big, then passing the structure by value means copying the whole structure to the function argument stack which can slow the program by a significant amount.

20. Tell me what are the uses of the keyword volatile?

Volatile keyword is used to prevent compiler to optimize a variable which can change unexpectedly beyond compiler's comprehension. Suppose, we have a variable which may be changed from scope out of the program, say by a signal, we do not want the compiler to optimize it. Rather than optimizing that variable, we want the compiler to load the variable every time it is encountered. If we declare a variable volatile, compiler will not cache it in its register.

21. Tell me 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.

22. Explain what are the uses of the keyword static?

Static keyword can be used with variables as well as functions. A variable declared static will be of static storage class and within a function, it maintains its value between calls to that function. A variable declared as static within a file, scope of that variable will be within that file, but it can't be accessed by other files.

Functions declared static within a module can be accessed by other functions within that module. That is, the scope of the function is localized to the module within which it is declared.

23. Do you know what is virtual memory?

Virtual memory is a technique that allows processes to allocate memory in case of physical memory shortage using automatic storage allocation upon a request. The advantage of the virtual memory is that the program can have a larger memory than the physical memory. It allows large virtual memory to be provided when only a smaller physical memory is available. Virtual memory can be implemented using paging.
A paging system is quite similar to a paging system with swapping. When we want to execute a process, we swap it into memory. Here we use a lazy swapper called pager rather than swapping the entire process into memory. When a process is to be swapped in, the pager guesses which pages will be used based on some algorithm, before the process is swapped out again. Instead of swapping whole process, the pager brings only the necessary pages into memory. By that way, it avoids reading in unnecessary memory pages, decreasing the swap time and the amount of physical memory.

24. Tell me 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.

25. Tell me 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. Explain me what are the rules followed by Mutexes?

Mutex is also called as Mutual Exclusion is a mechanism that is used to show the preemptive environment and allow providing security methods like preventing an unauthorized access to the resources that are getting used in the system. There are several rules that has to be followed to ensure the security policies:

Mutex are directly managed by the system kernel that provides a secure environment to allow only the applications that passes the security rules and regulations. The mutex consists of objects that are allowed to be called by the kernel.

Mutex can have only one process at a time in its area that is owned by the process using it. This allows less conflict between the different applications or processes that wait for their turn to execute it in the kernel area.

Mutex can be allocated to another mutex that is running some task at a particular time and allow the kernel to have synchronization in between them.

If Mutex is allocated to some other process then the area will consist of the process till the area is having the process in it.

27. Tell me is Count Down_to_Zero Loop better than Count_Up_Loops?

Count down to zero loops are better. Reason behind this is that at loop termination, comparison to zero can be optimized by the compiler. Most processors have instruction for comparing to zero. So they don't need to load the loop variable and the maximum value, subtract them and then compare to zero. That is why count down to zero loop is better.

28. Tell me what is Top half & bottom half of a kernel?

Sometimes to handle an interrupt, a substantial amount of work has to be done. But it conflicts with the speed need for an interrupt handler. To handle this situation, Linux splits the handler into two parts – Top half and Bottom half. The top half is the routine that actually responds to the interrupt. The bottom half on the other hand is a routine that is scheduled by the upper half to be executed later at a safer time.

All interrupts are enabled during execution of the bottom half. The top half saves the device data into the specific buffer, schedules bottom half and exits. The bottom half does the rest. This way the top half can service a new interrupt while the bottom half is working on the previous.

29. Tell me what is interaction semantics used in embedded systems?

Interaction semantics allow the actions to be performed by the system components to allow it to get the global behavior. The interaction can be atomic or non-atomic dependent on the interaction between the components. These components can't be modified using the interference having the other interactions. Languages that are used, having buffered communication, and other languages, that include multi-threaded languages that use non-atomic interactions. There are two types of interactions that are used:
☛ Strong synchronization: allow the components to participate together and have strong bonding in between.
☛ Weakly synchronizing: are asymmetric that required the communication from both the objects.

30. Tell me what is the purpose of using critical sections?

Critical section allows the process to run in an area that is defined by that process only. It is a sequence of instructions that can be corrupted if any other process tries to interrupt it. This process allow the operating system to give the synchronization objects that are used to monitor the processes that are up and running so that no other process will get executed till the critical region consists of a process that is already running. The example includes removal of the data from a queue running in a critical section and if not protected then it can be interrupted and the data have chances of getting corrupted. The processes exit from the critical section as soon as they finish the execution so that the chances can be given to other processes that are waiting for their chance to come.

31. Tell me 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.

32. Explain me how does the interrupt architecture works?

Interrupt architecture allows the use of interrupt by the processor whenever an Input/output is ready for the processing. The processor in this case calls a special function to handle the request that comes and leave all the work that is getting performed at that time. The special function that is known as interrupt handler or the interrupt service routine consists of all the input, and output queries, or the interrupts handled by it. It is an efficient and simple way to handle the interrupts. It uses only one function to deal with the interrupts. There are properties of starvation that can creep in when handling the input/output requests. The data can be lost if the interrupt doesn't get handled before the time runs out. This is a technique that is use to deal with the short processes that involve input and output.

33. Explain me 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 80x86 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.

34. Explain what are the differences between analytical and computational modeling?

Analytical model allows the components to deal with the concurrency that are given during the process and the quantitative constraints that might come in between the components. Whereas, computational model deal with the non-deterministic abstraction hierarchy that has computational complexity to deal with the concurrency and allow it put also the physical constraints.

Analytical models can't deal with the partial and incremental specifications that are non-deterministic. It is also not good in controlling the computation complexity that is used in the hardware design. Whereas, Computational model can, deal with constraints easily and it provides an upgradeable solution.

Analytical model is the equation based model that doesn't have the time-sharing and parallelism concepts. Whereas, time-sharing and parallelism is used, in the abstract method that provides the theories of complexity and the real time evaluation.

35. Tell me why is it better to use multi-threading polling then single threading model?

Multi-threading allows a simple thread to be stored and polled. There is no Input/output function that is applied when it is having the poll. When there is no poll available to spawn it makes the system to sleep for an amount of time till the request for another poll reaches. If there is one process that is running then it divides that process into multiple threads and processes it accordingly. It allows the main thread to process all the request and produce the output by combining all other. Multi-threading allows the main thread not to put off the result or the output that will be generated. It also allow the priority of the thread to be changed by allowing to set the priority of the input/output process. It also has some problems with the polling interval that can make a thread starve for some time if the request isn't handled properly.