acao chapter - 01
TRANSCRIPT
-
7/30/2019 ACAO Chapter - 01
1/35
Chapter No. 1
-
7/30/2019 ACAO Chapter - 01
2/35
What Is Computational
Model?
The common basis of programminglanguage and computer architecture is
known as computational model.Provides higher level of abstraction than
the programming language and the
architecture.Computational model is the combination
of the above two.
-
7/30/2019 ACAO Chapter - 01
3/35
What Is Computational
Model? contn
E.g Von Neuman Architecture andimperative languages, reduction
architecture and functional languages.
-
7/30/2019 ACAO Chapter - 01
4/35
What Is Computational
Model? contn
-
7/30/2019 ACAO Chapter - 01
5/35
What is a computer program?
It is an executable representation of some algorithmdesigned to solve some real world problem.
There are thus two elements to a computer program:
Logic - what we what the program to achieve.
Control - how we are going to achieve the end goal.
ALGORITHM = LOGIC + CONTROL
-
7/30/2019 ACAO Chapter - 01
6/35
Imperative Languages
Model of computation based on a step by stepsequences of commands.
Program states exactly how the result is to beobtained.
Destructive assignment of variables.
-
7/30/2019 ACAO Chapter - 01
7/35
Imperative Languages
cont
Order of execution is crucial, commands canonly be understood in context of previouscomputation due to side effects.
Control is the responsibility of the programmer.
E.g ALGOL, Pascal, Ada and C
-
7/30/2019 ACAO Chapter - 01
8/35
Functional Languages
A program in a functional language consists of a
set of (possibly recursive) function definitions
and expression whose value is output as theprogram's result.
Functional languages are one kind of declarative
language.
Declarative languages allow the programmerto concentrate on the logic of an algorithm(declarative languages are goal driven,control is
not the concern of the programmer)
-
7/30/2019 ACAO Chapter - 01
9/35
Declarative Langauge
Model of computation based on a system whererelationships are specified directly in terms of theconstituents of the input data.
Made up of sets of definitions or equations describingrelations which specify what is to be computed, not howit is to be computed.
Non-destructive assignment of variables.
Order of execution does not matter (no side effects).
Expressions/definitions can be used as values.
Programmer no longer responsible for control.
-
7/30/2019 ACAO Chapter - 01
10/35
Interpretation of the Concept
of a Computational Model
The computational model comprises of three sets of
abstraction:Computational Model
Basic Items of
ComputationProblem Description
Model
Execution
Model
-
7/30/2019 ACAO Chapter - 01
11/35
Basic Items of Computation
This is the specification of the items thecomputation refers to the kind computations(operations) that can be performed on them.
E.g of items of computations are:
data, objects or messages, arguments andfunctions, elements of sets and predicate
declared on them.
-
7/30/2019 ACAO Chapter - 01
12/35
Problem Description Model
Refers to both style and method of problem description.
Problem Description Model
Style Method
-
7/30/2019 ACAO Chapter - 01
13/35
Problem Description Style
It specifies how the problems in a particularcomputational model are described.
Style
Procedural Declarative
-
7/30/2019 ACAO Chapter - 01
14/35
Procedural Style
In a procedural style the algorithm for solvingthe problem is stated. A particular solution isthen declared. (Imperative languages usesprocedural style)
int nfac (int n) {
int fac = 1;
if (n > 0)for ( int i = 2; i
-
7/30/2019 ACAO Chapter - 01
15/35
Declarative Style
Facts and relationships related to the problemhave to be stated.
Declarative Style
Using Functions
(applicative
computational
model)
Using predicts (predict
logic based
computational model)
-
7/30/2019 ACAO Chapter - 01
16/35
Declarative Style
Functional style
relationships areexpressed using
functions. E.g. (square (n)
(* n n))
This is a functionsquare,that express therelationship between theinput n and the outputvalue n*n.
Logic style
relationships aredeclared using
expressions known asclauses.
E.g. square(N, M):-
M is N*N
Clauses can be used toexpress both facts andrules.
-
7/30/2019 ACAO Chapter - 01
17/35
Problem Description Method
Procedural style
the problemdescription model
states how a solutionof the given problemhas to described.
Declarative style
the problemdescription model
states how theproblem itself has tobe described.
-
7/30/2019 ACAO Chapter - 01
18/35
Execution Model
Execution model consists of three components.
Interpretation of
the computation Execution Semantics
Execution Model
Control of the
execution
sequence
-
7/30/2019 ACAO Chapter - 01
19/35
Interpretation of the Execution
How to perform the computation?
It relates to problem description method
Problem description method and the interpretation ofthe computation mutually determines and presumeseach other.
In Von Neumann computational model, problemdescription is the sequence of instructions which specify
data and sequence of control instructions and theexecution of the given sequence of instructions is theinterpretation of the computation.
-
7/30/2019 ACAO Chapter - 01
20/35
Execution Semantics
A rule that prescribes how a single execution step is tobe performed.
The rule is associated with the chosen problem
description method and how the execution of thecomputation is interpreted.
-
7/30/2019 ACAO Chapter - 01
21/35
Execution Semantics
State transition
semantics
SLD-
resolution
Execution Model
Dataflow
semanticsReduction
semantics
-
7/30/2019 ACAO Chapter - 01
22/35
Control of the Execution
Sequence
Control of the execution
sequence
Control
Driven
Data
Driven
Demand
Driven
-
7/30/2019 ACAO Chapter - 01
23/35
Control Driven
In control driven execution it is assumed thereexist a program consisting of sequence ofinstructions.
The execution sequence implicitly given by theorder of the instructions
Explicit control instructions can also be used to
specify a departure from the implicit executionsequence.
-
7/30/2019 ACAO Chapter - 01
24/35
Data Driven
It is characterized by the fact that an operationis activated as soon as the data is available.
Also, known as eager evaluation.
-
7/30/2019 ACAO Chapter - 01
25/35
Demand Driven
The operations will be activated only when theirexecution is needed to achieve the final result.
Also known as lazy evaluation because thedelayed until needed philosophy is applied.
-
7/30/2019 ACAO Chapter - 01
26/35
Relationships Between the Concepts of
Computational Model, Programming
Language and the Architecture
Computational
model
Computer
architecture
Programming
language
Specification toolImplementationtool
-
7/30/2019 ACAO Chapter - 01
27/35
Basic Computational Models
Turing
von Neumann
dataflow
applicative
object based
predicate logic based
-
7/30/2019 ACAO Chapter - 01
28/35
Von Neumann Computational
Model
Basic items of computation
data is the basic item of computation
data items are identified by names in order todistinguish between different data items used in thesame computation.
The named entities are known as variables in aprogramming language and in architectures
Multiple data assignments are allowed.
-
7/30/2019 ACAO Chapter - 01
29/35
Von Neumann Computational
Model
Problem description model
The computational task is specified as a sequence ofinstructions (Procedural Model).
Execution model
the computation is performed according to the givensequence of instructions.
Instruction execution follows a state transitionsemantics and the model behaves just like finite statemachine.
Each instruction transfers the state of the machine tothe present state to next one, in a definite way asspecified by the semantics of the instruction.
-
7/30/2019 ACAO Chapter - 01
30/35
Corresponding
programming
languages
Corresponding
architectures
Computational Model
-
7/30/2019 ACAO Chapter - 01
31/35
-
7/30/2019 ACAO Chapter - 01
32/35
Key Concepts Related to
Computational Model
Granularity
From computational models point of view granularityis interpreted as the complexity of the items
computation.
From parallel architectures point of view granularityis interpreted as size of parallel computations thatcan be executed without any synchronization or
communication..Granularity can be classified as fine grained and
coarse grained.
-
7/30/2019 ACAO Chapter - 01
33/35
Granularity
Low
High
Language Class
Conventional
assembly
language
ConventionalHigh
language
Granularity Example
Fig 1.21 The interpretation of granularity for programming languages
-
7/30/2019 ACAO Chapter - 01
34/35
Key Concepts Related to
Computational Model
Typing
the concept of typing is used at a higher level inconnection with programming languages but from
computational models point of view typing oflanguages and architecture is closely related.
In typed languages there exist a concept of data typeand the compiler or interpreter checks the
consistency of the types used in function invocation,expressions etc.
the language may be strongly typed or weakly typed.
Strongly typed languages are Pascal, Miranda, hope,
C
-
7/30/2019 ACAO Chapter - 01
35/35
Typing
Weekly type languages are LISP, FP. They are alsoknow as untyped languages
Typed architectures are commonly known as tagged.
They provide a mechanism for typing the data beingstored or processed, by extending the data word bytag.
The tag contain the type identification and usually 3-
5 bits long.Tagging bridge the gap between untyped
architecture and weakly typed language