0% found this document useful (0 votes)
7 views45 pages

Module I

The document provides an introduction to computer architecture, algorithms, and flowcharts, covering key concepts such as Turing Machine and Von Neumann architecture, number systems, and the components of operating systems. It explains the roles of system and application software, the compilation process, and the characteristics of algorithms and flowcharts. Additionally, it discusses syntax and semantics in programming languages, emphasizing the importance of clear definitions and representations in problem-solving.

Uploaded by

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

Module I

The document provides an introduction to computer architecture, algorithms, and flowcharts, covering key concepts such as Turing Machine and Von Neumann architecture, number systems, and the components of operating systems. It explains the roles of system and application software, the compilation process, and the characteristics of algorithms and flowcharts. Additionally, it discusses syntax and semantics in programming languages, emphasizing the importance of clear definitions and representations in problem-solving.

Uploaded by

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

Module I

Introduction to Computer, Algorithm


and Flowchart

Dimple Bohra
Contents
● The Turing Machine Architecture
● Von Neumann architecture
● Number system
● Introduction to operating system components
● System and application software
● Basic constructs of Algorithm and flowchart: Sequence, Decision
(Selection) and Repetition
● Compilation process: Syntax and semantic errors, ASCII.
The Turing Machine
● Turing Machine was invented by Alan Turing in 1936 and it is used to
accept Recursive Enumerable Languages.
● A Turing machine is an abstract machine that obeys a set of rules laid
down for it. The more practical form of the same is called as a
mathematical model. The Turing model forms the basis of software
development. It shows the behavior expected from the system to be
designed.
● Using a Turing model, one can design and develop the step expected in the
procedural oriented programming. h
The Turing Machine Architecture

Turing’s machine has— (5) The machine has instructions that


determine what it does given its
(1) A tape of infinite length
internal state and the symbol it
(2) Finitely many squares of the tape have encounters on the tape. It can
a single symbol from a finite language.
○ change its internal state;
(3) Someone (or something) that can read ○ change the symbol on the
the squares and write in them. square;
○ move forward;
(4) At any time, the machine is in one of a ○ move backward;
finite number of internal states. ○ halt (i.e. stop).
The Turing Machine
● Think of it as a mental model with a set of rules and concepts that
can be applied to generate theoretically anything.
● If all we have is an infinitely long set of spaces, a central brain
that has a finite number of states, and the ability to read / write
those spaces then we can hypothetically compute anything.
● So basically, a TM is a state machine.
● The theory behind state machines is closely attached to
algorithms.
● Algorithms are a series of precise and clearly defined steps to
solve a problem.
The Turing Machine and C program

A real world computer that executes compiled C programs consists of


● a CPU that "does things"
● memory that "stores things"
● a program to "coordinate things"
A Turing machine consists of
● a head that can read and write on the tape == do things
● a tape == store things
● an instruction table == coordinate things
Von Neumann Architecture

● Uses a single processor


