Upload
adelia-spencer
View
217
Download
0
Embed Size (px)
Citation preview
School of Computer Science & Information Technology
School of Computer Science & Information Technology
G6DICPG6DICPIntroduction to Computer Introduction to Computer
ProgrammingProgramming
Milena RadenkovicMilena Radenkovic
2
DefinitionsDefinitions ComputerComputer
Machine that processes data to produce a desired result Machine that processes data to produce a desired result (output).(output).
Very rapid execution of very simple instructions.Very rapid execution of very simple instructions.
Computer programComputer program The instructions required to achieve a desired end The instructions required to achieve a desired end
result.result.
3
Computer HardwareComputer Hardware
The physical components of a computerThe physical components of a computer Electronic, Magnetic or MechanicalElectronic, Magnetic or Mechanical
System - a set of hardware devices connected to System - a set of hardware devices connected to make a functional computer.make a functional computer.
Computers are a set of switchesComputers are a set of switches MechanicalMechanical
Electro-mechanicalElectro-mechanical
Electronic (transistors)Electronic (transistors)
Integrated CircuitsIntegrated Circuits
4
Binary EncodingBinary Encoding Binary is base 2Binary is base 2 Switches can easily encode binary data Switches can easily encode binary data
eg on=1, off=0eg on=1, off=0
Binary CountingBinary Counting
Decimal Binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000
5
Bits & BytesBits & Bytes
1 binary digit is a bit1 binary digit is a bit Bits are physically arranged in groups of 8 called Bits are physically arranged in groups of 8 called
Bytes Bytes This is the basic unit of computer memory.This is the basic unit of computer memory.
0 0 0 10 0 0 0
1 0 0 00 0 0 0
0 0 0 01 0 0 0
1 1 1 11 1 1 1
1
8
128
255
6
Bits & Bytes (cont.)Bits & Bytes (cont.)
One byte can encode an integer One byte can encode an integer from 0-255from 0-255
1024 Bytes = 1 Kilobyte1024 Bytes = 1 Kilobyte 1024 Kilobytes = 1 Megabyte1024 Kilobytes = 1 Megabyte
0 0 0 10 0 0 0
1 0 0 00 0 0 0
0 0 0 01 0 0 0
1 1 1 11 1 1 1
1
8
128
255
7
Hardware ComponentsHardware Components
Central Processing Unit (CPU)Central Processing Unit (CPU) Memory (RAM)Memory (RAM)
Random AccessRandom Access
VolatileVolatile
Data stoarage devicesData stoarage devices Hard disk, floppy disk, tape, Hard disk, floppy disk, tape,
CD-ROM etc.CD-ROM etc.
Input devicesInput devices Keyboard, mouse, etc.Keyboard, mouse, etc.
Output devicesOutput devices Monitor, printer, speakers etc.Monitor, printer, speakers etc.
8
Hardware SystemHardware System
RAM
CPU
Storage
Input Device Output Device
9
Computer ProgramComputer Program
Set of instructions for CPUSet of instructions for CPU "Switch Settings""Switch Settings"
Machine languageMachine language
Assembly languageAssembly language Mmnemonics representing binary codeMmnemonics representing binary code
AssemblerAssembler
3rd Generation Languages3rd Generation Languages "High Level""High Level"
Compiled or InterpretedCompiled or Interpreted
10
High Level Languages (3GL)High Level Languages (3GL)ExamplesExamples
FORTRANFORTRAN
COBOLCOBOL
PascalPascal
CC
C++C++
JavaJava
11
Interpreted LanguageInterpreted Language
Source Code
Interpreter
Machine Code
Storage
CPU/memory
Program Execution
12
Compiled LanguageCompiled Language
Source Code
Compiler
Storage
CPU/memory
Machine Code(executable binaries)
Program Execution
13
Interpreted vs CompiledInterpreted vs Compiled
InterpretedInterpreted
Easy to develop Easy to develop (can be modified and executed in (can be modified and executed in one stage).one stage).
Distribution requirementsDistribution requirements(distribution of interpreter may be (distribution of interpreter may be cumbersome and/or expensive).cumbersome and/or expensive).
Machine code generated at Machine code generated at runtime - processing runtime - processing overhead.overhead.
CompiledCompiled
Development more cumbersomeDevelopment more cumbersome (compilation required when modified)(compilation required when modified)
Easy to distribute Easy to distribute (ie machine code is distributed)(ie machine code is distributed)
Machine code generated at Machine code generated at compile time - much more compile time - much more efficient.efficient.
14
Layers of SoftwareLayers of Software
Hardware
Operating System
Application eg Word, Excel, Netscape etc.
eg Windows, Unix, MacOS etc.
eg PC, Macintosh etc.
15
Operating SystemOperating System Provide basic services that access hardwareProvide basic services that access hardware
Input and DisplayInput and Display
i/o - eg disk filing system, communications etci/o - eg disk filing system, communications etc
User administration, security etcUser administration, security etc
Provide user interfaceProvide user interface Provide programmers with an API Provide programmers with an API
(Application Programming Interface)(Application Programming Interface)
Examples:Examples: MS Windows 95/98/MEMS Windows 95/98/ME MS Windows NT/2000/XPMS Windows NT/2000/XP Macintosh OS XMacintosh OS X Linux (Unix)Linux (Unix) Solaris (Unix)Solaris (Unix)