Chapter 2 Real-Time Systems Concepts Foreground/Background ...
Chapter 2 Real-Time Systems Concepts Foreground/Background ...
Chapter 2 Real-Time Systems Concepts Foreground/Background ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Figure 2.5 Preemptive kernelLow Priority TaskISRHigh Priority TaskISR makes the highpriority task ready<strong>Time</strong>2-17Reentrancy• Reentrant function– Can be used by more than one task in concurrent without fear ofdata corruption– Can be interrupted at any time and resumed at a later time withoutloss of data– Use local variablevoid strcpy(char *dest, char *src){while (*dest++ = *src++) {;}*dest = NUL;}Listing 2.1 Reentrant functionint Temp;void swap(int *x, int *y){Temp = *x;*x = *y;*y = Temp;}Listing 2.2 Non-reentrant function 2-18