Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: Overview of a computer system

Similar presentations


Presentation on theme: "Chapter 1: Overview of a computer system"— Presentation transcript:

1 Chapter 1: Overview of a computer system
CSC118 Fundamental of Algorithm Development Zanariah Idrus Senior Lecturer|Computer Science Department|UiTM Kedah

2 What is computer? Is an electronic device, operating under the control of instructions stored in its own memory, that can accept data, process the data according to specified rules, produce results, and store the results for the future use.

3

4 What is computer?

5 What is computer? Data vs Information??

6

7 The components of a computer
Known as hardware. These component include: Input Devices Output Devices System Unit Storage Devices Communications Devices

8 Input Output Devices Input device – allows to enter data and instructions into a computer. Output devices – conveys information to one or more people

9 System Unit contains electronics components of the computer that are used to process data. Motherboard is a circuit board that contains circuitry of a system unit 2 main component on the motherboard – processor and memory

10 Storage Devices records (writes) and/or retrieves (reads) items to and from storage media. Often function as a source of input because transfer items from storage to memory.

11 Communication Devices
enables computer to send (transmit) and retrieve data, instructions and information to and from one or more computers.

12 Excercise 1: Match with correct device
Portable media player speakers scanner printer CD/DVD drive mouse External Hard disk Web cam monitor Memory card Digital camera keyboard microphone modem USB flash drive Hard disk drive Card reader/ writer

13 Computer Software System Software Application Software
Also called a program, is a series of instructions that tells the computer what to do and how to do. With a graphical user interface (GUI), we can interact with the software using text, graphics and visual images such as icons. 2 categories of software:- System Software Application Software

14 Computer Software

15 System Software consists of programs that control or maintain the operations of the computer and its devices. Provides the services between the user, the application software and the computer’s hardware. 2 types: Operating system. Utility program

16 System Software Operating system – set of a programs that coordinates all the activities among computer hardware devices. Example Windows Vista, Windows XP and Mac OS X.

17 System Software Utility program – allows a user to perform maintenance-type tasks usually related to managing a computer, its devices, or its programs. For example utility programs to transfer digital photos to a CD or DVD. Examples of utility programs : File viewer Backup utility File compression Disk scanner Disk defragment Uninstaller Antivirus utility Screen saver

18 Application Software Consists of programs designed to make users more productive and/or assist them with personal tasks. A widely used is a Web browser. Other popular includes word processing software, spreadsheet software, database software and presentation graphics software.

19 Find the category of software
Microsoft PowerPoint Windows Media Player Facebook Windows Ms Excel Exercise 2: Find the category of software Anti virus software Printers installer Paint program

20 Categories of Computers
Personal Computers (PC) fits on desk Mobile Computers and Mobile Devices Fits on lap or in hand Game Consoles Small box or handheld device Servers Small cabinet Mainframes Partial room to a full room of equipment Supercomputers Full room of equipment Embedded Computers Miniature

21 Categories of Computers

22 Categories of Computers

23 Exercise 3: Name the correct categories of computers
laptop Smart Phone PDA Desktop Notebook Tablet PC Handheld computer Sony’s PS 3 Nuclear Energy research Online banking UiTM network Exercise 3: Name the correct categories of computers

24 Memory Types of Memory Volatile Non-volatile
Data/information lose when power is turn off. Temporary means for holding data, instruction or information currently being processed. Volatile Example: 1. Random Access Memory (RAM) - Consist of memory chips that can be read from and write to by the processor and other devices. The processor (CPU) interprets and executes a program’s instructions while the program is in RAM. 2. Cache – Sit between RAM and processor. Cache speeds up processing time because it stores frequently used instructions and data. Memory The contents of memory retained although the computer’s power is turned off. Permanent means to hold data, instruction, information that is currently being processed. Non-volatile Example: 1. Read Only Memory (ROM) - data on most ROM chips cannot be modified. 2. Flash Memory - Can be erased electronically and rewritten. 3. CMOS (complementary metal-oxide semiconductor) - store a computer’s startup information such as calendar, date and time.

