PPL Unit 3
PPL Unit 3
UNIT-3
Storage Management
Storage Management is defined as it refers to the management of the data storage equipment’s
that are used to store the user/computer generated data. Hence it is a tool or set of processes used
by an administrator to keep your data and storage equipment’s safe.
Storage management is a process for users to optimize the use of storage devices and to protect
the integrity of data for any media on which it resides and the category of storage management
generally contain the different type of subcategories covering aspects such as security,
virtualization and more, as well as different types of provisioning or automation, which is
generally made up the entire storage management software market.
Storage management key attributes:
Storage management has some key attribute which is generally used to manage the storage
capacity of the system. These are given below:
1. Performance
2. Reliability
3. Recoverability
4. Capacity
Dynamic Memory Allocation: Allocation of memory at the time of execution (run time) is
known as dynamic memory allocation. The functions calloc() and malloc() support allocating of
dynamic memory. Dynamic allocation of memory space is done by using these functions when
value is returned by functions and assigned to pointer variables.
It uses stack for managing the It uses heap for managing the dynamic
3
static allocation of memory allocation of memory
Comparison Chart:
PARAMETER STACK HEAP
1. Expressions: These form the basic building blocks for statements and express how at are
manipulated and changed by a program. Properties such as precedence rules and parentheses
determine how expressions become evaluated.
2. Statement: Statements such as conditional or iterative statements, determine how control
flows from one segment of a program to another.
4. Subprograms: Subprograms such as subprogram calls and coroutines, form a way to transfer
control from one segment of a program to another.
➢ Prefix Notation
• Operators come first, then the operands
• e.g. (a + b) * (c - a) => * + a b - c a
• No ambiguity and no parenthesis needed
• Number of arguments for an operator must be known a priori
• Relatively easy to decode using stack mechanism
➢ Postfix notation
• An operator follows its operands
• e.g. (a+b) *(c-a) => a b + c a - *
• No ambiguity and no parenthesis needed
• Relatively easy to decode using stack mechanism
➢ Infix notation
• Only suitable for binary operations (Thus used with prefix)
• For more than one infix operator, it is inherently ambiguous
• Parenthesis is used to explicitly annotate the order
o foo( x )
{ ...
if ( a > 0 )
a = x;
else a = a + 1;
}
foo( b/a );
• Side effects
o a * foo(x) + a; say a= 1; foo(x) generates 3
▪ if each term is evaluated 1 * 3 + 2 = 5
▪ if a is evaluated only once 1 * 3 + 1 = 4
▪ if evaluate foo(x) first 2 * 3 + 2 = 8
• Error Condition: No solution other than exceptional statements
• Short-circuit expression: Use the characteristics of “and” or “or” operation
e.g. (palindromes)
A -> 0A0 1A1 0 1
matches 00100 -> 00A00 -> 0A0 -> A
applied term rewriting 00A00 is a term rewrite of 00100
e.g.) in ML
fun fact(1) = 1
fact(N:int) = N * fact(N - 1);
fun length( nil ) = 0
length( a :: y) = 1 + length( y )
➢ Backtracking
Backup to the previous subgoal that matched and try another possible goal for it to
match when current subgoal is failed.
And also
A=B;
A+=B
++A;
A++; these are all the assignment statements are available.
Input statement
All the languages include a statement form for reading data from the user at a terminal, from files, or from
a communications line. Such statements also change the values of variables through assignments.
1. Composition
Statement may be placed in a textual sequence so that they are executed in order whenever the
larger program structure containing the sequence is executed.
2. Alternation
Two sequences of statements may form alternatives so that one or the other sequence is executed,
but not both.
Eg., if statements.
3. Iteration
All looping statements are iterative statements. The control repetitively executes a statement at,
‘n' number of times.
1. GOTO
The programmer can able to transfer the control explicitly. ‘Goto' the best example for explicit
sequence controls.
2. Break statement.
Usually the break causes control to move forward in the program to an explicit point at the end of
a given control structure. Thus, break in C causes control to exit the immediately enclosing while,
for, or switch statement.
The Goto and Break statement spoils the hierarchy of programming structure.
1. Compound Statements
Is a sequence of statements that may be treated as a single statement in the construction of larger
statements.
e.g., begin
Statement 1.
Statement 2 // IN Pascal
Statement n
End;
And similarly
{
// Braces In C and C++ and JAVA
}
Within the compound statement, statements are written in the order in which they are to be
executed.
2. Conditional Statements
A conditional statement is one that expresses alternation of two or more statements, or optional
execution of a single statement;
3. Case statements
Iteration Statements
Simple repetition.
In COBOL
Perform body K times
5. Indefinite repetition
The loop will execute infinite number of times.
E.g.,
N=2;
For (I=1;I<=n; n++)
{
Statements;
}
Implementation
Current-instruction pointer.
Current-environment pointer
Stack-Based Implementation
Recursive Subprograms
Specification
Implementation
Referencing environments
1. Local referencing environment
2. Nonlocal referencing environment
3. Global referencing environment
4. Predefined referencing environment
Visibility
Dynamic scope
Referencing operations
Local, nonlocal, and global references.
Aliases for Data Objects
Static and Dynamic Scope
The importance of static scope
Block Structure
Local Data and Local Referencing Environments
Implementation
Deletion
1. Individual variables
2. A subprogram name
3. A formal-parameter
4. recursive subprogram
Advantages and Disadvantages
Call by name
Call by reference
Call by value
Call by value-result
Call by constant value
Call by result
Transmission Semantics
Elementary data types
Composite data types
Explicit Function Values
Implementation of Parameter Transmission
Parameter Transmission Examples
Simple variables and constants
Data structures
Components of data structures
Aliases and Parameters
Subprograms as Parameters
Statement Labels as Parameters
Block structure
In computer programming, a block or code block is a lexical structure of source code which is
grouped together. Blocks consist of one or more declarations and statements. A programming
language that permits the creation of blocks, including blocks nested within other blocks, is called
a block-structured programming language. Blocks are fundamental to structured programming,
where control structures are formed from blocks.
The function of blocks in programming is to enable groups of statements to be treated as if they
were one statement, and to narrow the lexical scope of objects such as variables, procedures and
functions declared in a block so that they do not conflict with those having the same name used
elsewhere. In a block-structured programming language, the objects named in outer blocks are
visible inside inner blocks, unless they are masked by an object declared with the same name.