บทนำสู่คอมพิวเตอร์
Outline Computer Concepts Computer Components Software OS How to write a program? Program development
Computer Concepts Computers –Universal Computational Devices Given enough time and memory, all computers are capable of computing exactly the same things (irrespective of speed, size or cost).- Turing’s Thesis –Level Categorization Machine Architecture Devices Circuits Program/Software Algorithm Application Software OS
Devices Each Mother board is composed by Hundreds of ICs (Integrated Circuits). Each IC could composed by millions of transistors. A CPU is also composed by millions of transistors. What is a transistor? VIA pc3500 Mainboard
Devices - Transistors Similar to a light switch Opened/Closed status depends on voltage provided Open switch: no current flows Closed switch: current flows
Devices - Transistors Symbolic Transistors (CMOS) A B G N Closed if gate is “on” Open if gate is “off” P Open if gate is “on” Closed if gate is “off” A B G
Devices - Transistors An OR Gate built from transistors D A B C OR gate c is 1 if either a or b is 1 a b c
Logic Circuits Adder Logic Circuits built by logic gates
Computer Architecture Composed by CPU (Central Processing Unit), Memory, and I/O. These three are connected by buses. When computing, data are fetched from memory to CPU. CPUMain Memory I/O buses
Computer Architecture - CPU Composed by ALU (Arithmetic & Logic Unit) and CU (Control Unit) ALU – computing CU – sequence control CPU Main Memory I/O buses ALU CU
Computer Architecture – Main Memory 2-based numbers, each called bit. 8 bits = 1 byte 1 kilobyte = 1024 bytes 1 megabyte = 1024 x 1024 bytes 1 gigabyte = 1024 x 1024 x 1024 bytes 1 terabyte = 1024 x 1024 x 1024 x 1024 bytes CPU Main Memory I/O buses byte
Computer Architecture – I/O Input/Output Devices E.g. hard disk, CD/DVD reader, modem, wireless card, keyboard, mouse, etc. CPUMain Memory I/O buses
OS OS - Operating System What are OSs? –Programs that work between computer hardware and application programs. –[Computer] Resources Manager Resources including: CPU time, memory, I/O devices
Application Software A Sequence bits of command E.g. if we want to calculate the average value, we need to put the commands: then which change the following bits (0, 0), (1, 2), (2, 2), (3,4) from 1 to 0, then change (1, 1) and (1, 3) from 0 to 1, then…. We call such the sequence as a program/software. Main Memory Instruction zone Data zone
How can we write a program? Machine Code Assembly ORG MOV A, #1 ADDA R
How can we write a program? High-level Language csum=0; for i=1:10 a(i)=input('Enter a data entry:'); csum=csum+a(i); end avg=csum/10;
Program Development Problem Formulation Input/Output Algorithm Development Implementation Analysis & Testing Requirement Specification Design Coding Debugging Installation Maintenance
Communicate with other programmers? Flow chart g==ng>n return display ‘Less than this.’display ‘Greater than this.’ display ‘You got it.’
Communicate with other programmers? Pseudo code Algorithm arrayMax(A, n) Input array A of n integers Output maximum element of A currentMax A[0] for i 1 to n 1 do if A[i] currentMax then currentMax A[i] return currentMax Example: find max element of an array