2 Computer Fundamentals
2 Computer Fundamentals
Dept. of CSE
1. Decimal
2. Binary
3. Octal
4. Hexadecimal
Functional Units of Computer System
• 2 types of Computers:
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.
• 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
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
Low speed
14
Cache 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
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—
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
• 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
2. High level language is less memory efficient. Low level language is high memory efficient.
machine 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.
• A method of human thought that involves thinking in a linear, step by step manner
about how a problem can be solved
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)
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
33
Broad Applications
of Computational Problem
34
Classification of computational problems
35
Operating System
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