Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hardware and Software Programming. COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming.

Similar presentations


Presentation on theme: "Hardware and Software Programming. COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming."— Presentation transcript:

1 Hardware and Software Programming

2 COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming (software) class? n software “drives” hardware n having some understanding on h/w helps us produce more efficient programs

3 COMP104 Lecture 2 / Slide 3 l Four components of a computer system: n CPU - central processing unit –Makes decisions, performs computations, and delegates input/output requests n Memory –Stores information n Input devices –Gets information from the user to the computer n Output devices –Sends information from computer to the user Hardware

4 COMP104 Lecture 2 / Slide 4 Hardware Primary and Secondary

5 COMP104 Lecture 2 / Slide 5 CPU l Core component of the computer n Arithmetic/Logical Unit (ALU) –performs arithmetic operations n Control Unit –decodes and executes instructions Data and instructions are encoded in the binary number system 0110 1101 1100 1111 0001 l CPU Examples n Pentium n Pentium Pro

6 COMP104 Lecture 2 / Slide 6 Input and Output Devices l Accessories that allow computer to interface with user l Common input and output devices SpeakersMouse Scanner PrinterJoystickCD-ROM KeyboardMicrophone

7 COMP104 Lecture 2 / Slide 7 Memory l Secondary Memory n relatively stable storage (e.g. CD) n slower retrieval time n often allows sequential access only l Primary Memory n main memory in a computer n aka random access memory, or RAM n faster (random) access with –transistor technology –address location

8 COMP104 Lecture 2 / Slide 8 Memory double distance; double time; double speed; speed = 27.3; time = 4.8; distance = speed * time; 1000 1008 1016 1024 1032 27.3 4.8 131.04 <- distance <- time <- speed RAM in computer Program

9 COMP104 Lecture 2 / Slide 9 What is so “Random”? char grade[] = { ‘B’,’D’,’C’, ’E’,’D’,’A’}; char student_grade; student_grade = grade[3]; 255 256 257 258 259 260 <- grade[0]B D C E D A 1024<- student_gradeE + RAM in computer program

10 COMP104 Lecture 2 / Slide 10 l Application software n Programs designed to perform specific tasks and are easy to use l System software n Programs that support the execution and development of other programs n Two major types –Operating systems –Translation systems (compilers & linkers) Software

11 COMP104 Lecture 2 / Slide 11 Application Software l Application software has made using computers easy and popular l Common application software: Microsoft Word, WordPerfect PowerPoint Netscape, IE PhotoShop, Photo-Paint Quick Time

12 COMP104 Lecture 2 / Slide 12 l Controls and manages the computing resources l Examples n MSDOS, Windows, Unix l Important services that an operating system provides: n File system n Memory management n Commands to manipulate the file system n Input and output on a variety of devices n Window management Operating System

13 COMP104 Lecture 2 / Slide 13 Translation System l Set of programs used to develop software l Types of translators: Compiler Linker l Examples n Microsoft Visual C++, Borland C++, g++

14 COMP104 Lecture 2 / Slide 14 Software Development l Major activities Editing (to write the program) Compiling (creates.obj file) Linking with compiled files (creates.exe file) –Object files –Library modules Loading and executing Testing the program

15 COMP104 Lecture 2 / Slide 15 Integrated Development Environments l Combine all of the capabilities that a programmer would want while developing software (VC++) Editor Compiler Linker Loader Debugger Viewer

16 COMP104 Lecture 2 / Slide 16 Our First Program // a simple program #include use namespace std; int main() { cout << "Hello world!" << endl; return 0; } Preprocessor statements Print statement Ends execution of main() which ends program Comments Function Function named main() indicates start of program

17 COMP104 Lecture 2 / Slide 17 Summary


Download ppt "Hardware and Software Programming. COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming."

Similar presentations


Ads by Google