84
M150 – UNIT 6 DATA, COMPUTING AND INFORMATI 1 H a i f a a E l a y y a n

M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

Embed Size (px)

Citation preview

Page 1: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

M150 – UNIT 6DATA, COMPUTING AND

INFORMATI1

Haifa

a E

layyan

Page 2: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

2UNIT 6: FIVE THEMES

Unit 6 sets the scene by providing you with some useful background

about the components of the computer that are involved when a

program is run, and some of the structures that programs employ.

Distinguishing: Computer as a system that is made up of Software,

Hardware and Firmware.

Describing: Functions of different components of a computer

( memory, OS, mother board, etc….).

Collaborating: Different computer components to process a computer

program.

Understanding: How computer understand our commands???!!!.

Introducing: The mechanism of how the software is going to skip or

repeat a sequence of instructions

Page 3: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

EARLY COMPUTING MACHINES AND THEIR INVENTORS

From the time that numbers were invented humans have invented devices to help in manipulating them. The abacus, of which the oldest surviving example dates from 300 , is still used today. The Roman abacus, in use between the second and fifth centuries consisted of beads strung on a number of wires and the Roman word for the beads used, calculus, give us the modern word ‘calculator

3

Haifa

a E

layyan

Page 4: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

EARLY COMPUTING MACHINES AND THEIR INVENTORS

The first mechanical calculating device, which used a system of cogs, was invented by William Schickard in 1623. Schickard, like the famous astronomer Kepler, was born in Wu¨rttemberg, Germany, and Kepler used Schickard’s machine for his astronomical calculations. Because the six-digit numbers manipulated by the machine were insufficient for Kepler’s needs, the device came with a number of rings, which the operator could add to his fingers in order to keep track of higher order digits! Figure 1.2

4

Haifa

a E

layyan

Page 5: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

In 1694 the German mathematician and philosopher, Gottfried Wilhelm von Leibniz improved the Pascaline by creating a machine that could also multiply, but it was not until 1820 that Charles Xavier Thomas de Colmar, a Frenchman, invented a machine that could perform the four basic arithmetic operations

5

Haifa

a E

layyan

EARLY COMPUTING MACHINES AND THEIR INVENTORS

Page 6: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

HARDWARE, SOFTWARE AND COMPUTER SYSTEMS we will discuss what hardware, software, and computer systems are.

Then we will focus on how computer hardware and software components work together to execute computer programs.

The aims of this section are to: explain that a computer program is a sequence of instructions fo

performing a certain task on a computer; explain that hardware consists of the tangible parts of the computer; show that hardware and software solutions can be logically

equivalent – that is, a task carried out on a computer using software might be

reproducible using hardware, and vice versa; describe the information system model of a computer; describe the nature of data and instructions as they are stored in a

computer; recount the history of some early computing machines.

6

Haifa

a E

layyan

Page 7: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

SOFTWARE VS. HARDWAREYou will be learning about both hardware and software so

it is helpful to consider the relationship between them. Hardware consists of the tangible parts of the

computer system – ‘the parts that can be kicked’. Examples of hardware include the electronic circuits inside the casing, the keyboard and hard disk.

Software, on the other hand, is more abstract – it consists of sets of instructions that tell a computer how to perform a particular task. Examples of software are word-processor applications such as Microsoft Word, browsers such as Explorer or Netscape, and communications software such as FirstClass. The terms software and computer program are often used synonymously, though it could be argued that software is generally made up of a number of programs

7

Haifa

a E

layyan

Page 8: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

CONTINUE Although software and hardware are very different in nature,

they are also inextricably related. Any instruction performed by software can also be built directly into hardware, and instructions executed by hardware can often be simulated in software. As an illustration let us consider the multiplication of two numbers. One way of thinking about multiplication is to consider it as a number of additions: starting with nothing (zero) you need to add a particular number (one of the numbers to be multiplied) a specified number of times (the second number to be multiplied). For example, to multiply 3 by 4, we need to add 3 to 0, then add 3 to the result, and so on, until we have added 3 four times, as follows:

0 + 3 gives a result of 3 (first addition) 3 + 3 gives a result of 6 (second addition) 6 + 3 gives a result of 9 (third addition) 9 + 3 gives a result of 12 (fourth addition)

8

Haifa

a E

layyan

Page 9: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

CONTINUE

Now suppose that a computer has hardware (i.e. an electronic circuit) to carry out a simple arithmetic instruction such as ADD. Since multiplication is nothing more than repeated addition, we could construct a new circuit (or piece of hardware) made up of a number of ADD circuits that, working together, can multiply two numbers. Alternatively we could instruct the computer, using a computer program, to perform repeated addition using the existing ADD circuit .

The hardware and software solutions are logically equivalent – they both use repeated addition – but the hardware solution uses several ‘tangible’ electronic circuits, whereas the software solution uses the more abstract idea of ‘instructing’ the machine to use the same circuit repeatedly. The decision to implement some functions in hardware and others in software is based on factors such as speed, cost and reliability. You will learn how to write your own software (computer programs) in Units 7 to 10. 9

