690 likes | 1.95k Views
Chapter 1: Introduction to Computer and Programming. Computers and definition Computer hardware components CPU, I/O devices, data storage, memory Computer software components Operating system, compilers, applications Programming languages How things fit together.
E N D
Chapter 1: Introduction to Computer and Programming • Computers and definition • Computer hardware components • CPU, I/O devices, data storage, memory • Computer software components • Operating system, compilers, applications • Programming languages • How things fit together
Chapter 1: Introduction to Computer and Programming • Computer • An electronic device that accept input and store a set of instructions which perform a task and produce outputs • . • Special-Purpose vs General-Purpose Computers • SP : Executing same stored set of instruction every time • GP : Solving many different types of problems • Program : a set of instructionthat perform a specific task.
Chapter 1: Introduction to Computer and Programming • General-Purpose Computers • 1. Microcomputers • a. Laptop computers • b. Desktop computers • c. Workstations • 2. Minicomputers • can handle up to 4000 connected users and accessed through dumb terminal • 3. Mainframe computers • can handle bigger number of users and also accessed through dumb terminal • 4. Supercomputers • can perform more than 64 million instructions per second
Chapter 1: Introduction to Computer and Programming • Computing Modes • 1. Standalone computing • data need to be transported through diskette to share information. • 2. Multiprogramming and Timesharing • many programs simultaneously executed is called multiprog. • timesharing is a single computer system is accesses by many users through terminal • 3. Distributed computing • machines being linked over telephones or in local area network and computing load being strictly performed at some central. • 4. Client/server computing • information is easily shared and accessed by clients across network where data being handled by file servers.
Computer Hardware Components Modem, ethernet card Network device Keyboard, mouse Monitor, printer Output device Input device CPU Storage device Main memory Hard disk, CD ROM drive RAM,ROM
CPU (Central Processing Unit) • Does most of the work in executing a program • The CPU inside a PC is usually the microprocessor • 3 main parts: • Control Unit • Fetch instructions from main memory and put them in the instruction register • ALU (Arithmetic Logic Unit) • Execute arithmetic operations • Registers • Temporarily store instructions or data fetched from memory
Main Memory • A semiconductor device which stores the information necessary for a program to run. • 2 types • ROM (Read Only Memory) • Contains information that is necessary for the computer to boot up • The information stays there permanently even when the computer is turned off. • RAM (Random Access Memory) • Contains instruction or data needed for a program to run • Got erased when the computer is turned off
Storage Device • A magnetic device used to store a large amount of information. • Store the software components or data needed for the computer to execute its tasks. • Could be “read only” or “writable”. • Example: Hard drive, CD rom, floppy disks
Input/Output Device • Input devices • Accepts information from the user and transform it to digital codes that the computer can process. • Example: keyboard, mouse, scanner • Output devices • An interface by which the computer convey the output to the user. • Example: monitor, printer
Network Device • Connect a computer to the other computers. • Enable the users to access data or execute programs remotely. • Example: modem, ethernet card
Computer Software Components • A software is a collection of program files which contain instructions that can be executed by a computer to complete a certain task. • Software can contain these files: • executable files • binary files which contain instruction or data • link files • binary files containing instruction or data which will be used together with the executable files • data files • binary or ASCII files containing data which can be processed by the executable files • files with special format
Software Categorization • Software can be categorized into: • System software • Operating system • System utility software • Application software • Off the shelf software - software that can be bought at stores • Customized software - software that are developed for a very specific task • Compilers and interpreters • Integrated package - all the components needed to create a computer program such as editor, compiler, linker and debugger are integrated in one package. • Stand-alone compiler
Operating Systems (OS) • A collection of computer programs which control and manage a computer system. • Among the jobs done by an OS are: • schedule the jobs to be processed by the CPU • manage the resources such as memory, I/O, data transfer etc. • There are 3 types of OS: • single user single task • ex: Dos • single user multitasking • ex: Windows 95 • multi-user multitasking • ex: Unix
Single user • The OS is only capable to execute request from one user • Multi-user • The OS is capable to execute requests from multiple users. This happens when multiple users can remotely log onto one computer. • Single task • Only one task or program can be run on the computer at any one time. • Multitasking • The OS is capable to execute multiple tasks at one time. Programs are loaded into the memory and the OS will schedule which of them should be executed.
Programming Languages • Machine code • The only language that the processor actually understand. • Consists of binary codes: 0 and 1 • Example: 00010101 11010001 01001100 • Each of the lines above corresponds to a specific task to be done by the processor. • Programming in machine code is difficult and slow since it is difficult to memorize all the instructions. Mistakes can happen very easily. • Processor dependent
Assembly language • Enable machine code to be represented in words and numbers. • Example of a program in assemble language: LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A LOAD C, #0002 DIV A, C STORE A, 7002 • Each instruction corresponds to a specific machine code. • Easier to understand compared to machine code but still is quite difficult to use. • Processor dependent
High level language • Use more English words and numbers. Therefore, it is easier to understand. • The programming structure is problem oriented - does not need to know how the computer actually execute the instructions. • Processor independent - the same code can be run on different processors. • Example: Basic, Fortran, Pascal, Cobol, C, C++, Java • A high level language needs to be analyzed by the compiler and then compiled into machine code so that it can be executed by the processor.
C Programming Language • Developed by Dennis Ritchie at Bell Laboratories in 1972 based upon the B programming language. • It was then used widely in Unix systems. • The C Languagespread like ‘wild fire’, over various hardware platforms, all over the IT world, to such an extend that variations and incompatibilities started creeping up. • Therefore there was a need for a standard code so that any programs written in C can be compiled by any compilers. • In 1983, the X3J11 Technical Committeecame up with the draft proposal for the ANSI system, which was approved in 1989 and referred to as theANSI/ISO 9899 : 1990 or simply the ANSI C, which is now the global solution.
How does it all fit together? Output device C Code Compiler & Linker Processor Binary code Hard drive Software side (done when we compile the program) Hardware side (realtime)