01 - CSC 1500 Computer Principles and Programming Prepared by Michael Ping-Fu FUNG Department of Computer Science and Engineering The Chinese

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSC 1500 Computer Principles and Programming Prepared by Michael, Ping-Fu FUNG. Department of Computer Science and Engineering The Chinese University of Hong Kong Version 3, 2001-2002 Fall All copyrights reserved. Part of the material was prepared by Sau-Ming LAU, used with permission. CSC 1500 { Lecture 1 1 Table of Contents 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. Introduction Writing an ANSI C Program Lexical Elements, Operators, and the C System Flow of Control Character Processing The Fundamental Data Types Functions and Structured Programming More on Variables and Data Types Arrays Sorting and Structures Memory Addresses, Pointers, and Arrays Revisited Strings and Pointers More About Structures CSC 1500 { Lecture 1 2 Lecture 1| Introduction Basic Computer Architecture Post von Neumann Architecture Zero and One Programming Languages High Level Programming Languages CSC 1500 { Lecture 1 3 Overview Input Computer Output A computer accepts external input , processes the data, and produces certain output . c.f. Our digestive system :) Modern electronic computers: general-purpose and storedprogram. CSC 1500 { Lecture 1 4 Basic Computer Architecture Control Unit Arithmetic and Logic Unit Registers I/O Unit Input Output Memory Secondary Storage They will be introduced one-by-one in this lesson. And here are the REAL cool stu ... CSC 1500 { Lecture 1 5 input devices, such as keyboard, mouse and disk drive. { Places the information at the disposal of other units for processing. Output Unit: { Places processed information onto various output devices, such as screen or printer. { Makes those information available for use outside the computer. Memory Unit: { Retains information entered from the input unit. { Stores processes/tasks (programs in execution). { Stores intermediate results during processing. Arithmetic and Logic Unit (ALU): { Performs actual calculations and comparisons. Control Unit: { Supervises and coordinates the entire operations of a computer. Registers: { Storages for holding temporary data and computational results generated by the CPU when running a program. Secondary Storage: { A device, such as tapes or disks, for storing programs or data that are not actively being used by other units. CSC 1500 { Lecture 1 Input Unit: { Obtains information (data and programs) from various 6 Post von Neumann Architecture Most of the modern computers are basically based on the von Neumann architecture. Nowadays, there are lots of computer industry-related terminologies owing around. They are the fruits of new advances in technology. For example: Cache: A very fast memory system situated in between the CPU and main memory. Its speed lies between that of registers (ultra-fast) and main memory (fast). It acts as a bu er to assist the high speed CPU's to access the memory more e ciently. FPU: Floating Point Unit is originally designed as a supple- mentary device to the CPU, used for processing oating point numbers in high speed. They are now often incorporated into the CPU. cient instruction sets which boost the CPU in performing multi-media related operations. MMX/3D now!: They are special sophisticated and e ... Don't be afraid of them! To learn how to use or program a computer in daily lives, we need not understand every aspects of a computer. Once you understand the basics, you won't be scared by the acronyms and gures like P4 4.3GHz CPU, UDMA 70.2GB, 3.5" 1.44MB, 512MB RAM, 100Mbps Broadband... CSC 1500 { Lecture 1 7 Zero and One In the lowest level, computers understand only 0's and 1's. Computer memory stores a sequence of 0's and 1's. Each such storage unit is called a bit (binary digit). Eight bits are grouped together to form a larger storage unit called a byte . Each byte has a unique address for identi cation. Computer memory can thus be viewed as a series of bytes. Analogy: lockers are labeled with addresses and used for storage. 01000001 Address 0000 0001 0002 0003 byte 0004 ...... Memory ...... CSC 1500 { Lecture 1 bit 8 Programming Languages The job of a programmer is to design a complete and precise set of instructions for a computer to carry out a particular task. A programming language is a medium for programmers to express instructions to the computer. Do we need to write our programs in 0's and 1's?! Programmer Thanks to Compiler! x = 2 * y + 3; ans = sqrt(x); DIRTY THINGS! Human-Friendly Computer Program Machine Instructions MOV AX, DX INC ES JNZ BX Hardware 00011010110101000101 CSC 1500 { Lecture 1 9 High Level Programming Languages Basic, Fortran, Cobol, Pascal, Modula-2, Ada, C, Smalltalk, C++, Prolog, Lisp, Perl, Java, ... Compilation: Programs written in high level languages, say C, require the use of a compiler to translate them into machine executable codes. Microsoft Visual Studio, Borland C++ Builder, gcc, ... High Level Language Compiler Machine Language Data Input Computer Result Output 2 End of Lecture 1 CSC 1500 { Lecture 1 10 ...
View Full Document

This note was uploaded on 05/23/2010 for the course COMPUTER S CSC1500 taught by Professor Fung during the Spring '10 term at CUHK.

Ask a homework question - tutors are online