What is watchdog timer?

Watchdog timer is hardware circuitary tightly integrated into embedded systems’ CPU to have a watch on embedded system’s working. It has ability to detect if embedded system is entered into a hanged state. It then resets the embedded system so that it doesn’t remain in hanged state indefinately. Watchdog timer is generally used in embedded systems where their is no human intervention present to reset it when system hangs. As its name suggests watchdog timer is a timer circuitary which keeps on counting and expires until reset. Embedded system software is expected to restart the timer regularly to prevent it from expiring under normal conditions. When systems hangs the timer is not restarted and it expires to give an indication to the system to restart.

Differences between Vector and ArrayList

The two classes are very similar, however there are few differences, which can give one a clear idea about their usages.Vector is synchronized. Content in vector is thread-safe. ArrayList is not synchronized hence its content is not thread-safe. Synchronization is not at free of cost. It affects vector’s performance. So if we don’t require thread-safe data, we should use ArrayList.
Internally, both the ArrayList and vector hold data in Array. When we add a new element into ArrayList or Vector, and the object will need to expand its internal array if it runs out of memory. Vector doubles the size of Array by default, while the ArrayList increases its size by 50 percent. Vector does have slight advantage since they allow to reset increment size.Addition and deletion operation in both classes takes same time.
Addition at the end of container can be performed in constant time O(1). Deletion and Addition are more expansive when the element is added/removed from middle, it takes O(n-i). Here n is number of elements in the container and i is index of the element.

How many ways shared data problem can be solved?

1. Disabling interrrupts – to be used when data is shared between ISR and task code. note that scheduler would not be able to switch tasks as interrupts are disabled.
2. Using semaphore – can be used when data is not to be used in ISR as semaphores are not allowed in ISR.
3. Disabling task switches – to be used when data is not shared among ISR and task code.

What is deadly embrace or dead lock?

Dead lock or deadly embrace is another fancy name given to priority inversion.

What is priority inversion?

Priority inversion is a phenomenon which happens when different priority tasks shares common data is a particular fashion. Say task A is higher priority task than task B and they both shares common data say x. Say task B was running and it locks x for its use while task A interrupted and got control now when task A needs to access x it would be able to because control would never be given back to task B to release x. Hence higher priority task is blocked by lower priority task, which is reffered to as priority inversion.

What is mutex?

Mutex is short form of mutual exclusion. It is very much silimar to semaphore and the names are used interchangably in different opperating systems. The semaphore which are task attached i.e. the task which had acquired the sempahore will only be allowed to release it, are generally termed as Mutex.

What is semaphore?

Semaphore is a hardware or software flag. It is facility provided by operating system. In multitasking systems, a semaphore is a variable with a value that indicates the status of a common resource. It’s used to lock the resource that is being used. A process needing the resource checks the semaphore to determine the resource’s status and then decides how to proceed.

What is a critical section in embedded software programs?

Critical Section is a set of instructions that must be atomic for system to work properly. Several techniques are used to ensure that a piece of code is atomic, some of which are semaphore, mutex etc.

What is volatile variable?

volatile is a keyword to indicate compiler that the variable it is used with should not be assumed to be unchanged during the course of execution of the code. Most compilers do optimizations which assumes that variable will not be changed until software is changing it. Refer following piece of code to understand it further:

int count = 10;
if(count < 20) {
//do something
}

In this code, compiler can not remove if check for optimization. The value of count can be changed between assignment and if check by some other process.

What is UART?

UART is universal asynchronous  receiver and transmitter. It is used in many embedded systems for interfacing with other devices. Its purpose is to convert data to and from serial interface. A very popular standard for serial interface is RS-232.

Technology