Chapter 2 Real-Time Systems Concepts Foreground/Background ...
Chapter 2 Real-Time Systems Concepts Foreground/Background ...
Chapter 2 Real-Time Systems Concepts Foreground/Background ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
• <strong>Foreground</strong>/background programming– Context (CPU registers and interrupted program address) save andrestore using one stack• Multi-tasking context switch– Using each task’s own stackCurrent CPU stack pointerTask1’s local variablesReturn address (optional)Task 1 (to be switched from) stackCPU registers whenTask 2 was switchedTask 2’s code addresswhen it was switchedTask 2’s local variableswhen it was switchedReturn address (optional)Task 2 (to be switched to) stack2-9• During context switchTask1’s local variablesReturn address (optional)Task 1 stackCPU registers whenTask 2 was switchedTask 2’s code addresswhen it was switchedTask 2’s local variableswhen it was switchedReturn address (optional)Task 2 stackTask 1 TCBCurrentProgramaddressCurrentCPUregistersTask 2 TCBStack pointerCurrent CPU stack pointerStack pointer2-10