6. 6
What Is a Computer?
Computer
Performs computations and makes logical decisions
Millions / billions times faster than human beings
Computer programs
Sets of instructions by which a computer processes data
Hardware
Physical devices of computer system
Software
Programs that run on computers
7. 7
Computer Organization
Six logical units of computer system
Input unit
Mouse, keyboard
Output unit
Printer, monitor, audio speakers
Memory unit
Retains input and processed information
Arithmetic and logic unit (ALU)
Performs calculations
Central processing unit (CPU)
Supervises operation of other devices
Secondary storage unit
Hard drives, floppy drives
8. Evolution of Operating Systems
Batch processing
One job (task) at a time
Operating systems developed
8
Programs to make computers more convenient to use
Switch jobs easier
Multiprogramming
“Simultaneous” jobs
Timesharing operating systems
2003 Prentice Hall, Inc. All rights reserved.
9. The boot process
The process by which a machine comes up from rest
state to the state that is usable is known as booting
When the power is turned on
The CPU runs the BIOS (Basic Input / Output System)
Usually located on a chip on the motherboard
Runs POST (Power On Self Test) of various hardware components
Loads the boot sector program
9
10. The boot process (continued)
Boot Sector Program
Located in the first sector of the hard disk or other disk
Is responsible for loading the rest of the operation system into the RAM
Operating System
Once it is loaded, it configures the various hardware components
Then it waits for the user to issue commands
Then you can run your applications
10
11. Introduction to Programming Language
Programming Language use to create/develop a program
application or other set of instructions to control the behavior
of a machine.
Example:
C/C++
Java
Pascal
Cobol
12. Programming Language
Classification
High Level
Core (compiled): Java, C++, Pascal, Fortran, Basic
Script (non-compiled): bash,tcsh,perl,python,ruby,..etc
Middle Level
C
Low Level
Assembly
15. Programming Phase
Problem Definition
Problem Analysis
Algorithm Design
Coding & Debugging
16. Problem Definition
Problem must be well & clearly defined
Clearly defined problem = ½ solution
Example:
– “Create a program that will determine the number of times a
name occurs in a list”
17. Problem Analysis
Solution of the problem must be formulated
Example Problem:
“Create a program that will determine the number of times a name
occurs in a list”
Input to the program
– List of names, name to look for
Output to the program
– The number of times the name occurs in a list
18. Algorithm Design
Express our solution to step-by-step manner
The way of Express:
– Human Language
– Flow chart
– Pseudocode
19. Algorithm Design
- Human Language -
Get the list name of names
Get the name to look for, let's call this the keyname
Compare the keyname to each of the names in the list
If the keyname is the same with a name in the list, add 1 to the
count
If all the names have been compared, output the result.
20. Algorithm Design
- Pseudocode -
Let nameList = List of Names
Let keyName = the name to be sought
Let Count = 0
For each name in NameList do the following
If name == keyName
Count = Count + 1
Display Count
21. Algorithm Design
- Flowchart -
Start
Get
NameList
Get
KeyName
Count = 0
More
Names ? Name = KeyName?
Count = Count + 1
A
A
Display
Count
Stop
No
Yes
Yes
22. Coding & Debugging
Coding:
– Create a source code based on Algorithm
Debugging:
– Fixed the error found in source code
Compile-Time Error
– If there is a syntax error
23. Exercise
Writing an algorithm
Cooking an Instant Noodle
Getting the average of three numbers