PROGRAM AT RUNTIME Subject code: CSCI-620 Subject name: Operating Systems Security Lecture No.: 02 Unit: 02 Unit topic: Basic program execution flow control Professor : R. A. Mihajlović School year: 2012/2013 © R. A. Mihajlovic, 2012 - Reproduction is prohibited
CSCI-620 Operating Systems Security Topics Program lifetime phases Typical C program development phases Program statistics Run time Compile time CSCI-620 Operating Systems Security Lecture 2.2 2
Typical Program Lifetime Phases Typical Program Lifetime Phases One program or software goes through 3 general life time phases: Static or development phase, compile time Transient or loading phase, load time Dynamic or runtime phase, runtime Additional lifetime phase is deployment/installation/roll-out time, which may be of essence with regard to security. CSCI-620 Operating Systems Security Lecture 2.2
Typical C Program Development Steps Typical C Program Development Steps Phases of some typical C/C++ program evolution: Editing (Static) Preprocessing (Static) Compiling (Static) Linking (Static) Loading (Transient) Executing (Dynamic) CSCI-620 Operating Systems Security Lecture 2.2
Typical C Program Development Steps Typical C Program Development Steps Program source text is created in the editor and stored on disk. Preprocessor program processes the source code text. Loader puts program in memory. Compiler & Assembler create object code and stores it on disk. Linker links the object code modules with the libraries Loader Primary Memory Compiler Editor Preprocessor Linker Primary Memory . Disk CPU Static or Compile Time Transient or Load Time Dynamic or Run Time CPU fetches each object code instruction and executes it.
Source Code Text Processing Compiler (Static time) “Translates” program written in "source" language to "target" language Interpreter (Dynamic time translation & execution) Translates source text line/instruction into object code and immediately executes CSCI-620 Operating Systems Security Lecture 2.2
Source Code Text Processing (Transformation) Assembler (Static time) Translates Assembly language text into the object binary code (machine “language” not human language) for particular machine/CPU Macro Processor (Static time) Textual substitutions, (Parses text, finds its directives and executes these directives by replacing them with the macro-text) Example: Macro assembler replaces Macro Assembly instructions with the block of assembly instructions (With the Macro code) Example: C preprocessor replaces preprocessor directives with the result of their execution (#include, #define, #ifdef,…) CSCI-620 Operating Systems Security Lecture 2.2
CSCI-620 Operating Systems Security Run time statistics Good estimate is that out of all programs running at any given time anywhere in the world, 90% were written in C. CSCI-620 Operating Systems Security Lecture 2.2
Compile time statistics Good estimate is that out of all programs that exist on the storage of any computing machine in the world 10% were written in C.
CSCI-620 Operating Systems Security Reference [1] John W. Backus, 82, Fortran Developer, Dies, NY Times, March 20, 2007 [2] Additional material CSCI-620 Operating Systems Security Lecture 2.2
CSCI-620 Operating Systems Security The End J.W. Backus Inventor of Fortran 1957 CSCI-620 Operating Systems Security Lecture 2.2