9

Haifa

a E

layyan

Page 10: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

10

UNIT 6: AGENDA

Hardware, Software and Computer system

The resources of a computer , and how they are managed.

Running a program.

Types of programming languages.

The structure of computer programs.

Page 11: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

11

UNIT 6: HARDWARE, SOFTWARE AND COMPUTER SYSTEM

Hardware vs. Software

Computer Hardware and Software components work together in order to execute computer program

Hardware: describes the physical parts of computer that can be touched.

Software: describes the information or the programming the computer uses, you can't touch it .

Firmware is the term used to refer to a sequence of instructions (software) etched into the read-only

memory (ROM) of the computer, usually to perform some system function. Because these

instructions are on a chip they form a permanent part of the computer and could be viewed as a

combination of hardware and software.

Page 12: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

12

UNIT 6: FIRMWARE a software program or set of instructions programmed

on a hardware device (usually in the ROM)

It provides the necessary instructions for how the device communicates with the other computer hardware

can be thought of as "semi-permanent" since it remains the same unless it is updated

Page 13: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

13

UNIT 6: EXAMPLE1"I bought a 100-pack of empty DVD discs and tried to burn a

video to a few of them but it would not work".

I contacted my DVD drive manufacturer and they suggested that I update the firmware on the DVD drive.

The updated Firmware had a new set of computer code for my drive instructing how to write to the DVD I’m using

Page 14: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

14

UNIT 6: HARDWARE VS. SOFTWARE Although Hardware and Software are different in

nature, there are related.

A solution to a computer problem can be implemented using either Hardware or Software.

Hardware uses several tangible electronic circuits.

Software uses instructions to use same circuits.

Page 15: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

15

UNIT 6: REFLECTION 1EX: 2.3

A book could be thought of as being made of paper and ink, or

it could be thought of as being a collection of words and sentences.

Which view is analogous to Software and which to Hardware?

Page 16: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

16

UNIT 6: COMPUTER AS A SYSTEM

The tutor asked us to define computer, after a discussion the result was a computer is a machine that Accepts input, Process Input then it gives a result as an Output.

So every machine that Accepts input, Processes that input, and produces Output is called a system

Perfect

Then my mother’s Washing machine is a system

Yes

Or

No

Page 17: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

17

UNIT 6: AGENDA Hardware, Software and Computer system

The resources of a computer, and how they are managed.

Running a program.

Types of programming languages.

The structure of computer programs.

Page 18: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

18

UNIT 6: REFLECTION 2EX:3.1

In what form are the data and Instructions stored in a computer?

Well, it is the easiest question so far , All data and instructions saved inside the computer ( in Memory) , read and accessed by CPU in order to execute these instructions are in Machine language ( 0/1) – Digital form .

Page 19: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

COMPUTER SYSTEM : One simple view of an information system is that it is a machine

that can solve problems by carrying out a sequence of instructions, usually on a given set of data. The data provided is usually referred to as input, and the solution (or results) produced is referred to as the output.

Our view is that a computer differs from a calculating device in that it includes a mechanism that stores not only the data but also the instructions for processing that data, and the results that are to be output. If we have a computer at the heart of our information system we can extend our model as

