16488 Cap 607 Homework
-
Upload
himanshu-gautam -
Category
Documents
-
view
216 -
download
0
Transcript of 16488 Cap 607 Homework
-
8/2/2019 16488 Cap 607 Homework
1/11
-
8/2/2019 16488 Cap 607 Homework
2/11
system, typically before the physical I/O operation has even begun. The execution of the process is
not blocked, because it does not need to wait for the results of the system call. Instead, it can
continue executing and then receive the results of the I/O operation later, once they are available.
This is asynchronous or non-blocking I/O.
Asynchronous I/O enables write intensive processes like Oracle's DBWn to make full use of theI/O bandwidth of the hardware by queuing I/O requests to distinct devices in quick succession so
that they can be processed largely in parallel. Asynchronous I/O also allows processes performing
compute intensive operations like sorts to pre-fetch data from disk before it is required so that the
I/O and computation can occur in parallel.
The performance of asynchronous I/O is heavily dependent on the operating system's
implementation of the aio_read() and aio_write() system calls. Kernelized asynchronous I/O is
greatly preferable to threaded asynchronous I/O but it is only available for raw devices and
Quick I/O files.
Q2. Highlight the importance of system design with ability to design, implement and debug
seperate modules of the system.
Answer:- Systems design is the process of defining the architecture, components, modules,
interfaces, and data for a system to satisfy specified requirements. One could see it as the
application of systems theory to product development. There is some overlap with the disciplines
of analysis, systems architecture and systems engineering. If the broader topic of productdevelopment "blends the perspective of marketing, design, and manufacturing into a single
approach to product development," then design is the act of taking the marketing information and
creating the design of the product to be manufactured. Systems design is therefore the process of
defining and developing systems to satisfy specified requirements of the user. Until the 1990s
systems design had a crucial and respected role in the data processing industry. In the
1990s standardization of hardware and software resulted in the ability to build modular systems.
The increasing importance of software running on generic platforms has enhanced the discipline
of software engineering.
Object-oriented analysis and design methods are becoming the most widely used methods forcomputer systems design. The UML has become the standard language in object-oriented analysis
and design. It is widely used for modeling software systems and is increasingly used for high
designing non-software systems and organizations.
Implementation
-
8/2/2019 16488 Cap 607 Homework
3/11
-
8/2/2019 16488 Cap 607 Homework
4/11
PGB1 412
PGC 416
PGC1 420
PGC2 424
(b)
The TXT card for PGB2 and PGB3 contains the value and there are no associated RLD card for
this address constant. On the other hand these symbols are external to PGB thus the assembler
while processing PGB has no means of valuating the address constant and excluded from GEST.
(c)
Location Contents
400 PGA
404 PGA1
408 PGB
412 PGB1
416 PGC
420 PGC1
424 PGC2
428 A(PGC1-4),A(PGB1)
432 A(PGA),A(PGB+4)
436 A(PGA1-PGA),A(PGC2-PGC)
440 PGA,PGC1
444 A(PGC2-PGC)
448 A(PGC1-4),A(*-4)
452 A(PGC+PGC2-PGC1)
456 A(PGA),A(PGB+4)
460 A(PGA1-PGA),A(PGC2-PGC)
-
8/2/2019 16488 Cap 607 Homework
5/11
Q4. Explain when the variables are allocated and freed for each of the following storage classes:
a. Static b. Controlled c. Automatic
Answer:- The storage class assigned to a variable determines the degree of storage control applied
to it and the manner in which the variable's storage is allocated and freed. There are four storage
classes: automatic, static, controlled, and based. You assign the storage class using its
corresponding attribute in an explicit, implicit, or contextual declaration:
AUTOMATIC specifies that storage is allocated upon each entry to the block that contains
the storage declaration. The storage is released when the block is exited. If the block is a
procedure that is invoked recursively, the previously allocated storage is pushed down
upon entry; the latest allocation of storage is popped up in a recursive procedure when each
generation terminates. (For a discussion of push-down and pop-up stacking, see Recursive
procedures.)
STATIC specifies that storage is allocated when the program is loaded. The storage is not
freed until program execution is completed. The storage for a fetched procedure is not freed
until the procedure is released.
CONTROLLED specifies that you use the ALLOCATE and FREE statements to control
the allocation and freeing of storage. Multiple allocations of the same controlled variable in
the same program, without intervening freeing, stacks generations of the variable. You can
access earlier generations only by freeing the later ones.
BASED, like CONTROLLED, specifies that you control storage allocation and freeing. One
difference is that multiple allocations are not stacked but are available at any time. Each
allocation can be identified by the value of a pointer variable. Another difference is that based
variables can be associated with an area of storage and identified by the value of an offset
variable.
Based variables outside of areas can be allocated and freed using the ALLOCATE built-in
function and PLIFREE built-in subroutine respectively. They can also be allocated using
the AUTOMATIC built-in function; such allocated variables are freed automatically when
the block in which they are allocated terminates.
Q5. Compare various data types and data structures used in a programming language
Answer:- Data types
Data used in a PL/I program can be classified as either computational data or program-control data:
-
8/2/2019 16488 Cap 607 Homework
6/11
Computational data
Represents values that are used in computations to produce a desired result. Arithmetic and string
data constitute computational data.
Arithmetic data is either coded arithmetic data or numeric picture data.
Coded arithmetic data items are rational numbers. They have the data attributes of base (BINARY
or DECIMAL),scale (FLOAT or FIXED),precision (significant digits and decimal-point
placement), and mode (REAL or COMPLEX).
Numeric picture data is numeric data that is held in character form and is discussed under Numeric
character data.
Astringis a sequence of contiguous characters, bits, widechars or graphics that are treated as a
single data item.
Program-control data
Represents values that are used to control execution of your program. It consists of the following
data typesarea, entry, label, file, format, pointer, and offset.
For example:
Area = (Radius**2) * 3.1416;
Area and Radius are coded arithmetic variables of computational data. The
numbers 2 and 3.1416 are coded arithmetic constants of computational data.
If the number 3.1416 is used in more than one place in the program, or if it requires specific data or
precision attributes, you should declare it as a named constant. Thus, the above statement can be
coded as:
dcl Pi FIXED DECIMAL (5,4) VALUE(3.1416);
area = (radius**2) * Pi;
Constants for program-control data have a value that is determined by the compiler. In the
following example, the name loop represents a label constant of program-control data. The value
of loopis the address of the statement A=2*B;.
loop: A=2*B;
C=B+6;
-
8/2/2019 16488 Cap 607 Homework
7/11
-
8/2/2019 16488 Cap 607 Homework
8/11
A formal grammar is a set of rules for rewriting strings, along with a "start symbol" from which
rewriting must start. Therefore, a grammar is usually thought of as a language generator. However,
it can also sometimes be used as the basis for a "recognizer"a function in computing that
determines whether a given string belongs to the language or is grammatically incorrect. To
describe such recognizers, formal language theory uses separate formalisms, known as automata
theory. One of the interesting results of automata theory is that it is not possible to design a
recognizer for certain formal languages.
A programming language is an artificial language designed to communicate instructions to
a machine, particularly a computer. Programming languages can be used to create programs that
control the behavior of a machine and/or to express algorithms precisely.
The earliest programming languages predate the invention of the computer, and were used to direct
the behavior of machines such as Jacquard looms and player pianos. Thousands of different
programming languages have been created, mainly in the computer field, with many more being
created every year. Most programming languages describe computation in an imperative style, i.e.,as a sequence of commands, although some languages, such as those that support functional
programming or logic programming, use alternative forms of description.
The description of a programming language is usually split into the two components
of syntax (form) and semantics (meaning). Some languages are defined by a specification
document (for example, the C programming language is specified by an ISO Standard), while other
languages, such as Perl 5 and earlier, have a dominant implementation that is used as a reference.
A computer machine is a programmable machine designed to automatically carry out a sequence
of arithmetic or logical operations. The particular sequence of operations can be changed readily,allowing the computer to solve more than one kind of problem. An important class of computer
operations on some computing platforms is the accepting of input from human operators and the
output of results formatted for human consumption. The interface between the computer and the
human operator is known as the user interface.
Conventionally a computer consists of some form of memory, at least one element that carries out
arithmetic and logic operations, and a sequencing and control unit that can change the order of
operations based on the information that is stored. Peripheral devices allow information to be
entered from an external source, and allow the results of operations to be sent out.
A computer's processing unit executes series of instructions that make it read, manipulate and then
store data. Conditional instructions change the sequence of instructions as a function of the current
state of the machine or its environment.
-
8/2/2019 16488 Cap 607 Homework
9/11
Q7 Give various ways in which formal systems are useful in compilers or programming languages
Answer:- formal system, also called logistic system, in logic and mathematics,
abstract, theoretical organization of terms and implicit relationships that is used as a
tool for the analysis of the concept ofdeduction. Modelsstructures that interpret
the symbols of a formal systemare often used in conjunction with formal systems.
Each formal system has a formal language composed ofprimitive symbols acted on by certain
rules of formation (statements concerning the symbols, functions, and sentences allowable in the
system) and developed by inference from a set of axioms. The system thus consists of any number
of formulas built up through finite combinations of the primitive symbolscombinations that are
formed from the axioms in accordance with the stated rules.
In an axiomatic system, the primitive symbols are undefined; and all other symbols are defined in
terms of them. In the Peano postulates for the integers, for example, 0 and are taken as primitive,
and 1 and 2 are defined by 1 = 0 and 2 = 1. Similarly, in geometry such concepts as point,
line, and lies on are usually posited as primitive terms.
From the primitive symbols, certain formulas are defined as well formed, some of which are listed
as axioms; and rules are stated for inferring one formula as a conclusion from one or more other
formulas taken as premises. A theorem within such a system is a formula capable of proof through
a finite sequence of well-formed formulas, each of which either is an axiom or is inferred from
earlier formulas.
A formal system that is treated apart from intended interpretation is a mathematical construct and
is more properly called logical calculus; this kind of formulation deals rather
with validity and satisfiability than with truth or falsity, which are at the root of formal systems.
In general, then, a formal system provides an ideal language by means of which to abstract and
analyze the deductive structure of thought apart from specific meanings. Together with the concept
of a model, such systems have formed the basis for a rapidly expanding inquiry into
the foundations of mathematics and of other deductive sciences and have even been used to a
limited extent in analyzing the empirical sciences. See alsodeontological
ethics; metalogic; metatheory.
Q8. Why is BNF unsatisfactory for completely describing some languages? How do canonic
systems overcome this deficiency? Give examples.
Answer:- As we have remarked, a production is a rule relating to a pair of strings, say
and , specifying how one may be transformed into the other. This may be denoted
, and for simple theoretical grammars use is often made of this notation, using the
conventions about the use of upper case letters for non-terminals and lower case
-
8/2/2019 16488 Cap 607 Homework
10/11
ones for terminals. For more realistic grammars, such as those used to specify
programming languages, the most common way of specifying productions for many
years was to use an alternative notation invented by Backus, and first called Backus-
Normal-Form. Later it was realized that it was not, strictly speaking, a "normal form",
and was renamed Backus-Naur-Form. Backus and Naur were largely responsible for
theAlgol 60 report(Naur, 1960 and 1963), which was the first major attempt tospecify the syntax of a programming language using this notation. Regardless of what
the acronym really stands for, the notation is now universally known as BNF.
In classic BNF, a non-terminal is usually given a descriptive name, and is written in angle brackets
to distinguish it from a terminal symbol. (Remember that non-terminals are used in the
construction of sentences, although they do not actually appear in the final sentence.) In BNF,
productions have the form
leftside definition
Here " " can be interpreted as "is defined as" or "produces" (in some texts the symbol ::= is usedin preference to ). In such productions, both leftside and definition consist of a string
concatenated from one or more terminals and non-terminals. In fact, in terms of our earlier notation
leftside (N T)+
and
definition (N T)*
although we must be more restrictive than that, forleftside must contain at least one non-terminal,
so that we must also have
leftside N
Frequently we find several productions with the same leftside, and these are often abbreviated by
listing the definitions as a set of one or more alternatives, separated by a vertical bar symbol "|".
It will help to put the abstruse theory of the last two sections in better perspective if we consider
two simple examples in some depth.
Our first example shows a grammar for a tiny subset of English itself. In full detail we have
G = {N , T , S , P}
N= { , , , , , }
T= { the , man , girl , boy , lecturer , he , she , drinks , sleeps ,
mystifies , tall , thin , thirsty }
-
8/2/2019 16488 Cap 607 Homework
11/11
S=
P= { the (1)
| (2)
(3)
man | girl | boy | lecturer (4, 5, 6, 7)
he | she (8, 9)
talks | listens | mystifies (10, 11, 12)
tall | thin | sleepy (13, 14, 15)
}
The set of productions defines the non-terminal as consisting of either the terminal
"the" followed by a followed by a , or as a followed by
a . A is an followed by a , and a is one of the
terminal symbols "man" or "girl" or "boy" or "lecturer". A is either of the terminals
"he" or "she", while a is either "talks" or "listens" or "mystifies".
Here , , , , and are non-
terminals. These do not appear in any sentence of the language, which includes such majestic prose
as the thin lecturer mystifies
he talks
the sleepy boy listens