0% found this document useful (0 votes)
3 views

2 Computer Fundamentals

Uploaded by

ayushd172005
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

2 Computer Fundamentals

Uploaded by

ayushd172005
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Computer Fundamentals

Dr. Rajat Goel


Associate Professor

Dept. of CSE

Manipal University Jaipur


Digital computer

• A digital computer is a digital system that performs various


computational tasks and represented by variables with the
limited number of discrete values.

• The discrete values are internally processed with limited


number of discrete states. The decimal digits 0,1,2,…,9 provide
10 discrete values.
Number Systems

1. Decimal
2. Binary
3. Octal
4. Hexadecimal
Functional Units of Computer System

It is divided in two modules in general:


• Hardware
• Software
Von Neumann Architecture

• Von-Neumann computer architecture design was proposed in 1945. It was


later known as Von-Neumann architecture.

• 2 types of Computers:

1. Fixed Program Computers – Their function is very specific and they


couldn’t be reprogrammed, e.g. Calculators.

2. Stored Program Computers – These can be programmed to carry out


many different tasks, applications are stored on them, hence the name is.
Von Neumann Architecture cont’d…

• Modern computers are based on a stored-


program concept introduced by John Von
Neumann.

• In this stored-program concept, programs and


data are stored in a separate storage unit called
memories and are treated the same.

• This novel idea meant that a computer built


with this architecture would be much easier to
reprogram.
Von Neumann architecture is also known as ISA (Instruction set architecture) computer and is having three
basic units: Central Processing Unit (CPU), Main Memory Unit and Input/Output Unit.

Central Processing Unit-


The central processing unit is defined as an electric circuit used for the executing the instruction of computer
program. It has following major components:
• Control Unit(CU)
• Arithmetic and Logic Unit(ALU)
• Variety of Registers

Control Unit – A control unit (CU) handles all processor control signals. It directs all input and output flow,
fetches code for instructions, and controls how data moves around the system.
Arithmetic and Logic Unit (ALU) – The arithmetic logic unit is that part of the CPU that handles all the
calculations the CPU may need, e.g. Addition, Subtraction, Comparisons. It performs Logical Operations, Bit
Shifting Operations, and Arithmetic operations.
Input and Output Unit

• Input: Computer accept coded information through input unit. The most common
device is Keyboard. Whenever key is pressed, the corresponding letter or digit is
automatically translated into its corresponding binary code and transmitted over a cable
to either memory or the processor.

• Output: The output unit is the counterpart of the input unit. Its function is to send
processed results to the outside world. The most familiar device is a printer. Some
units, such as graphical displays, provide both an input and output function.
Arithmetic and Logical unit
 Performs arithmetic and logical operations:
• Example:
• arithmetic(+,-,*,/ etc..) and
• logical (AND, OR, NOT, <,= etc..) operations

9
Memory

• The function of the memory unit is to store programs and data. There are two classes of
storage, called as Primary and Secondary.

• Primary storage is a fast memory

• To provide an easy access of any word in memory, a distinguished address is associated


with each word location

• Memory in which any location can be accessed in short and fixed amount of time after
specifying address is called Random Access Memory (RAM).
Memory unit

The computer memory is measured in terms of bits, bytes and words.


A bit is a binary digit either 0 or 1.
A byte is unit of memory and is defined as sequence of 8 bits.
The word can be defined as a sequence of 16/32/64 bits or 2/4/8 bytes
respectively depending on the machine architecture

11
Primary storage: RAM & ROM
• RAM stands for Random Access Memory
 Read and write memory
 Information typed by the user are stored in this memory
 Any memory location can be accessed directly without scanning it sequentially
(random access memory)
 During power failure the information stored in it will be erased  volatile memory
• ROM stands for Read Only Memory
Permanent memory and non - volatile
Contents in locations in ROM can not be changed
12
Stores mainly stored program and basic input output system programs
Main memory is volatile and limited
 Hence it is essential for other types of storage devices where programs and
data can be stored when they are no longer being processed
Installed within the computer at the factory or added later as needed

13
Secondary memory

Non-volatile memory

Made up of magnetic material

Stores large amount of information for long time

Low speed

Holds programs not currently being executed

14
Cache memory

High speed memory placed between CPU and main memory


Stores data and instructions currently to be executed
Costlier but less capacity than main memory
Users can not access this memory

15
Registers
Registers refer to high-speed storage areas in the CPU. The data processed by the CPU are
fetched from the registers. There are different types of registers used in architecture :-
Accumulator: Stores the results of calculations made by ALU. It holds the intermediate of
arithmetic and logical operatoins.it act as a temporary storage location or device.
Program Counter (PC): Keeps track of the memory location of the next instructions to be
dealt with. The PC then passes this next address to the Memory Address Register (MAR).
Memory Address Register (MAR): It stores the memory locations of instructions that need
to be fetched from memory or stored in memory.
Memory Data Register (MDR): It stores data fetched from memory or any data that is to be
transferred to, and stored in, memory.
Current Instruction Register (CIR): It stores the most recently fetched instructions while it
is waiting to be coded and executed.
Instruction Buffer Register (IBR): The instruction that is not to be executed immediately is
placed in the instruction buffer register IBR.
Memory unit
Storage device where the data and instructions fed by the user are stored

An ordered sequence of storage cells, each capable of holding a piece of information

Each cell has its own unique address

The information held can be input data, computed values, or your program instructions.

17
Memory Unit
The computer starts using the memory from the moment the computer is switched on, till the
time it is switched off. The list of steps are—

1. Turn the computer on.

2. The computer loads data from ROM. It makes sure that all the major components of the computer
are functioning properly. The computer loads the Basic Input Output System (BIOS) from ROM.
The BIOS provides the most basic information about storage devices, boot sequence, security,
plug and play capability and other items.

