Dynamic Linker Demystified From WindRiver Conference

The following slides are from a presentation on the Linux dynamic linker and tips and tricks for its use in Linux based embedded system which was given by Gilad Ben-Yossef, Codedfidence CTO, at the Wind River Embedded Linux Conference in Ramat Ilan, Israel at December 4, 2007:

Let’s Play The Weakest Link Slides (PDF)

Setting tasks CPU affinity

Linux kernel 2.6 and latest versions of 2.4 support two system calls that allow one to limit processes to specific CPUs.

The system calls are:

#include <sched.h>
 
int sched_setaffinity(pid_t  pid, unsigned int len, 
   unsigned long *mask);
 
int sched_getaffinity(pid_t pid, unsigned int len, 
   unsigned long *mask);

pid is the process id of the process to assign to certain CPUs. Use ‘0′ here to denote the current process.

len is the length of the CPU bit mask, and mask is a pointer to a bit mask denoting which CPU can the process run on.

For a good discussion and a code example, look here:

http://www-128.ibm.com/developerworks/linux/library/l-affinity.html

Using proccess specific APIs on threads

A lot of POSIX API’s require a PID, or process ID, as a parameter. Sometime it is useful to use such an API on a thread, rather then a process.

Since Linux internally implements all processes and threads as tasks, one can use the Linux specific gettid(2) system call to get the “Thread ID” of a thread, which is really equal to a process PID, at least so much as to be useful as a parameter for a POSIX system call that requires a PID.

The use is Linux specific, non portable and it is not clear if it is a stable API or an undocumented coincidence. Use with care.

SupportMatrix™

We have just launched a new product: SupportMatrix™.

SupportMatrix™ enables customer support call center operators to experience an interactive simulation of the customer computer without the need for a remote connection to the customer computer. It is targeted to large scale tech support centers operators.

SupportMatrix™ has its own web site and you can read the press release here.