25 Byte and Addressable Memory
A byte (character) is the basic storage unit in memory. When application program instructions and data are transferred to memory from storage devices, the instruction and data exist as bytes. Each byte resides temporarily in a location in memory that has an address. An address simply is a unique number that identifies the location of the byte in memory. To access data or instruction in memory, the computer references the address that contains byte of data. Each byte stored in unique location called an address, similar to seats in a concert hall.

26 Memory Size 1 byte = 8 bits = 1 character
Term Abbreviation Approximately Number of Bytes Exact Amount of Bytes Approximate Number of Pages of Text Kilobyte KB or K 1 thousand 1, 024 Megabyte MB 1 million 1,048,576 500 Gigabyte GB 1 billion 1,073,741,824 500,000 Terabyte TB I trillion 1,099,511,627,776 500,000,000 1 byte = 8 bits = 1 character To simplify memory and storage definitions, computer users often round a kilobyte down to 1,000. For example if a memory chip can store 100 KB, it can hold approximately 100,000 bytes (characters).

27 Memory Access Time Access time is the amount of time the processor to read data, instructions, and information from memory

28 Storage Device Two storage types ; Primary storage (main memory)
The content of main memory is temporary RAM, ROM Secondary storage (storage device) the storage device is a place to hold data, instructions, and information permanently for future use. hard-disk, floppy disk, pen-drive, CDs, DVDs

29 Computer Hardware Block Diagram
The diagram shows the interrelationship among the major components of a computer. ( ) indicates the movement of data from one component to another ( - ->) indicates the control flow, which contol unit controls all the processes and components

30 Peopleware A term first coined by Peter G. Neuman in 1977
peopleware refers to the role people play in technology and the development of hardware or software. It can include various aspects of the process such as human interaction, programming, productivity, teamwork, and other factors. source:

31 Peopleware People involved in computer environment are information technology (IT) professionals and computer’s user or known as end- user. IT professionals are those who work in computer field. They may be system analyst, programmer, hardware engineers, web designer and so on. A programmer is a person who writes a program. End-user is a person who uses a computer to do their job. For example, bank clients are end-user for auto teller machine. A counter clerk in supermarket is an end-user for point-of-sales system.

32 Components of Processor
Processor contain a control unit and an arithmetic logic unit (ALU). These two components work together to perform processing operations. Control Unit Arithmetic Logic Unit Directs and coordinates most of the operations in the computer. Performs arithmetic, comparison and other operations. Interprets each instruction issued by a program and then initiates the appropriate action to carry out the instruction. Arithmetic operations include basic calculations such as addition, subtraction, multiplication, and division. Comparison operations involve comparing one data item with another to determine whether the first item is greater than, equal to, or less than the other item. Depending on the result of the comparison, different actions may occur.

33 What is a Machine Cycle? Four operations of the CPU comprise a machine cycle Step 1. Fetch Obtain program instruction or data item from memory Processor Control Unit Memory ALU Step 2. Decode Translate instruction into commands Step 4. Store Write result to memory Step 3. Execute Carry out command

34 How do computers represent data?
Data Representation How do computers represent data? Most computers are digital Recognize only two discrete states: on or off Use a binary system to recognize two states Use Number system with two unique digits: 0 and 1, called bits (short for binary digits)

35 Data Representation What is a byte?
Eight bits grouped together as a unit Provides enough different combinations of 0s and 1s to represent 256 individual characters Numbers Uppercase and lowercase letters Punctuation marks

36 Data Representation What are two popular coding systems to represent data? ASCII—American Standard Code for Information Interchange EBCDIC—Extended Binary Coded Decimal Interchange Code ASCII Symbol EBCDIC

37 How is a letter converted to binary form and back?
Data Representation How is a letter converted to binary form and back? Step 1. The user presses the capital letter T (SHIFT+T key) on the keyboard. Step 2. An electronic signal for the capital letter T is sent to the system unit. Step 4. After processing, the binary code for the capital letter T is converted to an image, and displayed on the output device. T Step 3. The system unit converts the scan code for the capital letter T to its ASCII binary code ( ) and stores it in memory for processing.

