lec03-synchronizationx4 - Page 1 CS162 Operating Systems...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Page 1 CS162 Operating Systems and Systems Programming Lecture 3 Concurrency and Thread Dispatching January 25, 2012 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Lec 3.2 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . Lec 3.3 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; Stack Pointer Stack Growth A: tmp=1 ret=addrZ addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . Lec 3.4 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; Stack Pointer Stack Growth A: tmp=1 ret=addrZ addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . ! Page 2 Lec 3.5 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; Stack Pointer Stack Growth A: tmp=1 ret=addrZ B: ret=addrY addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . Lec 3.6 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; Stack Pointer Stack Growth A: tmp=1 ret=addrZ B: ret=addrY C: ret=addrU addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . Lec 3.7 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example Stack holds function arguments, return address Permits recursive execution Crucial to modern languages A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; A: tmp=2 ret=addrV Stack Pointer Stack Growth A: tmp=1 ret=addrZ B: ret=addrY C: ret=addrU addrX: addrY: addrU: addrV: addrZ: . . . . . . . . . . . . Lec 3.8 1/25/12 Anthony D. Joseph and Ion Stoica CS162 UCB Spring 2012 Review: Execution Stack Example A(int tmp) { if (tmp<2) B(); printf(tmp); } B() { C(); } C() { A(2); } A(1); exit; A: tmp=2 ret=addrV Stack Pointer Stack Growth A: tmp=1 ret=addrZ B: ret=addrY C: ret=addrU addrX: addrY: addrU: addrV: addrZ: ....
View Full Document

Page1 / 12

lec03-synchronizationx4 - Page 1 CS162 Operating Systems...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online