0% found this document useful (0 votes)
35 views26 pages

Lecture 4

Uploaded by

Prajjwal Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views26 pages

Lecture 4

Uploaded by

Prajjwal Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Introduction to Computing

Objectives
To learn and appreciate the following concepts

Problem solving basics


Logic and its importance in problem solving
Various computational problems and its classification
Computer Organization and operating system
Different types of languages
History of C, Typical C program development environment.
Introduction to problem solving
Skill set required for Software Engineers
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.
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.
Eg: John’s mother has four children.
First child is April
Second child is May
Third child is June
What is the name of fourth child?
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 of
numbers,5)

• The process part(Eg: summation) of the solution requires logic( How to


sum) or in other words based on the logic, process is developed.
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
Types of problems
Computational Problems
• Definition: Computation is a process of evolution from one state to
another in accordance with some rules.
Broad applications of Computational Problem
Classification of computational problems
Computer Organization
Central Processing Unit
Data and instructions are processed in CPU

 Consists of two functional units


 Control Unit (CU)
 Arithmetic and Logic Unit (ALU)
Arithmetic and Logical unit
 Performs arithmetic and logical operations:
• Example:
• arithmetic(+,-,*,/ etc..) and
• logical (AND, OR, NOT, <,= etc..) operations
Control unit
• Controls the order in which your program instructions are executed.
• Functions of CU:
 Fetches data and instructions to main memory
 Interprets these instructions
 Controls the transfer of data and instructions to and from main memory
 Controls input and output devices.
 Overall supervision of computer system
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.
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 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.
4. Now the system is ready for use.
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.
Memory unit
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.

The memory unit is the part of the computer that holds data and instructions for processing. Although it
is closely associated with the CPU, in actual fact it is separate from it. Memory associated with the CPU is
also called primary storage, primary memory, main storage, internal storage and main memory. When
we load software from a floppy disk, hard disk or CD-ROM, it is stored in the memory unit.

19
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
Computer memory classifications
• Main memory-Primary storage
• Secondary memory-Auxiliary storage
• Cache memory
Main memory
Memory where the data and instructions, currently being executed are
stored
 Located outside CPU
 High speed
 Data and instructions stored get erased when the power goes off
Also referred as primary / temporary memory
 Semiconductor memory
 Measured in terms of megabytes and gigabytes
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
Stores mainly stored program and basic input output system programs
Secondary memory

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


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


Cache memory
High speed memory placed between CPU and main memory
Stores data and instructions currently to be executed
More costlier but less capacity than main memory
Users can not access this memory

You might also like