11.07.2015 Views

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

SHOW MORE
SHOW LESS

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!