CSc 330 - OOD & Systems Programming - Prof Domanski
History Handout
Types of System Programs
Compilers - translate from a high-level language to machine language
Loaders - prepare machine language programs for execution
Macro Processors - allow for abbreviations for sets of instructions
Assemblers - translates from a low-level language (e.g. assembly language) to machine language
Self-Modifying Programs
programs that contain instructions that change instructions (rather than data) while they are running
if it's a subroutine, it will execute a different set of instructions the second time it's called as compared with the first time
this is impure as compared with a re-entrant program (which is exactly the same each time it is called including any data constants that may be defined in it)
Assemblers
designed to eliminate the need for programmers to use switches to enter a program into a computer
assemblers and the language they translate make it easier to code and maintain programs
two outputs are created: a listing which contains both source statements as well as object code, and an object program that contains the actual machine language program
Loaders
places an object program (or programs) into memory in an executable form
an assembler could do this memory placement after all the object code is generated, transfer control to it, and then regain control after the program runs.
this would make the assembler necessary each time the program were to run - a waste!
Simple Loading Scheme
object programs are placed onto secondary storage
the loader is first put into core memory,
it then extracts the object program(s) from secondary storage, finds room in core memory, and loads the object program into available core memory
control is transferred from the loader to the object program
loaders are much smaller than assemblers, so this frees more memory at execution time
Subprogram Structure
2 types: open (macros) vs. closed (subroutines)
Open: source code is inserted into the source program and assembled (or compiled if its a high-level language).
Closed: control is passed from a calling program to a subroutine at execution time
Symbolic vs Absolute referencing: programmers want to use symbols to reference storage locations (symbolic addressing). That way, instructions that reference locations by symbols don't have to worry about the actual locations assigned to the program. Absolute addressing forces locations to be referenced by their exact address ... the computer cannot move the program to a different set of memory locations without the program being seriously upset!
Relocation - adjusting programs so that they can be placed in arbitrary locations in memory
Relocation Loader
allocation
Linking or Binding - resolving symbolic references between object programs
Relocation - adjusting address dependent locations like address constants so that they correspond to the actual allocated space
Loading - place programs and data into memory
Macros - relieve programmers of the need to repeat identical parts of a program
allows the use of abbreviations for sets of instructions
a macro processor saves & processes macro definitions
before assembly time, the macro processor substitutes the saved definition for each macro call used in a program
Compilers
originally designed for used in scientific (FORTRAN) and business (COBOL) applications
translate high-level languages to machine language (object code)
an interpreter translates each line of a source program to machine language as it is processed, executes that line, then goes on to the next line ... if a line in a source program is repeated (as in a loop), an interpreter must re-translate the line to machine language
a compiler translates every line at one time to machine language first, then the object program is executed
Operating Systems
the earliest systems:
load FORTRAN compiler card deck,
run FORTRAN on user source program; punch object deck
load LOADER card deck
run LOADER on object deck(s)
transfer control to user program, read data if necessary
this wastes time processing the compiler and loader card decks
Batch System places many jobs in the reader at once, and the compiler and loader are retrieved from secondary storage (e.g. disk or drum)
Primary Function - to manage critical resources: CPU, memory, and I/O
Multiprogramming - more than one program is resident in memory at any instant
Multiprocessing - more than one program is executing at any instant; >1 CPU
Fragmentation - holes in core memory from odd program sizes
Paging
program is divided into equal size segments called pages (4K)
core memory is divided into equal size blocks (4K)
pages are loaded into memory blocks
Simple Paging - all pages are loaded into core before execution
Demand Paging - pages are fetched from secondary storage during execution as they are referenced
Scheduler - allocates processor time
Virtual Memory - more addresses can be generated than there are actual core storage locations
gives the illusion of having a large real memory space
Operating System Functions
job sequencing, scheduling, traffic control
I/O programming and file system management
protection (so that one program can't modify another program accidentally)
Storage management
Error processing and recovery
Last Updated on 02.04.2003