Anna University, Chennai
CS2304 - SYSTEM SOFTWARE
TWO MARK QUESTION Answers
1. Define System Software.
System software consists of variety of program that supports the operation of a computer. This software makes it possible for the user to focus on an application of other problem to be solved, without needing to know the details of how the machine works internally.
2. Illustrate how input and output operations are performed in SIC.
Input and output are performed by transferring 1 byte at a time to or from the rightmost 8 bits of register A. Each device is assigned a unique 8-bit code.
3. Define indirect addressing mode.
If bit i = 0 and n = 1, the word at the location given by the target address is fetched, the value contained in this word is taken as the address of the operand value. This is called indirect addressing.
5. What is the use of SVC instruction in SIC?
SVC is a supervisor call instruction. Executing this instruction generates an interrupt that can be used for communication with the operating system.
Mention one advantage and one disadvantage of using program blocks in SIC / XE
assembly language programs.
Advantage : Program blocks can reduce the sizes of a program since some 4-byte instructions may be shortened to 3-bytes.
Disadvantage : Additional overhead on the assembler.
Give one advantage and one disadvantage of symbolic links. Advantage : Symbolic links can go across file systems. Disadvantage : File access through symbolic links is slower.
When addressing programs written using the assembly language of SIC / XE, the assembler may need to use PC - relative mode even when the BASE directive is in effect. Why?
PC - relative mode is needed when the displacement is negative.
List and explain the examples of Systems Programming.
- Text editor : create / modify a program in a high level language.
- Compiler : translate it to machine code.
- Loader / linker : load resulting code into memory and prepare for execution.
- Debugger : detect errors in program.
12. Write a program for SIC machine to copy 11 byte string from one location to another.
LDX LDCH STCH
ZERO STR1, X STR2, X
ELEV EN MOVECH
Initially x to zero
X specifying indexing Increments X and compares with 11
C 'TEST STRING' String constant
13. How is a floating point value represented using exponent in SIC?
There is a floating point hardware on the standard version of SIC. But in SIC / XE, the exponent is interpreted as an unsigned binary number between 0 and 2047. If the exponent has the value e and fraction has value f, the absolute value
of the number represented is f * 2 (e - 1024)
14. What is the purpose of test device instruction?
The test device (TD) instruction tests whether the addressed device is ready to send or receive a byte of data. The condition code is set to indicate the result of this test.
15. How I/O channels are used to perform input and output operations.
I/O channels can be used to perform input and output while the CPU is executing other instructions. This allows overlap of computing and I/O, resulting in more efficient system operation. The instruction SIO, TIO and HIO are sued to start, test and halt the operation of I/O channels.
16. Define a subroutine.
A subroutine is a section of the program that is written once, and can be used many times by simply calling it from any point in the program.
1. Define Assembler directives.
UNIT II Part A
Assembler directive instruct the assembler to perform certain action during the translation of source program into object program.
Ex: START, RESW, WORD, END.
2. How assembler handle forward reference instructions.
All such areas be defined in the source program before they are referenced. User merely places all storage reservation statements at the start of the program rather than at the end.
3. How is literal table useful?
It is convenient for the programmer to be able to write the value of a constant operand as a part of the instruction that uses it. This avoids having to define the constant elsewhere in the program and make up a label for it.
4. What does an assembler perform when it encounters LTORG assembler directive?
When the assembler encounters a LTORG statement, it creates a literal pool that contains all of the literal operands used since the previous LTORG. This literal pool is placed in the object program at the location where the LTORG directive was encountered.
5. What are the functions performed in pass 1 and pass 2 of a two assembler?
Pa s s 1
1. Assign addresses to all statements in the program.
2. Save the values assigned to all labels for use in pass 2. 3. Perform some processing of
Pa s s 2
1. Assemble instructions.
2. Generate data values defined by BYTE, WORD etc.
3. Perform processing of assembler directives not done during pass 1.
4. Write the program and the assembling listing.
6. Write down the pass number (PASS 1 / PASS 2) of the following activities that occur in a two pass assembler.
a. Object code generation.
b. Literals added to literal table. c. Listing printed.
d. Address resolution of local symbols. Answer :
Pass II Pass I Pass I Pass I
7. What is a program block?
Program block : It refer to segments of code that are rearranged within a single object program unit and control sections to refer to segments that are translated into independent object program unit.
8. Define an assembler.
As assembler is a translator that translates source instructions (in symbolic language) into target instructions (in machine language) on a one to one basis.
9. What is a common use of ORG?
The most common use for ORG is to specify a start address for the program in a computer without an operating system. On such a machine, the user may select a start address and may want to load different programs starting at different addresses. In such a case, the first source line is an ORG and is the only ORG in the program.
10. What are three types of assembly language statements?
1. Imperative statements : it indicates an action to be performed during the expansion of the assembled program.
2. Declaration statements : Declare the constant in decimal, binary and hexadecimal forms.
3. Assembler directives : It instructs the assembler to perform certain action during the assembly of a program.
11. What are the disadvantages of assembly language program?
1. The programmer requires knowledge of the processor architecture and instruction set.
2. Many instructions are required to achieve small tasks.
3. Source programs tend to be large and difficult to follow.
4. Programs are machine dependent, requiring complete rewrites if the hardware is changed.
12. List the features of the assemblers?
1. Allows the programmer to use mnemonics when writing source code programs.
2. Variables are represented by symbolic names, not as memory locations.
3. Symbolic code is easier to read and follow.
4. Error checking is provided.
5. Changes can be quickly and easily incorporated with a re-assembly.
6. Programming aids are included for relocation and expression evaluation.
13. What is the use of mnemonics? Mnemonics
1. Are more meaningful than hexa or binary values.
2. Reduce the chances of making an error.
3. Are easier to remember than bit values.
14. Explain the function of assembler while translating the program?
1. Replace symbolic addresses by numeric addresses.
2. Replace symbolic operation codes by machine operation code.
3. Reserve storage for instructions and data.
4. Translate constants into machine representation.
15. Explain the forward reference problem in one pass assembler.
1. Omit the address translation.
2. Insert the symbol into SYMTAB, and mark this symbol undefined.
3. The address that refers to the undefined symbol is added to a list of forward references associated with the symbol table entry.
4. When the definition for a symbol is encountered, the proper address for the symbol is then inserted into any instructions previous generated according to the forward reference list.
16. What is the use of location counter in assembler?
The LC is a variable, maintained by the assembler that contains the address into which the current instruction will eventually be loaded. When the assembler starts, it clears the LC, assuming that the first instruction will go into location 0. After each instruction is assembled, the assembler increments the LC by the size of the instruction. The LC, does not point to the current instruction. It just shows where the instruction will eventually be loaded. When the source line has a label (a newly defined symbol), the label is assigned the current value of the LC as its value. The label and its value (plus some other information) are then placed in the symbol table.
17. What is the use of symbol table in assembler?
The symbol table is an internal, dynamic table that is generated, maintained, and use by the assembler. Each entry in the table contains the definition of a symbol and has fields for the name, value, and type of the symbol. Some symbol tables contain other information about the symbols. The symbol table starts empty, labels and entered into it as their definitions are found in the source, and the table is also searched frequently to find the values and types of symbols whose names are known.
18. Intermediate file contains which type of record?
A record in a typical intermediate file contains
1. The record type. It can be an instruction, a directive, a comment, or an invalid line.
2. The LC value for the line.
3. A pointer to a specific entry in the OpCode table or the directive table. The second pass uses this pointer to locate the information necessary to assemble or execute the line.
4. A copy of the source line. Notice that a label, if any, is not use by pass 2 must be included in the intermediate .le since it is needed in the final listing.
19. What is the program relocation?
Program relocation is the process of modifying the addresses sued in the address sensitive instructions of the program such that the program can execute correctly from a designated area of the memory.
20. What is the need for an assembler directive?
Assembler directives instruct the assembler to perform certain actions during the assembly of a program. They can be used to declare variables, create storage space for result, to declare constant.
1. Define Linking.
UNIT - III Part A
Liking is a process in which the object modules created by the translator are bound with necessary library routines. In the linking process ready to execute program is prepared. Thus linking is a process of resolving external references between object modules.
2. What is the purpose of relocation bit in object code of relocation loader?
The purpose of relocation bits is to provide relocation. The 2 relocation bits are provided with each instruction. Relocation is required for modifying addresses used in address sensitive instructions of the program such that program can execute correctly from designated area of memory.
3. Explain the functions of a loader.
i) ii) iii)
It allocates the space for a program to execute in the memory. This is known as allocation.
It resolves the external references between various object modules. This activity is known as linking.
It also performs the task of relocation. That is it adjusts all the addresses at address sensitive instructions according to the allocated memory locations.
It performs a most important activity that is loading of executable
modules in the main memory by the loader.
4. What is BOOTSTRAP loader? Explain its characteristics with examples.
A small program written and stored in the ROM initially loads the operating system from secondary storage to main memory. The operating system then takes the overall control. This program which is responsible for booting up the system is called bootstrap loader.
Various characteristics of bootstrap loader are
i) ii) iii)
The bootstrap loader is a small program and it should be fitted in the
The bootstrap loader must load necessary portion of operating system in the main memory.
The initial address at which the bootstrap loader is to be loaded in generally the lowest for example at location 0000 or at the highest
location and not at intermediate location.
5. Compare linking loader and linkage editor.
Linking Loader Linkage editor
The linking loader performs all the The linkage editor produces a liked
linking and relocation operations version of the program. Such a linked
including automatic library search. version is also called as load module or Then loads the program directly into the executable image. This load module is
memory for execution. generally written in file or library for later execution.
There is no need of relocating loader. The relocating loader loads the load module into the memory.
The linking loader searches the libraries If the program is executed many times and resolves the external references without being reassembled then linkage every time the program is executed. editor is the best choice.
The loading may require two passes. The loading can be accomplished in one pass.
6. Explain dynamic linking in detail.
Dynamic linking is a mechanism in which the linking and loading of external of external references are postponed until execution time. Thus in dynamic linking the binder first prepares a load module in which along with program code the allocation and relocation information is stored. The loader simply loads the main module in the main memory. If any reference to a subroutine comes, then the execution is suspended for a while. The loader then brings the required subroutine in the main memory and then the execution process is resumed. Thus in dynamic linking, both linking and loading is dynamic.
There are certain advantages of dynamic linking and those are
i) The overhead on the loader is reduced. The required subroutine will be loaded in the main memory at the time of execution.
ii)The system can be reconfigured.
7. What is loader?
Loader is a utility program which takes object code as input prepares it for execution and loads the executable code into the memory. Thus loader is actually responsible for initiating the execution process.
8. What is the use of Linkage editor?
The binder which performs the linking function and produces adequate information about allocation and relocation and writes this information along with the program code in a file is called linkage editor. If frequent execution of the program is needed then linkage editor is used. This is because although the program is repeatedly executed the linking is done only once. And this helps in effective utilization of memory.
9. What is relocation bit?
The relocation bit associated with each word of object code specifies whether the relocation of instruction is possible or not. The relocation bit value 1 indicates that there is a relocation. The relocation bit value 0 shows that the address is absolute.
10. What is linking loader?
The linking loader is a program that searches the libraries and resolves external references every time when the program is executed. When program is in development stage then at that time the linking loader can be used. The role of linking loader can be as shown by following figure.
Library Linking Loader
11. What is function of MS-DOS LINK?
It is a linkage editor that combines one or more object modules to produce a complete executable program. It can also combine the translated programs with other modules from object code libraries.
12. What is use of PROGADDR and CSADDR?
PROGADDR is the beginning address in memory where the linked program is to be loaded. Its value is supplied to the loader by the operating system. CSADDR contains the starting address assigned to the control section currently being scanned by the loader.
1. Define macro.
UNIT - IV Part A
A Macro instruction is simply a notational convenience for the programmer. That is a macro represents commonly used (or repeated ) group of statements used in the source programming language. The Macro processor replaces each macro invocation (or call) with the corresponding group of source language statements. That is called macro expansion.
2. What is conditional macro expansion?
A preprocessor statement can alter the flow of control during expansion such that some model statements are either never visited during expansion, or repeatedly visited during expansion is called macro conditional expansion.
3. What is meant by macro time variable?
Macro time variable used to store working values during the macro expansion. Any symbol that begins with the character and that is not a macro instruction parameter is assumed to be a macro time variable.
4. Define macro definition and macro expansion.
Macro Definition : It is enclosed between a macro header statement and a macro end statement. Macro definition typically located at the start of a program.
Macro Expansion : A macro call leads to macro expansion. During macro expansion, the macro call statement is replaced by a sequence of assembly statement.
5. What are the three main data structures used by our macro processor?
1. Definition table (DEFTAB)
2. Name table (NAMTAB)
3. Argument table (ARGTAB)
6. List the statements present in a macro definition.
· MACRO prototype
· List of statements
7. What is a nested macro call? How is it expanded?
A model statement in a macro may constitute a call on another macro. Such calls are known as nested macro calls.
8. State how positional parameters and arguments are related in a macro processor?
Parameters and arguments were associated with each other according to their
positions in the macro prototype and the macro invocation statement. With positional parameters, the programmer must be careful to specify the arguments in the proper order. If an argument is to be omitted, the macro invocation statement must contain a null argument to maintain the correct argument positions.
9. How many parameters can a macro have?
It depends on the MDT organization and on the size of the data structures used for binding. Typically, the maximum number of parameters ranges between a few tens and a few hundreds.
10. What if the last argument of an expansion is null? How can the assemblers
Distinguish between a missing last argument and a null one?
If the last argument is null, it should be preceded by a comma. A missing last comma indicates a missing argument.
11. Normally, the definition of a macro must precede nay expansions of it. If we eliminate that restriction, what modifications do we have to make to the assembler?
Add another pass (pass - 1?) to collect all macro definitions and store them in
the MDT. Pass 0 would now be concerned only with macro expansions.
12. What could be a practical example of justifying the actual removal of a macro from the MDT?
Nested macro definition. In such a case, each expansion of certain macros causes another macro definition to be stored in the MDT, and space in the MDT may be exhausted very rapidly.
13. What is the difference between attributes of symbols and of macro arguments?
The difference is in scope. Attributes of macro arguments exist only while the macro is expanded. Attributes of a symbol exist while the symbol is stored in the symbol table.
14. What is the meaning of 'N MACRO M1, M2 =, M3'?
The programmer probably meant a default value of null for parameter M2. However, depending on the syntax rules of the assembler, this may also be considered an error.
15. Why is nested macro expansion useful?
Because it allows the implementation of recursive macros.
16. Is it valid to write 'AIF Q > N.F'?
Yes, many assemblers support simple expressions in the AIF directive.
17. What should be printed in the object code field when a macro definition is listed?
Nothing, since the assembler does not process the macro lines at definition time.
18. Library routines are in the form of object files. Can such a routine be an absolute object file? Yes, but then it can be used only by an absolute loader.
19. What are the basic tasks that must be performed by the macro processor?
1. Recognize the macro definition.
2. Save the definition.
3. Recognize the call.
4. Expand call and substitute arguments.
20. What are the different features of macro facility?
Macro facilities are
1. Macro Instruction arguments.
2. Conditional macro expansion.
3. Macro calls within macros.
4. Macro instruction defining macro.
21. How do we differentiate between open subroutine and closed subroutines?
Open subroutine is one whose code is inserted into the main program. A closed subroutine can be stored outside the main routine and control transfers to the subroutine. If the same open subroutine were called four items it would appear in four different places in the calling program. Open subroutine also called macro definition. Closed subroutine must perform two tasks in main program: transfer of control and transfer of data. Closed subroutines had to be loaded into memory at a specific address.
22. How could a non-recursive macro pre-processor allow for the invocation of macros within the macros? What would be the advantages and disadvantages of such an approach?
Non-recursive macro pre-process allow for the invocation of macros within
macros as follows:
1. Recognize call processor must recognize macro calls that appear as operations mnemonics.
2. Expand call and subroutine argument.
3. The processor must store the macro instruction definitions, which it will need for expanding macro calls.
4. A macro instruction processor must recognize macro definitions identified by the MACRO and MEND pseudo-op.
1. Define a software tool.
Software tool is a system program which
• Interfaces a program with the entity generating its input data or
• Interfaces the results of a program with the entity consuming them.
2. List out the different forms of editor and hint on each editor form.
Different forms of editor
1. Line editors.
2. Steam editors.
3. Screen editors.
4. Word processors.
5. Structure editors.
3. Define profile monitor.
Profile monitor is a software tool that collects information regarding the execution behavior of a program.
4. List the fundamental functions of editing.
Traveling, editing, viewing and display.
5. Which methods used for implementing command dialogs?
Three methods are used
1. Command languages.
2. Command menu
3. Direct manipulation
6. What are the various functions of a debugger?
Functions are tracing, trace back, unit test and execution sequencing.
7. What is the locator device?
Locator devices are two dimensional analog to digital converters that positions a cursor symbol on the screen by observing the user's movement of the device.
8. What is a menu?
A menu is a multiple choice set of text strings or icons, which are graphic symbols that represent objects or operations.
9. How viewing buffer is mapped with windows?
View component formulates an ideal view often expressed in a device independent intermediate representation. Another method is display component, which takes idealized view from the viewing component and maps it to a physical output device in the most efficient manner possible.