Download presentation
Presentation is loading. Please wait.
Published byBritney Peters Modified over 9 years ago
1
Chapter 1 Computers, Compilers, & Unix
2
Overview u Computer hardware u Unix u Computer Languages u Compilers
3
Computer Hardware u Central Processing Unit (CPU) The heart and brains of a computer The device that performs all calculations and data manipulation in a computer u Main Memory (RAM) The place the CPU looks for instructions and data to process
4
Computer Hardware u Mass Storage (hard drive) Holds information not immediately needed by CPU Holds massive amounts of data u Input/Output Devices keyboard, mouse, monitor, printer Devices used to move information into and out of the computer
5
Basic Architecture u Processor (CPU) u Main Memory volatile u I/O devices secondary memory communications terminals u System interconnection a bus is used to exchange data and control information CPUMemory System Bus Disk Controller Network Controller Serial Device Controller
6
What is an operating system? u Acts as interface between computer system resources (hardware) and applications u Manages the way other programs use system resources and communicate with each other u Common operating systems Windows XP, Macintosh OS, & Linux u In CS 201 we use Solaris, a type of Unix
7
Unix file system u Home directory A directory set aside for your personal use The starting point when you log in u Working directory Whatever directory you are currently in Initially, the working directory is the home directory u The cd command is used to change the working directory cd.. Moves up one level in the directory structure cd moves down one level, into the given directory u The pwd command gives the full path of the working directory u The ls command lists the contents of the working directory
8
Programming Languages u Common programming languages include … C C++ Java Pascal Visual Basic FORTRAN COBOL Lisp Scheme Ada u These high-level languages Resemble human languages Are designed to be easy to read and write Use more complicated instructions than the CPU can follow Must be translated to zeros and ones for the CPU to execute a program
9
Low-level Languages u An assembly language command such as ADD X Y Z might mean add the values found at x and y in memory, and store the result in location z. u Assembly language must be translated to machine language (zeros and ones) 0110 1001 1010 1011 u The CPU can execute machine language instructions
10
Compilers u Translate high-level language to machine language Source code the original program in a high level language Object code the translated version in machine language
11
Linkers u Some programs we use are already compiled Their object code is available for us to use Input and output routines u A Linker combines The object code for the programs we write and The object code for the pre-compiled routines into The machine language program the CPU can run
12
From Source Code to Executable Program #include using namespace std; int main() { cout << "Hello World!" << endl; return 0; } #include using namespace std; int main() { cout << "Hello World!" << endl; return 0; } compiler linker 1001010100010 1010010101001 0010101001010 0101001001001 0100101010101 0010010100100 1001010010100 1010000100100 1001 library 1001010100010 1010010101001 0010101001010 0101001001001 0100101010101 0010010100100 1001010010100 1010000100100 1001 object file 0100101010010 1001010010010 0101001010101 0100100101001 0010010100101 0010100101010 1010100100100 1000100100100 1001 executable file
13
u Algorithm A sequence of precise instructions which leads to a solution u Program An algorithm expressed in a language the computer can understand Programming & Problem Solving
14
Program Design u Programming is a creative process No complete set of rules for creating a program u Design process for CS-201 Problem Solving Phase Produce an algorithm that solves the problem Implementation & Testing Phase Translate into a valid, functioning program
15
Problem Solving Phase u Be certain the task is completely specified What is the input? What information is in the output? How is the output organized? u Develop the algorithm before implementation Experience shows this saves time in getting your program to run Test the algorithm for correctness
16
Implementation & Testing Phase u Translate the algorithm into a programming language Easier as you gain experience with the language u Compile the source code The compiler identifies violations of the programming language's grammar These are known as syntax errors u Run the program on sample data Verify correctness of results If you made mistakes in your algorithm design, or in your translation to the programming language, you'll see errors These are known as logic errors u Modify the algorithm and/or program and repeat
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.