Program
From StudyWiki
Contents |
Overview
Computer programs (also software programs, or just programs) are instructions for a computer. A computer requires programs to function.
Computer programs are written in a programming language that can be understood by humans, which must be compiled into machine code before the computer can execute it.
There are many different programming languages and styles of programming.
Program Memory
- heap and stack are 2 separate areas of memory managed by a runtime system
- internal data structures
Stack Memory
- when a procedure begins execution a section of stack is created to store data
- e.g. parameters and local variables
- called an activation record
- stack resident variables are automatically created when a procedure is entered
- and removed when it is exited
- activation records are pushed and popped in Last-In-First-Out order from the stack
Heap Memory
- Heap-resident values are created by the new operator
- Heap-resident values will not be automatically removed when the procedure that created them exits
- they remain on the heap until the whole program ends or are removed by extra actions