38 Computer Program and Programming
What is a computer program? Computer program or program is a set of instructions that tells the computer what to do. You must remember that a computer is only a machine and it will not do anything until it is given instructions. What is programming languages? Programming languages is a specific computer language used to write an instruction (program) for the computer (machine). What or who is a programmer? Programmer is a person who writes and modifies a computer program using programming languages. What are the types of programming languages? There are two (2) types of programming languages which are: 1. Low-Level Programming Languages 2. High-Level Programming Languages

39 Low-Level Programming Languages
Machine Language (1GL) Assembly Language (2GL) Is the only language that computer can directly understand. Uses a series of binary digits (1s and 0s) with a combination of numbers and letters that represent binary digits. Example… Low-Level Instructions made up of symbolic instruction codes, meaningful abbreviations and codes. Source program contains code to be converted to machine language Uses assembler to translate to machine code Example….

40 Machine Language

41 Assembly Language

42 High-Level Programming Language
Procedural Language (3GL) High-Level Programming Language Visual Programming Language (5GL) Object-Oriented Programming Language Non-Procedural Language (4GL)

43 Procedural Language Uses series of English-like words to write instructions. Most widely used are BASIC, COBOL, and C. Uses compiler to translate to machine code.

44 Object-Oriented Programming Language (OOP)
What is an object-oriented programming (OOP) language? Used to implement object-oriented design Major benefit is ability to reuse existing objects Event-driven—checks for and responds to set of events Java, C++, C#, and Visual Basic are complete object-oriented languages Object is item that contains data and procedures that act on data Event is action to which program responds

45 Example Of Java Language (OOP)

46 Example of C++ //This program displays a status based on the mark
#include <iostream.h> #include <conio.h> void main() { int mark; cout << “Enter the mark : ”; cin >> mark; if (mark>=50) cout << “PASSED” <<endl; getch(); }

47 Non-Procedural Language
Nonprocedural language that allows access to data in database Popular 4GL is SQL, query language that allows users to manage data in relational DBMS

48 Visual Programming Languages
Provides visual or graphical interface for creating source code Often used in RAD (rapid application Development)environment Available in Visual Studio 2005, Delphi and PowerBuilder

49 Other Available Programming Languages
ADA ALGOL APL BASIC FORTH FORTRAN HYPERTALK LISP LOGO MODULA-2 PASCAL PILOT PL/1 PROLOG SMALLTALK Main Menu

50 Elements of Computer Program
Identifiers: Variable, Constant (ie: x, y, z, sum, var, temp) 2. Data Types: int, float, char (ie: int x, float y, char name) 3. Statement: cout (ie: cout<<“Key in number ”), cin (ie: cin>>number) 4.1. Assignment (ie:sum=x+y, x=y, sum=0) 4.2. Expression: Arithmetic (ie: x+y), Logical (ie: x && y), Relational (ie: x<y) Control Structure – -Sequential -Conditional (if, switch case) -Repetition/Iteration (while do, do while, for)

51 Sample Program /* This is a program that computes the sum of two integer numbers */ #include <iostream.h> //Preprocessor to handle cout and cin statement #include <conio.h> //Preprocessor to handle screen void main() //This is directive { int x, y, sum; //Declaration cout << “\nEnter first number: “; //This a prompt cin >> x; //Input from console cout << “ \nEnter second number: “; cin >> y; sum = x + y; //Adding x and y cout << “\nSum = “ << sum; //Output to console getch(); //function to handle screen } Identifier (Variable: x, y,sum) Data Type (int) Statement (cin, cout) Expression (x+y) Assignment (sum = x+y) Main Menu

52 The Importance of Programming
Easy to express task from particular problem domain Allow user to instruct computer to do specific task in a certain instances A skill required for a computer scientist and software engineer A skill required to create a successful computer program (software) An activity that is closer to computer science Improve reasoning and critical thinking