( Input --- ( Process/ Storage) -- Out put

This is what we call information system based on computer . The word ‘process’ has a very particular meaning in some areas of

computing. In this unit we are using it to refer to all the processing (or manipulation) of the input so as to produce the output.

So far , system is what ever accepts ( input) , process this input ( execute, compute ) accordingly by executing specific instructions , then produce result .

19

Haifa

a E

layyan

Page 20: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

ACTIVITY 2.2

Use two online dictionaries (they could be the ones mentioned in Activity 2.1, or any others) to look up the term ‘computer’. Compare the two definitions.

Discussion The whatis.techtarget.com website has the following definition: A computer is a device that accepts information (in the form of digital data) and

manipulates it for some result based on a program or sequence of instructions on how data is to be processed.

Complex computers also include the means for storing data (including the program, which is also a form of data) for some necessary duration. (accessed 11 July 2003)

The webopedia website defines a computer as: A programmable machine. The two principal characteristics of a computer are: It responds to a specific set of instructions in a well-defined manner. It can execute a prerecorded list of instructions (a program). The first definition emphasizes the digital nature of the data that is manipulated by the

program, and it also mentions the storage of instructions and data, but only for ‘complex’ computers. The second definition does not mention digital data or storage, but it requires that the computer must respond to the instructions in a well-defined manner. Both definitions agree that a computer executes a list of instructions called a program.

20

Haifa

a E

layyan

Page 21: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

A computer is a device that accepts data and manipulates it by carrying out a sequence of instructions (a program), so as to produce some output. A computer also has the means of storing the input, the output and the program.

Input, output and instructions: The input to a computer process starts off as words or numbers entered from a

keyboard. However it can take other forms, such as images, sound, or digital information from scientific instruments. Sometimes data will already be available in the computer as a file, in which case the input might be via mouse clicks or some other input device.

In modern computers, all data, including the instructions that make up a computer program, are stored in the computer as binary digits (bits) – sequences of zeros and ones. The branch of mathematics that defines the rules governing the manipulation of entities with only two states, such as bits, is called binary logic (or Boolean algebra – after the Englishman, George Boole, who developed it in the middle of the nineteenth century).

It is important to be aware that at a fundamental level computer processing is simply the application of logic to binary numbers.

Of course in order to make the results readable by humans, the binary representations of the output need to be ‘translated’ back into an appropriate format.

21

Haifa

a E

layyan

Page 22: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

EXERCISE 2.5

Hardware, software and computer systems In History snippet 2 you learned about Babbage’s analytical machine.

(a) Could this be described as a computer according to the two website definitions given in the discussion following Activity 2.2?

(b) Does it fulfil the M150 course definition, as given after the same discussion?

Discussion (a) Babbage’s machine could respond to a series of instructions in a well-

defined way, and so it could be described as a computer according to the webopedia definition. However, the analytical machine did not process digital data and so it is not a computer according to the whatis.techtarget definition.

(b) According to the M150 definition, a computer must be able to store data, instructions and results. The analytical machine did not have storage space for the instructions (they were to be input using punched cards) and so it cannot be considered to be a computer according to our definition.

22

Haifa

a E

layyan

Page 23: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

INSIDE THE COMPUTER SYSTEM :

You learned that the circuits at the heart of a computer system consist of switch-like electronic components and that all data and instructions are stored in the computer as sequences of binary digits (bits), which are manipulated using binary logic. You read about some of the early machines which are considered to be the forerunners of today’s computers.

23

Haifa

a E

layyan

Page 24: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

THE HEART OF THE COMPUTER – THE CENTRAL PROCESSING UNIT (CPU)

Computer processes manipulate binary representations of data, using instructions that are themselves stored in binary format. The component of the computer in which this manipulation of binary data takes place is referred to as an arithmetic/logic unit (ALU). Movement of data between the ALU and other parts of the computer is coordinated by the control unit.

The terms ‘processor’, ‘microprocessor’ and ‘CPU’ are often used interchangeably. The term ‘microprocessor’ usually refers to the chip on which the processor is implemented.

24

Haifa

a E

layyan

Page 25: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

CONTINUE Within both the ALU and the control unit are small

numbers of memory locations known as registers which are used to hold single pieces of data or single instructions immediately before and after processing. The ALU and the control unit along with their registers are together referred to as the central processing unit (CPU) or processor of a computer. A much larger area of memory, known as main memory, is where the data and instructions that are not immediately required are held, and where results are eventually stored.

Individual pieces of data and instructions are moved from main memory into the registers as required. The registers are built from more efficient (and expensive) memory than main memory, thus allowing fast access and transfer of data.

25

Haifa

a E

layyan

Page 26: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

CONTINUE

The processor of a PC is usually on a single microchip,(or microprocessor) which can contain several tens of millions of circuits. Processors come in ‘families’, such as the Pentium 4, Celeron, AMD Athlon XP. Each family of processors has what is termed an instruction set. This is the collection of basic instructions, called machine language instructions, which a particular processor understands .

The terms ‘machine language’ and ‘machine code’ are synonymous, but we will be using machine language in this unit.

26

Haifa

a E

layyan

Page 27: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

The CPU together with the way in which memory, internal communications and input/output are organised define an architecture for a computer that has been well established since the 1940s when it was first described by the

mathematician John von Neumann. Characteristic of the von Neumann architecture is the fact that the program instructions are stored in the main

memory along with the

data.

Figure 3.2 shows how data

moves between the various

components. The data flow is

coordinated by the control unit,

through the sending and

receiving of control signals.

27

Haifa

a E

layyan

Page 28: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

28

UNIT 6: HARDWARE :CPU – THE HEART OF COMPUTER

The Central Processing Unit: (CPU also called processor) is the part of the computer that executes program instructions. It consists of two parts:

1. The Arithmetic and Logic Unit (ALU) is where all calculations and logical operations are performed.

a- Arithmetic operations involve addition, subtraction, multiplication, and division.

b- Logic operations basically consist of comparing or combining two values:• All ALUs can compare >, <, and =.• Some ALUs can also compare >=, <=, and <>.• Comparisons can be combined using the logical operations NOT, AND and OR.

Truth tables are used to formally define these logical operations.

2. The Control Unit (CU): The control unit interprets program instructions. The control unit communicates with main memory and with input and output device controllers. The control unit directs the ALU to execute program instructions.

Page 29: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

29

UNIT 6: CPU – THE HEART OF COMPUTER

The CPU Registers : are high-speed storage locations within the CPU, used for specific tasks:

Memory Data Register (MDR) is used to hold data that are being transferred to or from primary storage.

Memory Address Register (MAR) indicates the location of the data to be stored or retrieved from primary storage.

Instruction Register (IR) holds the instruction being executed.

Program Counter (PC) holds the primary storage address of the next instruction to be executed.

The address held in the PC ,instruction cycle insures sequential execution of instructions. Jumps to another part of the program are achieved by

instructions, which reset the contents of the program counter.

Page 30: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

30

UNIT 6: CPU – THE HEART OF COMPUTER

Accumulator (AC) holds the results of ALU operations.

Program Status Register (PS) contains binary flags that signal the results of the previous operation.

For example the carry bit will be set to 1 if the last arithmetic operation lost a carry bit, and to 0 otherwise. Other condition codes indicate whether the last result was negative, zero or overflowed.

General-purpose registers are used for different purposes.

The first three registers are used by the control unit and are not accessible to the programmer.

The arrangement of registers define the processor architecture.

Page 31: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

REGISTERS

We stated that registers are very fast, efficient areas of memory that are located in the CPU and used as a holding area for all the data and other information needed during the processing of a program. In fact there are a number of different types of register, some located in the ALU, some in the control unit, and each designed to hold a particular type of information .

Arithmetic/logic unit (ALU) The arithmetic/logic unit is the part of the CPU where the

arithmetic and logical operations are carried out. It contains a number of registers where data is held directly prior to and following processing. Among other things, the ALU can:

add subtract compare multiply and divide (which may be derived from adding and subtracting). 31

Haifa

a E

layyan

Page 32: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

INSTRUCTION CYCLE

Each computer's CPU can have different cycles based on different instruction sets.

1. Fetch the instruction from main memory

The CPU presents the value of the program counter (PC) on the address bus. The CPU then fetches the instruction from main memory via the data bus into the memory data register (MDR). The value from the MDR is then placed into the current instruction register (CIR), a circuit that holds the instruction temporarily so that it can be decoded and executed. 32

Haifa

a E

layyan

Page 33: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

INSTRUCTION CYCLE Decode the instruction The instruction decoder interprets and implements

the instruction. The instruction register (IR) holds the current instruction, while the program counter (PC) holds the address in memory of the next instruction to be executed. the machine cycle or instruction cycle is generally divided into four parts:- 1)Fetching a instruction 2)Decoding a instruction 3)Executing a instruction 4)storing the instruction

2. Fetch data from main memory Read the effective address from main memory if the

instruction has an indirect address. Fetch required data from main memory to be processed and placed into registers.

33

Haifa

a E

layyan

Page 34: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

INSTRUCTION CYCLE 3. Execute the instruction From the instruction register, the data forming the

instruction is decoded by the control unit. It then passes the decoded information as a sequence of control signals to the relevant function units of the CPU to perform the actions required by the instruction such as reading values from registers, passing them to the Arithmetic logic unit (ALU) to add them together and writing the result back to a register. A condition signal is sent back to the control unit by the ALU if it is involved.

4. Store results Also called write back to memory. The result generated by

the operation is stored in the main memory, or sent to an output device. Based on the condition feedback from the ALU, the PC is either incremented to address the next instruction or updated to a different address where the next instruction will be fetched. The cycle is then repeated.

34

Haifa

a E

layyan

Page 35: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

SUMMARY the instructions in a computer program are processed by the

CPU, that data and instructions are stored in main memory, but moved to registers in the CPU as required, and that operations such as adding and logical comparisons are carried out by the ALU. We can summarise the steps carried out by the CPU in the execution of a computer program as follows:

This cycle continues, as shown in Figure 4.1, until all the instructions in the computer program have been carried out.

get an instruction from the program; find and transfer any data necessary to perform the

instruction; carry out the instruction (which may involve saving a result

for later use).

35

Haifa

a E

layyan

Page 36: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

During each cycle the CPU must: 1 locate the next (or if execution has just started, the first) instruction in the program, which is stored in main memory; 2 transfer this instruction into the processor by placing it into an appropriate register; 3 decode the instruction to see what it is to do (what this involves will be

discussed in more detail in Subsection 4.2); 4 locate (in main memory) any data the instruction refers to, and fetch it into the processor by placing it into an appropriate register; 5 do the processing on the data that the instruction requires (e.g. add a number to another number); 6 place the result in an appropriate register; 7 if necessary move the result back to main memory so that it can be used later in the processing; 8 update the program counter to hold the memory address of the next instruction

36

Haifa

a E

layyan

Page 37: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

MAIN MEMORY

A computer has a number of different types of memory (or data storage). As a computer user you are probably most familiar with main memory, often referred to as RAM, and file storage memory, such as that provided by a hard disk. Main memory is used to store a program of instructions and the data needed by the program while it is running. Its contents are volatile, i.e. they are lost when the computer is switched off. File storage memory is memory that is used to store large amounts of data for use at some later date. Unlike main memory, it is non-volatile, i.e. the data is persistent – it is not lost when the computer is turned off.

We will consider only main memory in this subsection. Main memory can be envisaged as a large collection of

sequentially ordered pigeon-holes, each of which can hold the same number of bits, equivalent to the word size of the computer. 37

Haifa

a E

layyan

Page 38: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

MAIN MEMORY The word size refers to the number of bits that the CPU can

manipulate at one time. It is determined by the size of the registers in the CPU and the number of bits that can be moved round the computer as a single unit. When people refer to computers as being ‘32-bit’ or ‘64-bit’ machines they are referring to word size. Older personal computers (including 386, 486 and Pentium PCs) had a word size of 32 bits. Newer processors such as the Itanium series have a 64-bit (or 8-byte) word size.

Locations in main memory are sequentially numbered, so that each one has a unique ‘address’ by which it can be directly accessed. This is why this type of memory is sometimes referred to as random-access memory (RAM).

The addressable nature of main memory makes the retrieval of data much faster than if there was a need to search sequentially through each ‘pigeonhole’ in turn until the right one was found. Furthermore, random access means that each memory location takes the same amount of time to access, regardless of its address.

38

Haifa

a E

layyan

Page 39: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

39

UNIT 6: MEMORY (also called primary storage, internal storage, or main memory).

Memory is the part of the computer that holds data for processing, programs, and information waiting to be output to secondary storage.

There are three main characteristics of memories:

The capacity of the memory varies in different computers and is measured in bytes.

A byte consists of 8 binary digits called bits. Each bit can represent binary 0 or binary 1. Each byte represents one

character in memory. There are four commonly used units of memory capacity:

Page 40: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

QUESTIONS :List two characteristics of main memory. It is randomly accessible (or addressable). It is volatile.

Suppose a computer is described as having 128KB (i.e. 128 kilobytes) of RAM. (a) How many bytes of memory does it have? (b) If the word size of the processor is 64 bits, how many words can the memory

store? You learned about bits, bytes and words in Section 3 of Unit 3. In particular you

should recall that a byte contains 8 bits, and a kilobyte contains 1,024 bytes.

Discussion (a) There are 131,072 bytes of memory. As a single kilobyte is 1,024 bytes, 128 kilobytes is 128 6 1024 bytes, i.e. 131,072 bytes. (b) The memory can hold 16,384 words. As each byte contains 8 bits, a 64-bit

word is equivalent to an 8-byte word. There are 131,072 bytes in all, so the number of words is 131,072/8, i.e. 16,384.

40

Haifa

a E

layyan

Page 41: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

41

UNIT 6: MEMORY

There are two types of memory chips:

Random access memory (RAM): Data and programs must be loaded from external storage (such as disk) into RAM before it can be used by the processor. RAM is volatile (temporary).

Read only memory (ROM): chips have programs built into them at the factory and cannot be changed by the user, thus they are not volatile. programmable ROMs (PROM) that can be programmed by the

user using special devices to save his own information. ROM typically contains special instructions to start up the

computer, give keyboard keys their special control capabilities and put characters on the screen.

Page 42: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

42

UNIT 6: MEMORY HIERARCHY Memory hierarchy: there is a memory hierarchy

consisting of primary memory (CPU internal registers, cache memory, main memory) and secondary memory (external devices such as disks)

Cache memory: is a high-speed expensive RAM memory used to store copies of the most frequently accessed information in main memory.

Virtual memory: Virtual memory is a memory system used to increase the effective size of the computers physical main memory.

Page 43: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

43

UNIT 6: SECONDARY (EXTERNAL) STORAGE

We mentioned before that the main memory is volatile (temporary). If the power is turned off program and data disappear. External storage is nonvolatile (permanent). External storage also has much more capacity than the primary

memory. There are two approaches to external storage:

sequential access and direct access.

The most widely used external storage media are -- floppy disks, -- hard disks,

-- optical disks and -- magnetic tapes.

Disks are direct access storage media, while tapes are sequential access storage media.

Page 44: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

THE OPERATING SYSTEM We have briefly examined the important hardware

components of a computer: the processor, memory and peripheral devices. Managing these resources to effectively coordinate and carry out all the computer’s tasks is the job of the operating system. Common operating systems for personal computers include Linux, Mac OS (for the Apple Macintosh) and the various versions of Windows, e.g. Windows 2000 and Windows XP.

An operating system is a complex piece of software that acts as an interface between the user (or an application program) and the computer hardware. It essentially enables the user to carry out a variety of complex tasks on the computer, without the need to know anything about what goes on ‘inside the box’. The functions of the operating system include the following.

44

Haifa

a E

layyan

Page 45: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

CONTINUE Provision of a user interface The user interface is the software that enables us to communicate with

our computers. It provides us with a means of inputting data and instructions, and presents output in a way that we can understand.

The user interfaces of early operating systems such as CP/M and DOS were text based, requiring the user to learn a set of commands which needed to be typed in following precise rules. Output to the screen also consisted entirely of characters. Today most PC operating systems provide graphical user interfaces (GUIs), the most common example of which is Microsoft Windows. GUI-based operating systems make use of icons, menus and other graphical widgets, with which the user interacts via a pointing device, usually a mouse. Most people find graphical interfaces more intuitive, quicker to learn, and easier to use than sequences of commands. A further advantage of GUIs is their availability for use by programs other than the core software provided by the operating system. For example, application programs (e.g. word processors, spreadsheet packages), even those produced by companies other than Microsoft, can ‘hook in’ to the Windows user interface to provide a consistent look and feel. This makes it much easier for users to learn how to use new applications.

45

Haifa

a E

layyan

Page 46: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

QUESTION :

Name four functions of an operating system? You could have given any four of the

following: providing a user interface; managing the allocation of memory; controlling peripheral devices; scheduling access to the processor; providing an interface between a computer

and an application; providing basic utilities.

46

Haifa

a E

layyan

Page 47: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

47

UNIT 6: OPERATING SYSTEM Is the most important system software component. It interacts between the application software and the computer

and manages the computer’s internal resources.

Within the OS, besides the kernel, there is a group of other programs called utility programs, that perform common tasks, such as formatting disks, copy files from other disks, backup disks, remove and rename files, and others.

Mainframes and minicomputers have powerful OS, including virtual memory, multiprogramming and multiprocessing, where many users can run different programs at the same time. Microcomputer OS focus on a single user.

The most important operating systems are: DOS, Microsoft Windows, Unix, Linux and MAC.

Page 48: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

48

UNIT 6: OPERATING SYSTEM

The Operating system has the following functions; Provision of user interface Management of the memory Coordination and control of peripheral devices. Scheduling access for the processor Interface between Hardware and computer

applications. Provide basic utilities (disk formatting, file

management, etc….).

The bootstrap loader: is a program that is stored permanently in the computer’s electronic circuitry in ROM. This process is called booting.

Page 49: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

49

UNIT 6: AGENDA Hardware, Software and Computer system

The resources of a computer , and how they are managed.

Running a program.

Types of programming languages.

The structure of computer programs.

Page 50: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

50

UNIT 6: THE FETCH/EXECUTE CYCLEDuring the program execution the CPU do the following steps:

Get an instruction from the program.

Find and transfer any data necessary to perform instruction.

Carry out the instruction.

The process of locating, transferring and carrying out a single instruction during execution is called fetch/execute cycle.

Page 51: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

51

UNIT 6: CONTINUEDuring each cycle the CPU must:

Locate the next instruction in the program which is stored in the main memory (first one is used if the execution has just started).

Transfer the instruction in to the processor by putting it in a register.

Decode the instruction. Locate any data located in the main memory which refers to the

instruction. Do the processing. Place the result in an appropriate register. If needed move result back to the main memory to be used later. Increment the program counter by 1.

Page 52: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

52

UNIT 6: EXAMPLE EXECUTING PROGRAM Executing Program

Data 2 3 ?

Memory location of data

501 502 503

InstructionLDA 501

ADD 502 STO 503 HLT 000

Memory location of instructions

701 702 703 704

Page 53: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

53

UNIT 6:CONTINUE

LDA 501

operator operand

LoaD Accumulator

address of a memory location

???

The Accumulator

3? ?2

502500 503501

part of the computer's memory

Before LDA executes

2after LDA executes

Page 54: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

54

UNIT 6:CONTINUE

ADD 502

operator operand

ADD to Accumulator

address of a memory location

2

The Accumulator

3? ?2

502500 503501

part of the computer's memory

before ADD executes

5after ADD executes

Page 55: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

55

UNIT 6:CONTINUE

STO 503

operator operand

STOre Accumulator in memory

address of a memory location

5

The Accumulator3? ?2

502500 503501

computer's memory before STO

before STO executes

5after STO executes

3? 52

502500 503501

computer's memory after STO

Page 56: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

56

UNIT 6:CONTINUE

HLT 000

operator operand

HaLT

dummy value - not used

No effect on accumulator or memory

Page 57: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

57

UNIT 6: AGENDA Hardware, Software and Computer system

The resources of a computer , and how they are managed.

Running a program.

Types of programming languages.

The structure of computer programs.

Page 58: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

58

UNIT 6: TYPES OF PROGRAMMING LANGUAGES. Five Generations of Programming Languages

GENERATION NAME SAMPLE STATEMENT First Machine 10010001 Second Assembly ADD A, B JMP L Third Procedural and structural Overtime:= 5 0; Fourth Object oriented FIND NAME "JONES“ Fifth Natural IF patient is dizzy, THEN check

temperature and blood pressure

Computer professionals talk about levels or generations of program ming languages, ranging from ‘low’ to ‘high.’ Programming languages are called lower level when they are closer to the language the computer itself uses.

The computer understands the 0s and 1s that make up bits and bytes. Programming languages are called higher level when they are closer to the language humans use that is, for English speakers, more like English.

Page 59: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

59

UNIT 6: MACHINE LANGUAGES: THE FIRST GENERATION We mentioned earlier that a byte is made up of bits, consisting of 1s and 0s.

These 1s and 0s may correspond to electricity’s being on or off in the computer.

They may also correspond to a magnetic charge’s being present or absent on storage media such as disk or tape.

Data represented in 1s and 0s is said to be written in machine language.

To see how hard this is to understand, imagine if you had to code this :

111100100111001111010010000100000111000000101011

Machine languages also vary according to computer design - another characteristic that makes them hard to work with

Page 60: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

60

UNIT 6: ASSEMBLY LANGUAGES: THE SECOND GENERATIONAssembly languages have a clear advantage over the 1s and 0s of

machine language because they use abbreviations or mnemonics. These are easier for human beings to remember. The machine language code we gave earlier could be expressed in

assembly language as:

ADD A, B

JMP L Assembly language is also considered low-level.

Assembly languages also vary from computer to computer.

With the third generation, we advance to high-level languages, many of which are considered portable languages.

That is, they can be run on more than one kind of com puter—they are “portable” from one machine to another.

Page 61: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

61

UNIT 6: HIGH-LEVEL PROCEDURAL LANGUAGES: THE THIRD GENERATION

People are able to understand languages that are more like their own (e.g., English) than machine languages or assembly

languages. These more English-like programming languages are called “high-level” languages.

However, most people still require some training in order to use higher-level languages. This is particularly true of procedural languages.

Procedural languages are programming languages with names like BASIC, Pascal, C, COBOL, and FORTRAN.

They are called “procedural” because they are designed to express the logic—the procedures—that can solve general problems.

For a procedural language to work on a computer, it must be translated into machine language Depending on the language, this translation is performed by either a compiler or an interpreter.

Page 62: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

62

UNIT 6: HIGH-LEVEL PROCEDURAL LANGUAGES: THE THIRD GENERATION

A compiler converts the programmer’s procedural language program, called the source code; into a machine language code, called the object code.

An interpreter converts the procedural language one statement at a time into machine code just before it is to be executed. No object code is saved.

What is the difference between using a compiler and using an interpreter?

When a program is run, the compiler requires two steps. The first step is to convert the entire program’s source code to object code.

The second step is to run the object code. The interpreter, in contrast, converts and runs the program one line at a time.

The advantage of a compiler language is that once the object code has been obtained, the program executes faster.

The advantage of an interpreter language is that programs are easier to develop.

Page 63: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

63

UNIT 5: PROBLEM-ORIENTED LANGUAGES: THE FOURTH GENERATION

Third-generation languages are valuable, but they require training in program ming.

Object-oriented languages, also known as very high-level languages, require little special training on the part of the user.

Unlike general-purpose languages, object-oriented languages are designed to solve specific problems. Some of these fourth-generation languages are used for very specific applications. Many consider Lotus 1-2-3 and dBASE to be flexible fourth-generation languages.

Query languages: Query languages enable nonprogrammers to use certain easily understood commands to search and generate reports from a database. An example is the commands used on an airline reservations system

Page 64: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

64

UNIT 6: NATURAL LANGUAGES: THE FIFTH GENERATION

Natural languages are still being developed.

They are designed to give people a more human (“natural”) connection with computers.

The languages are human languages: English, French, Japanese, or whatever.

Researchers also hope that natural languages will enable a computer to learn — to “remember” information, as people do, and to improve upon it.

Clearly this area is extremely challenging.

Page 65: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

65

UNIT 6: AGENDA Hardware, Software and Computer system

The resources of a computer , and how they are managed.

Running a program.

Types of programming languages.

The structure of computer programs.

Page 66: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

66

UNIT 6: THE BASIC BUILDING BLOCKS OF COMPUTER PROGRAMS All programs can be built from three logical building blocks

Sequence

• Take the first left

• Take the second right

• Take the third exit at the roundabout

Repetition/loops

• while you have not yet reached the turnoff for Little Whamping

•go straight ahead at each roundabout

• Selection/ifs

• If the traffic in the high street is heavy

•take the first left

•take the first right

•take the first left

• else

•follow the high street to the end

Page 67: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

67

UNIT 6:CONTINUE Let's not worry about the programming language for a while

The syntax for how you do sequence, selection and repetition varies from programming language to programming language but the basic structures stay the same.

Once you have the concepts clear you can apply them to any language (JavaScript, Java, Visual Basic, C#, C++, Perl etc etc)

Page 68: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

68

UNIT 6: SEQUENCE The only thing to worry about is getting the instructions in the correct order

buy a stamp

buy a birthday card write in the birthday card

address the envelope

post the envelope

Put these instructions into a logical sequence for Robbie the willing but slightly dim robot!

put the card in the envelope

Page 69: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

69

UNIT 6: SELECTION A selection instruction allows you to write programs (and remember programs are basically just plans) that will operate in different ways depending on circumstances

If I win the lottery this Saturday I'll tell my boss what I think of her on Monday otherwise I'll start an OU degree and get a better job in a

couple of years

Page 70: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

70

UNIT 6: TRUE OR FALSE Selection always includes a condition that can be evaluated when the program runs (i.e. the plan is executed) to be true or false (this is called a Boolean expression).

The truth or falsity of the condition determines which path is taken.

I win the lottery this Saturday

tell my boss what I think of her on Monday

start an OU degree

True FalseThe condition is like a fork in the

road determining

which path you take

a "flow chart"

Page 71: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

71

UNIT 6: SELECTION EXERCISES If Charlton Athletic stay in the premiership next season I'll renew my season ticket. Otherwise I'll spend my money on getting Sky instead.

Identify the condition and draw a flow chart diagram

Page 72: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

72

UNIT 6: REPETITION A repetition instruction allows one or more instructions to be repeated a number of times.

While I've got a chance of winning I'll keep putting one

foot in front of the other

I've got a chance of winning

put one foot in front of the other

False

Sorry Paula!

True

Page 73: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

73

UNIT 6: REPETITION EXERCISEI'm getting Robbie to plant tulip bulbs in the garden. I've given him a bag of bulbs and told him that while there are still any left in the bag he should take one out, dig a hole for it and put it in.

Draw a flow chart representing my instructions to Robbie.

What's wrong with these instructions for Robbie To make cups of tea for the family repeat the

following actions: put milk in cup put teabag in cup pour in boiling water

Page 74: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

74

UNIT 6: CONDITIONS AGAIN Important observation: both selection and repetition are controlled by conditions that can be evaluated to true or false (i.e. Boolean expressions). Selection - which path should I follow? Repetition - how often should I go round the loop?

Because Boolean expressions are of crucial importance a considerable chunk of Unit 6 section 6 is devoted to them.

Page 75: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

75

UNIT 6: COMPOUND CONDITIONS Often we want to combine separate conditions when using them to control a selection or a repetition e.g.

if (the customer is over 64 or the customer is under 18)

charge them reduced rate

else charge them full rate

Page 76: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

76

UNIT 6: EVALUATING COMPOUND CONDITIONS You have to evaluate the separate parts and combine them

according to rules in order to evaluate the truth or falsity of the overall expression

(the customer is over 64 or the customer is under 18)

true/false true/false

true/false

The rules used to combine the separate parts depend on the operator used. In this case the operator is or.

Page 77: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

77

UNIT 6: EVALUATING OR EXPRESSIONS If either or both of the sub-expressions are true then the whole expression evaluates as true. Only if both the sub-expressions are false does the whole expression evaluate to false.

Evaluate (the customer is over 64 or the customer is

under 18) When

a) the customer is 17b) the customer is 65c) the customer is 63

Page 78: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

78

UNIT 6: ANOTHER OR EXERCISEif (the patient is over 12 or the patient is under 60)

prescribe the adult dosage

else

prescribe reduced dosage

What will happen when the patient is:

a) 16

b) 11

c) 70

Is there a problem here?

Page 79: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

79

UNIT 6: EVALUATING AND EXPRESSIONSIf (the sky is purple and there is a shower of dead frogs)stay under the duvet

elseget up and go to work

If either or both of the sub-expressions are false then the whole expression evaluates as false. Only if both the sub-expressions are true does the whole expression evaluate to true.

Page 80: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

80

UNIT 6: AN AND EXERCISEIf (the date is an odd number and there's an "r" in the month)

drink Coffeeelse

drink Tea

What's to be drunk on:a) May 11th

b) March 21st

c) September 22nd

Page 81: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

81

UNIT 6: MIXING IT EXERCISE If ((gender = "male" and age > 64) or

(gender = "female" and age > 59))charge reduced rate

elsecharge full rate

What will happen for:

a) a male of 63b) a female of 60c) a male of 25

Page 82: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

82

UNIT 6: MIXING IT EXERCISE 2if (monthly income > 2000or (monthly income > 1000 and

monthly outgoings < 500))grant credit

elserefuse credit

What will happen for:

a) someone with monthly outgoings of 1800 and a monthly income of 2100

b) someone with a monthly income of 900 and monthly outgoings of 200

c) someone with a monthly income of 1200 and monthly outgoings of 600

Page 83: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

83

WHAT’S NEXTUnit 7: An introduction to programming using

JavaScript

Introduction

Getting started

Programming for selection: the if statement

Programming for repetition: the while statement

Programming for repetition: the for statement

Page 84: M150 – U NIT 6 D ATA, C OMPUTING AND I NFORMATI 1 Haifaa Elayyan

AOU

Leb. -

F08 -

M150 -

Unit 6

84

SOME REVIEW QUESTIONS What is assembly language? Write using assembly language a program that

adds 2 numbers. Using your program describe what is meant by operator and operand .Also describe what happens to in the computer hardware as the program is executed? In this case you can assume that the first number is stored at memory location 400 is 3 and the second number is stored at 401 is 4. Also assume that the starting memory location is 700.

Define virtual and cache memory? Describe using an example the meaning of low and

high level language? What is meant by compiler and interpreter?