Wednesday 17 May 2017

Embedded

Cross compile:
Cross compiling is the process in which code for a target processor is compiled in a different host processor. This is usually done because the target processor might not have enough resources to be able to compile applications on it.

A toolchain is the set of compiler + linker + librarian + any other tools you need to produce the executable (+ shared libraries, etc) for the target. A debugger and/or IDE may also count as part of a toolchain.

 automatically reboot a Linux system after a kernel panic
 when there’s a problem with hardware or software. The last thing you want, is that a Linux server got a kernel panic and then waits forever for someone to reboot it.

There’s a way to configure Linux to reboot automatically, say 10, seconds after a kernel panic occurs. This will quickly and automatically have the server up again.

/sbin/sysctl -w kernel.panic=10
 
Note that this setting will not survive a reboot. If you want it to remain active, add this line to /etc/sysctl.conf:
kernel.panic=10To check the current setting, issue:
cat /proc/sys/kernel/panic
 

Implement sizeof() operator.

#define my_sizeof(a) (size_t)((char*)(&(a)+1)-(char*)(&(a)))

 

int* pInt = 0x0004;
++pInt;                 //now it points to 0x0008

double* pDouble = 0x0002;
++pDouble;         //now points to 0x000A

char* pCh = 0x0005;
++pCh;                //now points to 0x0006

 
 What is watchdog timer? 
A watchdog timer (or computer operating properly timer) is a computer hardware timing device that triggers a system reset if the main program, due to some fault condition, such as a hang, neglects to regularly service the watchdog (writing a “service pulse” to it, also referred to as “petting the dog” or “feed the watchdog”[1] or “waking the watchdog”). The intention is to bring the system back from the hung state into normal operation.
 
Starvation :
A thread may wait indefinitely because other threads keep coming in and getting the requested resources before this thread does. Note that resource is being actively used and the thread will stop waiting if other threads stop coming in.
Example :
High priority thread:
while(1);
if the system is priority based system then low priority thread never gets a chance.
 
 
 

No comments:

Post a Comment