● Uses one memory for both
instructions and data.
● Executes programs following the
fetch-decode-execute cycle
Components of Von Neumann Architecture
● The Arithmetic and Logic Unit ● The Control Unit of a computer
(ALU) performs the required system controls the operations of
micro-operations for executing the components like ALU, memory
instructions. and input/output devices.
● In simple words, ALU allows ● The Control Unit consists of a
arithmetic (add, subtract, etc.) and program counter that contains the
logic (AND, OR, NOT, etc.) address of the instructions to be
operations to be carried out. fetched and an instruction register
into which instructions are fetched
from memory for execution.
Components of Von Neumann Architecture
Buses are the means by which information is Registers refer to high-speed storage areas in the CPU.
shared between the registers in a The data processed by the CPU are fetched from the
multiple-register configuration system. registers.
Components of Von Neumann Architecture
● A memory unit is a collection of ● Two major types of memories
storage cells together with are used in computer systems:
associated circuits needed to
transfer information in and out of
the storage. 1. RAM (Random Access
● The memory stores binary Memory)
information in groups of bits called 2. ROM (Read-Only Memory)
words.
● The internal structure of a memory
unit is specified by the number of
words it contains and the number
of bits in each word.
Von Neumann and Turing Machine
● The Von-Neumann architecture describes the stored-program computer
where instructions and data are stored in memory and the machine works by
changing its internal state, i.e an instruction operates on some data and
modifies the data. So inherently, there is state maintained in the system.
● The Turing machine architecture works by manipulating symbols on a tape.
i.e A tape with infinite number of slots exists, and at any one point in time, the
Turing machine is in a particular slot. Based on the symbol read at that slot, the
machine can change the symbol and move to a different slot. All of this is
deterministic.
● The Von-Neumann architecture is an architecture for constructing actual
computers which implement what the Turing machine describes theoretically.
Number System
• When we type some letters or words, the computer translates them in
numbers as computers can understand only numbers.
• A computer can understand the positional number system where there are
only a few symbols called digits and these symbols represent different
values depending on the position they occupy in the number.
• The value of each digit in a number can be determined using −
The digit
The position of the digit in the number
The base of the number system (where the base is defined as the total
number of digits available in the number system)
Number System
● A number system is defined as a
system of writing to express
numbers.
● It is the mathematical notation for
representing numbers of a given
set by using digits or other
symbols in a consistent manner.
Decimal Number System

● The number system that we use in our • For example, the decimal number 1234 consists of
day-to-day life is the decimal number system. the digit 4 in the units position, 3 in the tens
position, 2 in the hundreds position, and 1 in the
● Decimal number system has base 10 as it uses 10
thousands position. Its value can be written as
digits from 0 to 9.
● Each position represents a specific power of the
base (10).
Binary Number System
• Characteristics of the binary number system are as follows −
Uses two digits, 0 and 1
Also called as base 2 number system
• Each position in a binary number represents a 0 power, of the base
(2).
• Example 20
• Last position in a binary number represents a x power of the base (2).
Example 2x where x represents the last position - 1.
Binary to Decimal Conversion
Octal Number System
• Characteristics of the octal number system are as follows −
Uses eight digits, 0,1,2,3,4,5,6,7
Also called as base 8 number system
• Each position in an octal number represents a 0 power of the base (8).
Example 80
• Last position in an octal number represents a x power of the base (8).
Example 8x where x represents the last position - 1
Octal to Decimal Conversion
Hexadecimal Number System
● Characteristics of hexadecimal number system are as follows −
Uses 10 digits and 6 letters, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Letters represent the numbers starting from 10.
A = 10. B = 11, C = 12, D = 13, E = 14, F = 15
Also called as base 16 number system
● Each position in a hexadecimal number represents a 0 power of the base (16).
Example, 160
● Last position in a hexadecimal number represents a x power of the base (16).
Example 16x where x represents the last position - 1
Hexadecimal to Decimal Conversion
Computer Systems
● Computer is system made of two major components: Hardware and
Software.Computer hardware is physical equipment.
● The software is collections of programs that allow hardware to do its job.
Computer Software
● Computer software is divided into two broad categories: system software and
application software.
● System software manages the computer resources. It provides the interface
between the hardware and the users but does nothing to directly serve the users’
needs. Application software, on the other hand, is directly responsible for helping
users solve their problems.
System Software
● System software consists of programs that manage the hardware resources
of a computer and perform required information processing tasks.
● These programs are divided into three classes: the operating system,
system support, and system development.
● The operating system provides services such as a user interface, file and
database access, and interfaces to communication systems such as Internet
protocols. The primary purpose of this software is to keep the system
operating in an efficient manner while allowing the users access to the
system.
System Software
● System support software provides system utilities and other operating
services. Examples of system utilities are sort programs and disk format
programs. Operating services consist of programs that provide
performance statistics for the operational staff and security monitors to
protect the system and data.
● System development software, includes the language translators that
convert programs into machine language for execution, debugging tools
to ensure that the programs are error free.
Application Software
● Application software is broken into two classes: general-purpose software and
application-specific software.
● General-purpose software is purchased from a software developer and can be
used for more than one application. Examples of general-purpose software
include word processors, database management systems, and computer-aided
design systems.
● Application-specific software can be used only for its intended purpose. A
general ledger system used by accountants and a material requirements
planning system used by a manufacturing organization are examples of
application-specific software. They can he used only for the task for which
they were designed; they cannot he used for other generalized tasks.
Relationship between Application and System Software
● Each circle represents an interface point.
● The inner core is the hardware.
● The user is represented by the outer layer.
● To work with the system, the typical user
uses some form of application software.
● The application software in turn interacts
with the operating system, which is a part
of the system software layer.
● The system software provides the direct
interaction with the hardware.
● Opening at the bottom represents path
followed by user who directly interacts
with OS when needed
Operating System
● An Operating System (OS) is an interface between a computer user and
computer hardware.
● An operating system is a software which performs all the basic tasks like
file management, memory management, process management, handling
input and output, and controlling peripheral devices such as disk drives
and printers.
Operating System Architecture
Operating System Components
The main components of an operating system (OS) are the kernel, shell, and
hardware:
● Kernel: The main part of the OS that controls most of its tasks, such as
memory and process management, and how installed software interacts
with the hardware.
● Shell: Allows users to interact with the OS through programming
languages, lines of commands, or visual ways to give orders.
● Hardware: The physical parts that make up a computer.
Operating System Components
Compilation Process
● The compilation is a process of
converting the source code into
object code. It is done with the help
of the compiler. The compiler
checks the source code for the
syntactical or structural errors, and
if the source code is error-free, then
it generates the object code.
Preprocessor

