lecture9 - COMP 250 Winter 2010 lecture 9 - Call stack,...

Info iconThis preview shows pages 1–2. 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: COMP 250 Winter 2010 lecture 9 - Call stack, factorial Jan 25, 2010 In the next three lectures we will look at recursion . This is a very important topic. Before we discuss it, though, I will discuss the call stack . I wont give a complete description of the call stack (youll have to wait for COMP 273), but I will give you enough for you to understand some of the subtleties of how recursion works, in a language such as Java (or C). Recall that the Java instructions you type into the computer are not the instructions that the computer executes. Each instruction that you type gets broken down into number of lower level instructions (called Java byte code , in the case of Java) or more generally called machine code which tell the computer where to get certain data from, and where to put certain data, and what operations to perform on the data. By where, I mean what address and here the addresses are the 32 bit addresses that I referred to back in lecture 3. Be aware that these lower level instructions themselves sit somewhere in this address space. That is, each instruction takes a small number of bytes in the 2 32 byte space. As a program is running, you should think of one of the instructions as be being executed at each time step 1 The address of this current instruction is stored in a special place (not part of the 2 32 byte address space) and this address is called the program counter . Call Stack When we write programs in say Java or C, we have a main method where the program starts....
View Full Document

Page1 / 3

lecture9 - COMP 250 Winter 2010 lecture 9 - Call stack,...

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

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