Вы находитесь на странице: 1из 8

HOMEWORK I

CSE 318: SYSTEM SOFTWARE

DOS:13-09-10

Submitted by:- Monika Dogra


RB1803 B 57
Reg No. 10801186
PART – A

Q1: A user after traveling through all line and viewing it decides to
change all occurrences of ‘’inbox’’ to ‘’spam’’. With the help of structure
of editors tell how replacement actually going to occur.
Answer:-
The editing actually occurs by mapping of viewing buffer to a window . it is
accomplished by the two components of system.
First component formulates an ideal view. This view may be a very simple one
consisting of window worth of text arranged so that lines are not broken in
the middle of words. Second component takes this initialized from viewing
component and map it to a physical output device in most effective
manner.first component works in main memory and second in disk file file
system.
Loading an entire document into main memory may be infeasible however, if
only part of document is loaded and if many user specified operation
required to locate the affected portion.

Q2: How we can interlink Components of system program all together,


elaborate Diagrammatically.
Answer:-
Diagram:-

Source code is compiled by the compiler and is high level language.


Compiler compile the source code to object code. Assembly code converted
into object code by assembler.
Loader load the object code in memory ,linker link the object code in the
memory.
Q3: Is it necessary to have viewing filters and viewing buffers in
structure of editors, if yes then how they help in managing the text.
Anser:
Yes , viewing filters and viewing buffers have their important role in
editors.we know viewing component deals with formatting options . eg; font
size , colour, style etc. viewing component allows the user to create a view of
text files with the help of viewing buffer and filter.
Viewing involves formatting options like font, size, colour, alignment etc.
How viewing happens:-
The start of the area to be viewed is determined by the current viewing
pointer maintained by the viewing component. Viewing component is a
collection of modules responsible for determining the next view. Current
viewing pointer can be set or reset as a result of previous editing operation.
Viewing component invokes the viewing filter generates a new viewing buffer
which contains part of the document to be viewed from current viewing
pointer

PART - B

Q4: Generate passes of assemblers for following code---

David START 0
USING *, 21
L 1, Four
A 1, Length
ST 1,Buffer
Four RESW 1
Length RESW 1
Buffer RESB 4096
END

Answer:-
Pass one:-
Relative mnemonic
Address:- code
0 L 1-(0,21)
4 A 1-(0,21)
8 ST 0-(0,21)
12 _
16 _

Second pass :-
Relative mnemonic
Address code
0 L 1-(0,21)
4 A 1-(0,21)
8 ST 1-(0,21)
12 _
16 _

Q5: An assembler can tell loader which part of object code needs
modification, how modification can be done in this case.
Answer:-
Since the assembler does not know the actual location where the program
will be loaded, it cannot make the necessary changes in the address used
by the program. However, the assembler can identify for the loader those
parts of the object program that needs modification. An object program
that contains necessary information to perform this kind of modification is
called relocation program.
The figure below shows how a program is loaded, beginning at address
0000.
JSUB instruction is loaded at address 0006. Consider that the address field
of this instruction contains 01036, which is the address of the instruction
labeled RDREC. Now suppose we want to load this program beginning at
address 5000 as shown in fig 2. The address of this instruction labeled
RDREC is then 6036.
Thus the JSUB instruction must be modified as shown to contain this new
address. Likewise, if we loaded the program beginning at address 7420
(fig 3), the JSUB instruction would need to be changed to 4b108456 to
correspond to the new address of RDREC.
Note that no matter where the program is loaded, RDREC is always 1036
bytes part the starting address of the program. This means that we can
solve relocation problem in the following way.
1. When the assembler generates the opcode for JSUB, we are
considering, it will insert the address RDREC relative to the start of
the program.
2. The assembler will also produce a command for the loader, instructing
it to add the beginning address of the program to the address field in
the JSUB instruction at the load time.
The command for the loader, of course must also be a part of the object
program. We can accomplish modification record having the following
format.

The length is stored in half bytes rather than bytes because the address
field to be modified may not occupy an integral number of bytes.

Q6: Is there any need to design the pass2 of an assembler? Can we


generate both the passes in a single pass, if yes how?
Answer:-
All the task of assembler cant be done by pass-1 hence we need pass-2
single pass assembler scans the program only once and creates the
equivalent machine code program during the same pass. the assembler
substitutes all of the symbolic instruction or mnemonics with machine code
in one go.
It means reference to an instruction or a symbole that has not get been
defined or encountered .

In pass 2 ,the assembler scans each source statement the second time as
the assembler translates each instruction ,it increments the value contained
in the location counter .when a symbol appear in the source code but not in
symbol table after the programmer corrects all the assembly errors, the
program ready to be executed

Вам также может понравиться