Tuesday, February 3, 2009

Embedded : TechPitcher

Embedded : TechPitcher: "
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.

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:
view plaincopy to clipboardprint?

1. int count = 10;
2. if(count < 20) {
3. //do something
4. }


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."

No comments: