Fundamentals of Computer
Fundamentals of Computer
By
Jay Prakash Singh
Assistant Professor (Department of CSE)
Manipal University Jaipur, Jaipur, Rajasthan, India
E-mail- [email protected]
Von Neumann architecture was first published by John von Neumann 1945.
His computer architecture design consists of a Control Unit, Arithmetic and Logic
Unit (ALU), Memory Unit, Registers and Inputs/Outputs.
Von Neumann architecture is the design upon which many general purpose
computers are based. The key elements of von Neumann architecture are:
1
A processor based on von Neumann architecture has five
special registers which it uses for processing:
the program counter (PC) holds the memory address of the next instruction to be
fetched from primary storage
the memory address register (MAR) holds the address of the current instruction that
is to be fetched from memory, or the address in memory to which data is to be
transferred
the memory data register (MDR) holds the contents found at the address held in the
MAR, or data which is to be transferred to primary storage
the current instruction register (CIR) holds the instruction that is currently being
decoded and executed
The accumulator (ACC) is a special purpose register and is used by the arithmetic
logic unit (ALU) to hold the data being processed and the results of calculations.
Advantages of Von Neumann Architecture
Here are some advantages of the Von Neumann architecture:
Control Unit retrieves data and instruction in the same manner from one memory.
Design and development of the Control Unit is simplified, cheaper and faster.
Data from input / output devices and from memory are retrieved in the same
manner.
Organization of memory is done by programmers which allow them to utilize the
memory’s whole capacity.
2
Disadvantages of Von Neumann Architecture
Here are some disadvantages of the Von Neumann architecture:
Von Neumann bottleneck – Instructions can only be carried out one at a time
and sequentially.
Risk of an instruction being rewritten due to an error in the program.
Volatile Memory: This loses its data, when power is switched off.
Non-Volatile Memory: This is a permanent storage and does not lose any data
when power is switched off.
3
Memory is primarily of three types −
Cache Memory
Secondary Memory
Cache Memory
Cache memory is a very high speed semiconductor memory which can speed up the
CPU. It acts as a buffer between the CPU and the main memory. It is used to hold those
parts of data and program which are most frequently used by the CPU. The parts of
data and programs are transferred from the disk to cache memory by the operating
system, from where the CPU can access them.
Advantages
It stores the program that can be executed within a short period of time.
4
Disadvantages
It is very expensive.
Primary memory holds only those data and instructions on which the computer is
currently working. It has a limited capacity and data is lost when power is switched off. It
is generally made up of semiconductor device. These memories are not as fast as
registers. The data and instruction required to be processed resides in the main
memory. It is divided into two subcategories RAM and ROM.
5
Secondary Memory
This type of memory is also known as external memory or non-volatile. It is slower than
the main memory. These are used for storing data/information permanently. CPU
directly does not access these memories; instead they are accessed via input-output
routines. The contents of secondary memories are first transferred to the main memory,
and then the CPU can access it. For example, disk, CD-ROM, DVD, etc.
It is a non-volatile memory.
Some of the key differences between RAM and ROM are as follows:
RAM ROM
It is a read-write memory. The data can It is a read only memory. The data can only be
be written and read. read.
6
stores the files as long as the computer stores the files even when the power is turned
is on and working. off, such as game cartridge and BIOS program
stored in the memory of a computer, etc.
The storage capacity ranges from 1 to Its storage capacity ranges from 4 to 8 MB.
256 GB.
It is large in size than ROM. It comes in Its size ranges from less than an inch in length
two different sizes for use in desktop to multiple inches in length and width based
computers and laptops. A desktop ram on their use. It has less capacity than RAM.
is around 5.5 inches in length and 1
inch in width. Whereas, the Laptop RAM
is around half the length of desktop
RAM.
Data stored in RAM can be retrieved We can only read the data stored in ROM. It
and altered. cannot be altered.
The data stored in RAM is used by the The data stored in ROM is used by CPU only
CPU in real-time to run the computer. when it is transferred to RAM.
It temporarily stores the files and data It stores the BIOS program on the
that the CPU needs to process the motherboard of a computer, which is needed
current instructions or work. to bootstrap the computer.
The stored data is easy to access. The stored data is not as easy to access as it is
in ROM.
7
Memory Access Methods
Each memory is a collection of various memory locations. Accessing the memory
means finding and reaching the desired location and then reading information from
that memory location.
In this method, the memory is accessed in a specific linear sequential manner, like
accessing in a single linked list. The access time depends on the data. The time to
access data in this type of method depends on the location of the data. For access we
traverse through all locations starting from the current location to desired location,
passing and rejecting all the intermediate records until target record is not found.
Magnetic tape is the example where sequential access method is used. In Simple
Data Structure, Linked List is the example of Sequential access. Tapes are sequential
access media.
In random access method, data from any location of the memory can be accessed
randomly. The access to any location is not related with its physical location and is
independent of other locations. There is a separate access mechanism for each
location. Random Access is transferring information to or from memory in which every
memory location can be accessed directly rather than being accessed in a fixed
sequence. In Random Access Each record or addressable location in memory has a
unique address. So any location can be selected at random and directly accessed and
addressed.
8
Both types of files have advantages and disadvantages. If you are always accessing
information in the same order, a sequential-access file is faster. If you tend to access
information randomly, random access is better.
Direct access method can be seen as combination of sequential access method and
random access method. Magnetic hard disks contain many rotating storage tracks. Here
each track has its own read or write head and the tracks can be accessed randomly.
But access within each track is sequential. In this method, individual blocks or records
have a unique address based on physical location. access is accomplished by direct
access to reach a general vicinity plus sequential searching, counting or waiting to
reach the final destination. This method is a combination of above two access methods.
The access time depends on both the memory organization and characteristics
of storage technology. The access is semi-random or direct.
Example- Memory devices such as magnetic hard disks, Optical Disks etc.
The main difference between high level language and low level language is that,
Programmers can easily understand or interpret or compile the high level language in
comparison of machine. On the other hand, Machine can easily understand the low
level language in comparison of human beings.
9
High-level language
10
3. It is easy to understand. It is tough to understand.
It is complex to debug
4. It is simple to debug. comparatively.
It is complex to maintain
5. It is simple to maintain. comparatively.
6. It is portable. It is non-portable.
It needs compiler or
8. interpreter for translation. There is no need of compiler.
11
Flowchart-
With the help of the flowchart, the designer can efficiently segregate the various
elements of the process. Also, it facilitates the analysis by giving step-by-step
instructions on the problem.
Description A flowchart is a graphical representation of the steps a An algorithm is a procedure or set of rules that defines
program takes to process data. In this, we can use several how a program is to be executed. Or we can say that it
geometric patterns to illustrate the numerous actions the is a set of instructions for solving a well-defined
program carries out. computational problem.
Complexity It is easy to design and also very user friendly. It is comparatively difficult to create and also a bit
challenging to be understood by a layman.
Geometrical It utilizes different types of geometrical shapes, symbols, An algorithm does not include any sort of geometrical
diagrams and patterns. pattern.
Scope of Usage A flowchart can be used in different disciplines to describe Algorithms are used in the domain of mathematics and
a process. computer science.
Use A flowchart is used in documenting, designing, and An algorithm is used to represent the concept of
analyzing a program in different disciplines. decidability.
Users A Flowchart doesn’t demand the knowledge of a computer An algorithm demands the knowledge of a computer
programming language. programming language.
Debugging It is easy to debug the errors in flowcharts. It is difficult to debug the errors in algorithms.
Implementation In flowcharts, no rules are used. In algorithms, predefined rules are used.
Branching and Simple to display branching and looping. Hard to display branching and looping.
Looping
Solution In a flowchart, the solution is represented in a graphical In an algorithm, the solution is presented in non non-
format. computer language.
12
Flow-Chart Symbols
The following table illustrates the symbols along with their names (used in a flow-chart)
−
Decision Annotation
13
Example – Here is an example of a flowchart that describes the process of finding the
average of three numbers.
Pseudo Code
It is a simpler version of a programming code in plain English which uses short phrases
to write code for a program before it is implemented in a specific programming
language. A pseudo code, pseudo meaning half, will be a representation that almost
looks like a code written in a programming language. However, it should be noted that
a good pseudo code should be language independent .
1
2 BEGIN
3 NUMBER s1, s2, sum
4 OUTPUT("Input number1:")
5 INPUT s1
6 OUTPUT("Input number2:")
7 INPUT s2
8 sum=s1+s2
9 OUTPUT sum
10 END
11
14