11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

456 stackstackOften a temporary storage data area is needed duringprocessing. For example, a program that calls a procedure(see procedures <strong>and</strong> functions) usually needs to passone or more data items to the procedure. These itemsare specified as arguments that will be matched to theprocedure’s defined parameters. For example, the procedurecallSquare (50, 50, 20)could draw a square whose upper left corner is at thescreen coordinates 50, 50 <strong>and</strong> whose length per side is 20pixels.When the compiler generates the machine code for thisstatement, that code will probably instruct the processorto store the numbers 50, 50, <strong>and</strong> 20 onto a stack. A stack issimply a list that represents successive locations in memoryinto which data can be inserted. The operation <strong>of</strong> astack can be visualized as being rather like the springloadedplatform onto which dishes are stacked for washingin some restaurants. As each dish (number) is added, thestack is “pushed.” Because only the item “on top” (the lastone added) can be removed (“popped”) at any given time,a stack is described as a LIFO (last in, first out) structure.(Note that this is different from a queue, where items canbe added or removed from either end [see queue].)Stacks are useful whenever nested items must betracked. For example, a procedure might call a procedurethat in turn calls another procedure. The stack can keeptrack <strong>of</strong> the parameters (as well as the calling address) foreach pending procedure.Stacks can also be used to evaluate nested arithmeticexpressions. For example, the expression that we write inconventional (prefix) notation as7 * 5 + 2can be represented internally in postfix form as:* + 5 7 2Here one stack can be used to hold the operators (* +) <strong>and</strong>one the oper<strong>and</strong>s (5 7 2). The evaluation then proceeds inthe following steps:Pop the * from the operator stackSince * is a binary operator (one that needstwo oper<strong>and</strong>s), pop the 5 <strong>and</strong> 7 from theoper<strong>and</strong> stackMultiply 5 <strong>and</strong> 7 to get 35.Pop the + from the operator stack.Pop the 35 (which is now on the top <strong>of</strong> theoper<strong>and</strong> stack) <strong>and</strong> the 2Add 35 <strong>and</strong> 2 to get 37.An interesting programming language uses this stackmechanism for all processing (see forth). In working withstacks, it may be necessary to keep in mind any limitationson the amount <strong>of</strong> memory allocated to the stack, although astack can also be implemented dynamically as a linked list(see list processing).Further Reading“Data Structures/Stacks <strong>and</strong> Queues.” Wikibooks. Availableonline. URL: http://en.wikibooks.org/wiki/Data_Structures/Stacks_<strong>and</strong>_Queues. Accessed August 22, 2007.Stallman, Richard(1953– )American<strong>Computer</strong> ScientistRichard Stallman created superb s<strong>of</strong>tware tools—the programsthat help programmers with their work. He wenton to spearhead the open source movement, a new way todevelop s<strong>of</strong>tware.Stallman was born on March 16, 1953, in New YorkCity. He quickly showed prodigious talent for mathematics<strong>and</strong> was exploring calculus by the age <strong>of</strong> eight. Not muchlater, his summer camp reading included a manual for theIBM 7094 mainframe belonging to one <strong>of</strong> the counselors.Fascinated with the idea <strong>of</strong> programming languages, youngRichard began writing simple programs, even though hehad no access to a computer.Fortunately, a high school honors program let himobtain some time on a mainframe, <strong>and</strong> his programmingtalents led to a summer job with IBM. While studyingfor his B.A. in physics at Harvard (which he received in1970), Stallman found himself sneaking across town tothe MIT Artificial Intelligence Lab. There he developedEmacs, a powerful text editor that could be programmedwith a language modeled after LISP, the favorite language<strong>of</strong> AI researchers. While working on Emacs <strong>and</strong> othersystem s<strong>of</strong>tware for the AI Lab, Stallman participatedin the unique MIT “hacker culture.” (During the 1970s,“hacker” still meant a creative computing virtuoso, not acyber-criminal.)Stallman’s experience in the freewheeling, competitiveyet cooperative atmosphere at MIT led him to decidein 1984 to start the Free S<strong>of</strong>tware Foundation, whichwould become his life’s work. Stallman <strong>and</strong> his colleaguesat the FSF worked through the 1980s to develop GNU.At the time, UNIX, the operating system <strong>of</strong> choice formost campuses <strong>and</strong> researchers, required an expensivelicense from Bell Laboratories. GNU (a recursive acronymfor “GNU’s Not UNIX”) was intended to include all thefunctionality <strong>of</strong> UNIX but with code that owed nothingto Bell Labs. Stallman’s key contributions to the projectincluded the GNU C compiler <strong>and</strong> debugger, as well ashis management <strong>of</strong> a cooperative effort in which manytalented programmers would coordinate their efforts overthe Internet.By the early 1990s, most <strong>of</strong> GNU was complete exceptfor a key component: the kernel containing the essentialfunctions <strong>of</strong> the operating system. A Finnish programmer

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

Saved successfully!

Ooh no, something went wrong!