53 Good Programming Styles
Spacing – each instruction begin with new line Indent – each instruction has indention depends on it structure Comment – help a human reader to understand the program Variable name – use descriptive name Rules of naming the variable: Other than reserved word (do not use char, int, float, double, long, String etc..) Alphanumeric A-Z, a-z, 0-9, - (underscore) but do not use number (0-9) as variable. Length recommended 3-8 characters

54 Spacing Each instruction should begin with new line(s) //Good //Good
main() { curYear = 2004; cout << "Please enter year born: "; cin >> yearBorn; age = curYear - yearBorn; cout << "Your age is " << age; } //Bad //Bad main(){curYear = 2004;cout << "Please enter year born: ";cin >> yearBorn;age;}

55 Indent //Good //Bad //Bad main() {
//Good main() { cout << "Please enter year born: "; cin >> yearBorn; age = curYear - yearBorn; cout << "Your age is " << age; } //Bad //Bad main() { cout << "Please enter year born: "; cin >> yearBorn; age = curYear - yearBorn; cout << "Your age is " << age; }

56 Comment //This program calculates age main() { //input year born cout << "Please enter year born: "; cin >> yearBorn; age = curYear - yearBorn; //calculate age cout << "Your age is " << age; //output age to console }

57 Meaningful Variable Name
//Good //Good main() { curYear = 2004; cout << "Please enter year born: "; cin >> yearBorn; age = curYear - yearBorn; cout << "Your age is " << age; } //Bad //Bad main() { number2 = 2004; cout << "Please enter year born: "; cin >> number1; number3 = number2 – number1; cout << "Your age is " << number3; }

58 What is a Good Programming Style?
A good program is a program that is easy to read and easy to be understood by other programmers…

59 More Example /* This program is to compute the sum of two integer
numbers */ #include <iostream.h> //Preprocessor to handle cout and cin statement #include <conio.h> //Preprocessor to handle screen, getch() void main() //This is directive { int x, y, sum; //Declaration cout << “\nEnter first number: “; //This a prompt cin >> x; //Input from console cout << “ \nEnter second number: “; cin >> y; sum = x + y; //Adding x and y cout << “\nSum = “ << sum; //Output to console getch(); //function to handle screen } Comment Preprocessor Directive Function name Begin Block Function Body End Block Semicolon = delimiter . Use to end of statement or line.

60 Comments Comment is used to explain the function of the program or statement in order to help them or others read and understand the programs or statement. Use two different punctuation marks Begin with /* and end with */ - use if the comments runs more than one line. // - use if takes a line or less Anything placed after the // or inside /* */ are considered comments and will not be executed by the computer.

61 Relationship Between Compiler, Interpreter And Program
What are the compiler and interpreter? Compiler and interpreter are the program called language translator that accept human-readable source statement (code) and produces machine-readable instruction. Assembler is also language translator.

62 Relationship Between Compilers, Interpreters And Programs
Language Translator Interpreters Compilers Program that translates one program code (high level language) statement into machine language and executes one at a time. Does not produce object code (object program). Program is easier to develop. i.e. BASIC. Program that converts entire source program (high level language) into machine language before executing it. Translate the source code once and saves to be reused. Requires less memory and runs faster. i.e. PASCAL, C++, COBOL Assemblers A program that translates the assembly language program into machine language. i.e. MASM

63 A Brief History of Programming Languages (C++)
C++ (OOP) is built upon the foundation of C (structured programming language). C++ is a superset of C and C++ compilers can be used to compile C programs. C++ is an expanded and enhanced version of C that embodies the philosophy of object-oriented programming. C was invented and first implemented by Dennis Ritchie in 1970s, while C++ invented by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill. The reason for invention of C++ is to cater the increases of complexity in computer problem solving or programming. Main Menu


Download ppt "Chapter 1: Overview of a computer system"

Similar presentations


Ads by Google