1
1
Aaron Stevens
29 June 2009
CS111 Lecture 01:
Computer Concepts Hardware and Software Binary Representation Programming Languages
2
CS111 Lecture 01: Computer Concepts Hardware and Software Binary - - PDF document
CS111 Lecture 01: Computer Concepts Hardware and Software Binary Representation Programming Languages Aaron Stevens 29 June 2009 1 What is a computer? What is a computer, anyway? Give some examples of computers: 2 2 1 What is a
1
2
3
4
5
6
7
8
The von Neumann computer architecture.
9
10
Some typical components in 1993.
11
12
13
14
15
16
17
18
19
For a given base, valid numbers will only contain the digits in that base, which range from 0 up to (but not including) the base.
20
21
+ 0 * 22
+ 1 * 21 (1 * 2) + 1 * 20 (1 * 1)
22
23
24
25
26
While (the quotient is not zero) Divide the decimal number by the new base* Make the remainder the next digit to the left in the answer Replace the original decimal number with the quotient * Using whole number (integer) division only. Example: 3 / 2 gives us a quotient of 1 and a remainder 1
27
What is the binary equivalent of the decimal number 103? 103 / 2 = 51, remainder 1 rightmost bit 51 / 2 = 25, remainder 1 25 / 2 = 12, remainder 1 12 / 2 = 6, remainder 0 6 / 2 = 3, remainder 0 3 / 2 = 1, remainder 1 1 / 2 = 0, remainder 1 leftmost bit 103 (decimal) = 1 1 0 0 1 1 1 (binary)
28
While (the quotient is not zero) Divide the decimal number by the new base* Make the remainder the next digit to the left in the answer Replace the original decimal number with the quotient
29
30
http://www.dewassoc.com/support/msdos/decimal_hexadecimal.htm
31
32
33
34
35
36
Figure 3.6 A few characters in the Unicode character set
37
38
39
40
– LOADA means “load value into accumulator” – ADDA means “add value into accumulator” – STOREA means “store value from accumulator”
41
42
43
Example: int a = 2; int b = 5; int total = a + b; System.out.println(total);
44
45
Figure 8.1 Compilation process
46
Fortran, 1952
– IBM, Numeric and Scientific Computing – Still in use in biology dept at BU!
Pascal, 1970
– Developed for teaching students structured Programming – Early Macintosh operating system, Apple Lisa written in Pascal
C, 1972
– Ritchie and Kernigan, AT&T Bell Laboratories – Developed for system software, UNIX
C++, 1979
– Bjarne Stroustrup, AT&T Bell Laboratories – Backwards compatible with C, and objects
ADA, 1983
– Department of Defense – 1970s: concern that DoD had too many programming languages – By 1996: down to only 37
C and C++ together have been the most popular compiled languages with the most programmers and applications.
47
48
BASIC, 1963
– Beginner’s All-purposes Special Instruction Code – Kemeny and Kurtz, Dartmouth College – Invented for non-science and non-mathematics users.
Perl, 1987
– Invented by Larry Wall of Unisys Corporation – Regular Expression engine for text processing
Visual Basic/Visual Basic .NET, 1991
– Invented at Microsoft, a GUI scripting language – Extremely popular; huge installed business application base
Python, 1991
– Guido van Rossum, researcher at BDFL in the Netherlands – Minimalist semantics – Named after Monty Python
49
50
– Speed: tend to run faster than interpreted languages. – Portability: virtually none. To port to new CPU architecture, must re-compile the source code and distribute new executable file.
– Speed: tend to run more slowly than compiled languages. – Portability: virtually seamless. Distribute source code directly, and it will run on any suitable interpreter.
51
Source Code (Program) Compiler Machine Code Program Inputs Running Program Outputs
A compiler takes source code, and produces executable machine code (stored in a file on disk). The machine code program is executed by the user. Advantage: speed at time of execution.
52
Source Code (Program) Computer Running an Interpreter Inputs Outputs
An interpreter takes source code as input, and then compiles each statement and executes it immediately. Advantage: portability
53
– Portability was of primary importance.
– Java is compiled into a standard machine language called Java Bytecode, for the Java Virtual Machine. – A software program called the Java Virtual Machine executes the Bytecode program by translating the JVM instructions into native instructions.
54