You are on page 1of 6

Homework

CAP607: System Software


Section: D1801,D1802,D1803 DoS:16Apr12 DoA: 6th april12 Max. Marks: 20

Q1. Give example of various asynchronous operation.


Ans:-

In general, asynchronous is an adjective describing objects or events that are not coordinated in time. In information technology, the term has several different usages asynchronous operation means that a process operates independently of other processes, whereas synchronous operation means that the process runs only as a result of some other process being completed or handing off operation.
Asynchronous Operation Defines an operation that is executed asynchronously, such as an asynchronous read or write on a socket. Examples

of asynchronous systems:

Windows operating system supports the ability to react to many kinds of events using each windows message loop. Socket Listeners improve their availability by spawning client handler threads. All the radar systems I worked on use asynchronous messaging between layers. Conditions:- Conditions are a facility that allows the programmer to process and
handle various interrupts and special circumstances.

DEMO: S1:

S2:

S3:

PROCEDURE ON ENDFILE (INPUT) GO TO END_PROG; .. .. ON OVERFLOW BEGIN; PUT EDIT ('OVERFLOW OCCURRED') (A(18)); GO TO END_PROG; END; ON OVERFLOW SYSTEM; END DEMO;

END_PROG:

Signal Signals are simulated interrupts caused by the programmer.


B
ON CONDITION (TRUBL) BEGIN -------END -------CALL D; --------

E
SIGNAL (TRUBL)

C
ON CONDITION (TRUBL) BEGIN -------END -------CALL D; --------

Q2. Highlight the importance of system design with ability to design, implement and debug
seperate modules of the system.

Q3. Chapter 5 Q.No.8 on Page 189 Q4. Explain when the variables are allocated and freed for each of the following storage classes: a. Static b. Controlled c. Automatic

ANS:-

1.

The storage class determines the part of memory where storage is allocated for an object (particularly variables and functions) and how long the storage allocation continues to exist. Reserve only as much data space as is needed. In many circumstances the size of arrays and tables are not known in advance(i.e. size depends upon input data) and it is advantageous to delay reserving space for them, if the compiler permits it.

2. Static: Storage is permanent and assigned at compile time. 3. Automatic: Storage is allocated only when that block or procedure is being executed(only when a procedure is going to be called). 4. Controlled: Allows the programmer to explicitly control space allocation at execution time.

AUTOMATIC VARIABLE They are declared at the start of a programs block such as in the curly braces ( { } ). Memory is allocated automatically upon entry to a block and freed automatically upon exit from the block. The scope of automatic variables is local to the block in which they are declared, including any blocks nested within that block. For these reasons, they are also called local variables. No block outside the defining block may have direct access to automatic variables (by variable name) but, they may be accessed indirectly by other blocks and/or functions using pointers. Example:- if there is a procedure SUBR with an aautomatic variable.

static storage class provides a lifetime over the entire program, however; it provides a way to limit the scope of such variables, and static storage class is declared with the keyword static as the class specifier when the variable is defined. Static variables may be initialized in their declarations; however, the initializers must be constant expressions, and initialization is done only once at compile time when memory is allocated for the static variable. Example :-FORTAN

Controlled:- controlled storage allows the programmer to explicitly control space allocation at execution time. He may allocate a block of storage when the needs

it and then may de-allocate or free that block of storage during execution. We will give an example of this is pointers. Q5. Compare various data types and data structures used in a programming language
Ans:- A data type (or datatype) in programming languages is a set of values and the operations on those values. Date type can tells the computer (and the programmer) something about the kind of data it is. Almost all programming languages explicitly include the notion of data type, though different languages may use different terminology. Most programming languages also allow the programmer to define additional data types, usually by combining multiple elements of other types and defining the valid operations of the new data type Common data types may include: integers, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values.[1] Integers are represented in a computer as a group of binary digits. The size of the grouping varies but computer hardware nearly always provides a way to represent a processor register, or memory address as an integer; the set of integer sizes available varies between different types of computer floating-point numbers:- floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent alphanumeric strings.

In general, in computing, an alphanumeric code is a series of letters and numbers (hence the name) which are written in a form understandable and processable by a computer. One such alphanumeric code is ASCII
In computer science, a data structure is a particular way organizing data in a computer so that it can be used efficiently. of storing and

Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. Data structures are used in almost every program or software system. Specific data structures are essential ingredients of many efficient algorithms, and make possible the management of huge amounts of data Linear/Branching there is only one direction to go, yet different paths can be taken. This structural form is hierarchical and organized.

Nonlinear/Matrix there are many directions to go. One can enter at any point and move to any other point at any time. All directions and points can be equally

Q6. Show the difference between a grammer, a language, a machine with the help of example.
Ans:- 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.\

Q7 Give various ways in which formal systems are useful in compilers or programming
languages Ans:-A formal System is an uninterpreted calculus or logistic system. It consists of an alphabet, a set of words called axioms, and a finite set of relations called rules of inference. Examples of Formal Systems are: set of theory, Boolean algebra, propositional and predicate calculus, post systems. Formal system is uninterpreted in the sense that no meaning is formally attached to the symbols of the system; there is for each of the above mentioned systems a standard informal interpretation of the symbols. Formal systems are used as the database; due to increase in number of programming languages and machine researches have been looking into automatic generation of compilers. Formal systems are used to study Complexity of programming languages of their compilers.

Q8. Why is BNF unsatisfactory for completely describing some languages? How do canonic systems overcome this deficiency? Give examples. Ans: - BNF is unsatisfactory for completely describing some languages, because BNF is a notation for writing grammars that is commonly used to specify the syntax of programming languages. In BNF non terminals are written as names enclosed in corner- brackets (). Alternative ways of rewriting a given non terminal are separated by a vertical bar. The main limitation is that it cant tell whose identifier is invalid. However, there is no way to do this formally in a BNF specification, we need to more powerful formal system, one with the capability of cross-reference between elements of the sentence structure that it generates. To overcome the deficiency of canonic system are:- A canonic system is a type of formal systems that operates on several sets of strings over a finite alphabets .In

Canonic systems the general framework of productions or string-transformation rules is replaced by the system axioms. These systems have been used to specify the syntax and translation of programming languages. They work as a database for a generalized translation, canonic systems defines do consists of a number of canons logical rules. Example: |- 1 digit |- 2 digit |- 3 digit X digit |-x number X digit; y number |-y x number This system defines number as the set of strings over the symbols 1,2 and 3. Any terminals may be substituted for the variables x and y, but no conclusion can be drawn unless the resulting premises are true.

You might also like