3. The computer loads the OS from the hard drive into the system’s RAM. CPU has immediate
access to the OS as the critical parts of the OS are maintained in RAM as long as the computer is
on. This enhances the performance and functionality of the overall system.
18
4. Now the system is ready for use.
Memory unit contd…
5. When you load or open an application it is loaded in the RAM. Since the CPU looks for
information in the RAM, any data and instructions that are required for processing (read, write or
update) is brought into RAM. To conserve RAM usage, many applications load only the essential
parts of the program initially and then load other pieces as needed. Any files that are opened for
use in that application are also loaded into RAM.

6. The CPU requests the data it needs from RAM, processes it and writes new data back to RAM in
a continuous cycle. The shuffling of data between the CPU and RAM happens millions of times
every second.

7. When you save a file and close the application, the file is written to the secondary memory as
specified by you. The application and any accompanying files usually get deleted from RAM to
make space for new data.

8. If the files are not saved to a storage device before being closed, they are lost. 19
Buses
Data is transmitted from one part of a computer to another, connecting all major
internal components to the CPU and memory.
Types:
• Data Bus: It carries data among the memory unit, the I/O devices, and the
processor.
• Address Bus: It carries the address of data (not the actual data) between memory
and processor.
• Control Bus: It carries control commands from the CPU (and status signals from
other devices) in order to control and coordinate all the activities within the
computer.
High level Programming Languages

 In computer science, a high-level programming language is a programming language


with strong abstraction from the details of the computer.

 In contrast to low-level programming languages, it may use natural language elements,


be easier to use, or may automate (or even hide entirely) significant areas of computing
systems (e.g. memory management), making the process of developing a program
simpler and more understandable than when using a lower-level language.

 The amount of abstraction defines how "high-level" a programming language is


provided.
Difference between High Level and Low Level languages

• 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. Examples of high level languages are C, C++, Java,
Python, etc.
Difference between High Level and Low-level language
High Level Language Low-level language

1. It is programmer friendly language. It is a machine friendly language.

2. High level language is less memory efficient. Low level language is high memory efficient.

3. It is easy to understand. It is tough to understand.


4. Debugging is easy. Debugging is complex comparatively.
5. It is simple to maintain. It is complex to maintain comparatively.
6. It is portable. It is non-portable.
7. It can run on any platform. It is machine-dependent.

It needs compiler or interpreter for


8. It needs assembler for translation.
translation.

9. It is used widely for programming. It is not commonly used now-a-days in programming.


Language Translator
• Compiler : Program that translates entire high level language program into

machine language at a time. e.g.:- C, C++ compilers.

• Interpreter : Program which translates one statement of a high level

language program into machine language at a time and executes it. ,


• e.g.:- Basic Interpreters, Java Interpreters.

• Assembler : Program which translates an assembly language program into

machine language.

e.g.:- TASM(Turbo ASseMbler), MASM(Macro ASseMbler).


24
Compiler
• A Translator (compiler) is a program that reads a program written in one language, the
source language, - and translate it into an equivalent program in another language, the target
language.

• In computing, a compiler is a computer program that translates computer code written in


one programming language (the source language) into another language
(the target language).

• The name "compiler" is primarily used for programs that translate source code from a
high-level programming language to a low-level programming language (e.g.
assembly language, object code, or machine code) to create an executable program
Introduction to Problem Solving

26
Skill set required for Software Engineers

27
What is a Problem?
• A problem is a puzzle that requires logical thought or mathematics
to solve
• A puzzle could be a set of questions on a scenario which consists
of description of reality and a set of constraints about the scenario
• Eg: Scenario- Infosys Mysore campus has a library. The librarian
issues book only to Infosys employees.

Description of reality: There is a library in Infosys Mysore campus .


There is a librarian in the library
Constraints: librarian issues book only to Infosys employees.
Questions about the scenario: How many books are there in the
library? How many books can be issues to an employee?
Does the librarian issue book to himself? etc.
28
Logic

• A method of human thought that involves thinking in a linear, step by step manner
about how a problem can be solved

• Logic is a language for reasoning. It is a collection of rules we use when doing


reasoning.

29
Importance of logic in problem solving
• Solution for any problem(eg: summation of two numbers)
requires three things.
Input: Input values(Eg: 3 and 2)
Process: Process of summation
Output: Output after process (Eg: sum i.e. 5)

• The process part (e.g. summation) of the solution requires logic


(How to sum) or in other words based on the logic, process is
developed. 30
Importance of logic in problem solving

For solving a problem, there may be multiple valid logics, some may be simple and some
may be complex.
Eg. To determine whether the number is prime or not.
Logic 1- divide the number by all the numbers starting from 2 to one less than the number
and if for all the division operations, the reminder is non zero, the number is prime. Else the
number is not prime.
Logic 2 – same as logic 1 but divide the number from 2 to number/2
Logic 3 - same as logic 1 but divide the number from 2 to square root of the number

31
Types of Problems

32
Computational Problems

• Definition: Computation is a process of evolution from one state to


another in accordance with some rules.

33
Broad Applications
of Computational Problem

34
Classification of computational problems

35
Operating System

OS is an integrated collection of programs which make the computer operational


and help in executing user programs.

 It acts as an interface between the man and machine.

 It manages the system resources like memory, processors, input-output devices


and files.

36
Windows, Linux, DOS
Typical C program development environment

37
Typical C program development environment
C programs typically go through six phases to be executed. These are:
edit, preprocess, compile, link, load and execute
 Phase 1 : creating a program
Phases 2 and 3: Preprocessing and Compiling a C Program
Phase 4: Linking
Phase 5: Loading
Phase 6: Execution

38
Thanks

You might also like