



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Computer Systems and Programm; Subject: Computer Science; University: George Mason University; Term: Unknown 1989;
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




1-
C is a procedural language (not object-oriented)
Commonly used for “low-level” systems programming and embedded systems
Especially in the presence of bugs
Need to understand underlying implementations
Become more effective programmers
Able to find and eliminate bugs efficiently
Able to tune program performance
Prepare for later “systems” classes in CS & ECE
Compilers, Operating Systems, Networks, Computer Architecture
Is x
2
Float’s:
Yes!
Int’s:
40000 * 40000 --> 1600000000
50000 * 50000 --> ??
Is (x + y) + z = x + (y + z)?
Unsigned & Signed Int’s:
Yes!
Float’s:
(1e20 + -1e20) + 3.14 --> 3.
1e20 + (-1e20 + 3.14) --> ??
1-
Does not generate random values Computer Arithmetic
Arithmetic operations have important mathematical properties
Due to finiteness of representations
Integer operations satisfy “ring” properties
Commutativity, associativity, distributivity
Floating point operations satisfy “ordering” properties
Monotonicity, values of signs
Need to understand which abstractions apply in which contexts
Important issues for compiler writers and serious application programmers
1-
Great Reality #
Great Reality # Memory Referencing Bug Example
{ main ()
exit(0);printf("d = %.15g\n", d);a[2] = 1073741824; /* Out of bounds reference */double d = 3.14;long int a[2];
}
A
lph
a
M
I PS
Linux
-g
5.30498947741318e-
-O
(Linux version gives correct result, but segmentation fault.)implementing as separate function gives
1-
Randal E. Bryant and David R. O’Hallaron, Textbooks
“Computer Systems: A Programmer’s Perspective”, Prentice Hall 2003.
csapp.cs.cmu.edu
“The C Programming Language, Second Edition”, Prentice Hall, 1988
You can use any book on C
1-
Exceptional Control Flow & Virtual Memory (3 weeks)Linking (1 week)Program Representation (5 weeks)Data Representation (2 weeks)Programming in C (2 weeks) Course Outline
Assumption: You are comfortable programming in Java Programming in C
C Standard I/O library for input/output
Bit-level operators
Pointers & Structures
Memory allocation and deallocation
HW1: Write a non-trivial program in C
Machine-level Representation of Data and Programs
Bits operations, arithmetic, assembly language programs, representation of C control and data structures
Includes aspects of of architecture and compilers
Lab1: Manipulating bits
Lab2: Defusing a binary bomb
Lab3: Hacking a buffer bomb
1-
Topics Linking and Exceptional Control Flow
Object files, static and dynamic linking, libraries, loading
Hardware exceptions, processes, process control, Unix signals, nonlocal jumps
Virtual Memory
Includes aspects of compilers, OS, and architecture
Lab4 (optional): Writing your own shell with job control
1-
Each assignment should have a well-defined goal such as Rationale for Assignments
Lab2,3: assembly language, using a debugger, understanding the stack
Lab4: understanding Unix process control and signals
Logistics
Grading
Homeworks (15 %) and Lab Assignments (35%)
can work in groups of two for homeworks
will be able to work in groups of two for later programming assignments
gradingAll programs will be submitted and tested on a Linux platform for
You need to obtain an IT&E Unix Cluster account (See syllabus)
Midterm (25%) & Final (25%)
What is cheating? Cheating
Sharing code: either by copying, retyping, looking at, or supplying a copy of a file.
Helping others use systems or tools.
Helping others with high-level design issues.
Helping others debug their code.
Removal from course with failing grade.