● It removes the comments and


include header files in the source
code, replace macro name with
code.
Compiler

● It generates the assembly code.


Assembler

● It converts the assembly code into


object code.
Linker

● It converts the object code into


executable code.
Algorithm
Algorithm
An algorithm is defined as a sequence of steps to solve a problem (task). The
steps must be finite, well defined and unambiguous. Writing algorithms requires
some thinking. Algorithm can also be defined as a plan to solve a problem and
represents its logic. Note that an algorithm is of no use if it does not help us arrive
at the desired solution
Algorithm characteristics
● It should have a finite number of steps.
● The steps must be in order and simple.
● Each step should be defined clearly stated i.e. without un-ambiguity
Flowchart
A flowchart is a pictorial (graphical) representation of an algorithm. Flowcharts use
different shapes of boxes to denote different type of instructions. ANSI recommended a
number of different rules and guidelines to help standardize the flowcharting process.

● Algorithms are represented using flowcharts


● Flowchart symbols are standardized by ANSI
● Flowchart helps to divide a large complex problem into small manageable ones
● Generally, algorithm is first represented as a flowchart and then expressed in a
programming language
● While preparing a flowchart, the sequence, selection and iterative structures may be
used wherever required
Flowchart
Rules for Drawing a Flowchart

● It should contain only one start and one end symbol


● The relevant symbols must be used while drawing a flowchart
● The direction of arrows should be top to bottom and left to right
● It should be simple and drawn clearly and neatly
● Be consistent in using names, variables in the flow chart
● Use properly labeled connectors to link the portions of the flowchart on
different pages
● The branches of decision box must be label
Sample Algorithm and Flowchart
Syntax and Semantics
Syntax:

● It refers to the rules and regulations for writing any statement in a programming language
like C
● It does not have to do anything with the meaning of the statement.
● A statement is syntactically valid if it follows all the rules.
● It is related to the grammar and structure of the language.
● Syntax errors are handled at compile time.
● Example: missing semicolon/parenthesis, undefined variables etc.

Semantics:

● It refers to the meaning associated with the statement in a programming language.


● It is all about the meaning of the statement which interprets the program easily.
● Semantic errors are handled at runtime
● Example: infinite loop, performing arithmetic operation on numbers without reading their
values, giving semicolon at the end of if-else, for loop etc.
ASCII Code
Thank you!

You might also like