In embedded systems, still the trend has not shifted to multi-core processors completely for various valid reasons.
Hence it is still important to understand synchronization behaviour using various mechanisms and multi threading features with respect to uni processor systems. Also, whenever I face interviews, they ask me questions on the behavior of a particular C program on uni processor system.
So, if I want to analyze the Sample C programs on a uni processor systems, to check the behaviour of them at home, how would I do that? My CPU at home has a Core i3 processor. Is there a way I can ask my OS or compiler to check the behaviour forcebly by considering only one CPU?
Example:
int x=0;
Snippet-1
while(x);
x++;
Snippet-2
while(!x);
x--;
Considering a uni processor system, I want to check the behaviour of a C program in which
- Snippet 1 and snippet 2 are in multiple threads
- Snippet 1 is in the main program and snippet 2 is in ISR
- Snippet1 and Snippet2 are both in two different ISRs (Consider interrupts are caught on priority, and also when inside ISR, if there is a new interrupt coming with higher priority, then the interrupt with highest priority is executed immediately – Ex: Reset)
In the above questions, my primary goal is to identify if there will be any dead locks, and if present, need to identify the solution. Please put in your thoughts. Thanks.
I suggest you to create a uni-processor system by compiling new kernel with only one core enabled in i3.(Obviously performance will be less.)
Follow the steps in following link,
http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
While configuring,
go to Processor type and Features–>
Un-check the Symmetric Multiprocessing Support.
and study the instruction to create uni processor system.