Viva
Viva
Viva
FCFS stands for First-come, first-served. It is one type of scheduling algorithm. In this
scheme, the process that requests the CPU first is allocated the CPU first.
Implementation is managed by a FIFO queue.
Banker’s algorithm is one form of deadlock-avoidance in a system. It gets its name from a
banking system wherein the bank never allocates available cash in such a waythat it can no
longer satisfy the needs of all of its customers.
One is that it depends on how often a deadlock is likely to occur under the implementation
of this algorithm. The other has to do with how many processes willbe affected by
deadlock when this algorithm is applied.
Logical address refers to the address that is generated by the CPU. On the other hand,
physical address refers to the address that is seen by the memory unit.
6) What is the basic function of paging?
Paging is a memory management scheme that permits the physical address space of a process
to be noncontiguous. It avoids the considerable problem of having to fit variedsized memory
chunks onto the backing store.
7) What is fragmentation?
Fragmentation is memory wasted. It can be internal if we are dealing with systems that
have fixed-sized allocation units, or external if we are dealing with systems thathave
variable-sized allocation units.
9) What is an Assembler?
An assembler acts as a translator for low-level language. Assembly codes written using
mnemonic commands are translated by the Assembler into machine language.
Paging is used to solve the external fragmentation problem in operating system. This technique
ensures that the data you need is available as quickly as possible.
13) What are the four necessary and sufficient conditions behind thedeadlock?
1) Mutual Exclusion Condition: It specifies that the resources involved are non-sharable.
2) Hold and Wait Condition: It specifies that there must be a process that is holding a resource
already allocated to it while waiting for additional resource that are currently being held by
other processes.
3) No-Preemptive Condition: Resources cannot be taken away while they are being used by
processes.
4) Circular Wait Condition: It is an explanation of the second condition. It specifies that the
processes in the system form a circular list or a chain where each process in the chain is waiting
for a resource held by next process in the chain.
o Internal fragmentation: It is occurred when we deal with the systems that have fixed
size allocation units.
o External fragmentation: It is occurred when we deal with systems that have variable-
size allocation units.
o Binary semaphores
o Counting semaphores
...............................................................................................................................
1. Define system software.
It consists of variety of programs that supports the operation of the computer. This software
makes it possible for the user to focus on the other problems to besolved without needing to
know how the machine works internally.
-process management
Operating system acts as an interface between the user and the system
Eg:windows,linux,unix,dos
3. Define compiler and interpreter.
Compiler is a set of program which converts the whole high level languageprogram to
machine language program.
Interpreter is a set of programs which converts high level language program tomachine
language program line by line.
4. Define loader.
Loader is a set of program that loads the machine language translated by thetranslator into the
main memory and makes it ready for execution.
Here the second operand is given in indirect addressing mode.First the word in memory
location 600 is fetched and which will give the address of the operand.
In this instruction one operand is in accumulator and the second operand is a immediate
value the value 5 is directly added with the accumulator content andthe result is stored in
accumulator.
14. What are the instruction formats used in SIC/XE architecture? Give any one
format. Format 1 (1 byte), Format 2 (2 bytes), Format 3 (3 bytes)& Format 4(4 bytes)
Are the different instructions used in SIC/XE architecture.
Format 2:
8 4 4
OPCODE R1
UNIT II-ASSEMBLERS
2 Marks
the statement
The first instruction contains a forward reference RETADR.If we attempt to translate the
program line by line,we will unable to process the statement in line10 because we do not
know the address that will be assigned to RETADR .The address is assigned later(in line 80)
in the program.
The header record,text record and the end record are the three different recordsused in object
program.
The header record contains the program name,starting address and length of theprogram. Text
record contains the translated instructions and data of the program.
End record marks the end of the object program and specifies the address in theprogram
where execution is to begin.
The symbol table includes the name and value for each symbol in the sourceprogram,together
with flags to indicate error conditions.Some times it may
contains details about the data area. SYMTAB is usually organized as a hashtable for
efficiency of insertion and retrieval.
The operation code table contain the mnemonic operation code and its machinelanguage
equivalent. Some assemblers it may also contains information about instruction format and
length.OPTAB is usually organized as a hash table,withmnemonic operation code as the key.
* „EQU‟-it allows the programmer to define symbols and specify their valuesdirectly.The
general format is symbol EQU value
An object program that contains the information necessary to perform required modification
in the object code depends on the starting location of the programduring load time is known
as relocatable program.
10. Write the steps required to translate the source program to objectprogram.
One pass assembler that generate their object code in memory for immediateexecution is
known as load and go assembler.Here no object programmer is written out and hence no need
for loader.
13 .What are the two different types of jump statements used in MASMassembler.
Near jump
A near jump is a jump to a target in the same segment and it is assembled byusing a current
code segment CS.
Far jump
A far jump is a jump to a target in a different code segment and it is assembledby using
different segment registers .
THREE RESW 1
In this instruction one word area(3 bytes) is reserved for the symbol THREE. If the memory
is byte addressable then the address assigned for the next symbol is1006.
RESB –It reserves the indicated number of bytes for data area. Eg: 10 1008INPUT RESB 1
In this instruction one byte area is reserved for the symbol INPUT .Hence theaddress assigned
for the next symbol is 1009.
This record contains the information about the modification in the object codeduring
program relocation.the general format is
Col 1 M
Col 2-7 starting location of the address field to be modified relative to thebeginning of the
program
Assembler program can be divided into many sections known as control sections and each
control section can be loaded and relocated independently ofthe others.If the instruction in
one control section need to refer instruction or data in another control section .the assembler
is unable to process these references in normal way.Such references between control are
called external references.
A control section is a part of the program that maintain its identity after assembly;each
control section can be loaded and relocated independently of theothers.
Control sections are most often used for subroutines.The major benefit of usingcontrol
sections is to increase flexibility.
22. What is the difference between the assembler directive EXTREF andEXTDEF.
EXTDEF names external symbols that are defined in a particular control sectionand may be
EXTREF names external symbols that are referred in a particular controlsection and
defined in another control section.
23. Give the general format of define record.
This record gives information about external symbols that are defined in aparticular control
1D
Col 2-7 name of external symbol defined in this control section Col 8-13 relative address
of the symbol with in this control section Col 14-73 name andrelative address for other
external symbols.
USE – used to divide the program in to many blocks called program blocks
The assembler directive START gives the name and starting address of theprogram.The
format is PN START 1000
Linking – combines two or more separate object programs and also supplies theinformation
needed to reference them.
The loader, which is used only for loading, is known as absolute loader. e.g.Bootstrap loader
This is a special type of absolute loader which loads the first program to be runby the
computer. (usually an operating system)
Loaders that allow for program relocation are called relocating (relocative )loaders.
If the relocation bit corresponding to a word of object code is set to 1,theprogram‟s starting
address is
to be added to this word when the program is relocated.Bit value
The relocation bits are gathered together following the length indicator in each text record
and which is called as bit mask.For e.g. the bit mask FFC(1 11111111100) specifies that the
first 10 words of object code are to be modifiedduring relocation.
It is used to store the name and address of the each external symbol. It alsoindicates in which
control section the symbol is defined.
It gives the beginning address in memory where the linked program is to beloaded.The
starting address is obtained from the operating system.
In many linking loaders the subroutines called by the program being loaded areautomatically
fetched from the library, linked with the main program and loaded.This feature is referred to
as automatic library search.
13. List the loader options INCLUDE &DELETE. The general format ofINCLUDE
is
INCLUDE program_name (library name).This command direct the loader toread the
designated object
program from a library and treat it as the primary loader input. The generalformat of DELETE
It instructs the loader to delete the named control sections from the sets ofprograms loaded.
If the subroutine is loaded and linked to the program during its first call(runtime),then it is
called as dynamic loading or dynamic linking.
a) it has the ability to load the routine only when they are needed
b) The dynamic linking avoids the loading of entire library for each execution
18. What is meant by static executable and dynamic executable?
In static executable, all external symbols are bound and ready to run. Indynamic
executables some symbols are bound at run time.
Verify program name and length Read first text recordWhile record
type != „E‟ do
Begin
Moved object code to specified location in memory Read next object programrecord
End
Macro processor is system software that replaces each macroinstruction with the
corresponding group of source language statements. This is also called as expanding of
macros.
DEFTAB – the macro definitions are stored in a definition table ie it contains amacro
prototype and the statements that make up the macro body.
NAMTAB – it is used to store the macro names and it contains two pointers for each macro
instruction which indicate the starting and end location of macrodefinition in DEFTAB.it also
serves as an index to DEFTAB
ARGTAB – it is used to store the arguments during the expansion of macroinvocations.
If the parameters and arguments were associated with each other according to their positions
in the macro prototype and the macro invocation statement, thenthese parameters in macro
definitions are called as positional parameters.
The statement in which a macro calls on another macro,is called nested macrocall. In the
nested macro call, the call is done by outer macro and the macro called is the inner macro.
11. How the macro is processed using two passes? Pass 1: processing ofdefinitions
-it avoids the extra pass over the source program during assembling
-it may use some of the utility that can be used by language translators so thatcan be
loaded once.
This macro processor reads the source program statements, process the statements and
then the output lines are passed to the language translators asthey are generated, instead
of being written in an expanded file.
*The programmer does not need to learn about a macro facility for eachcompiler.
The macro processors that are not dependent on any particular programminglanguage,but
can be used with a variety of different languages are known as general purpose macro
processors. Eg.The ELENA macro processor.
16. What are the important factors considered while designing a generalpurpose
macroprocessors?
-comments
-grouping of statements t-okens
x identify the macro calls in the program the values of formal parameters are identified x
maintain the values of expansion time variables declared in a macrox expansion time control
flow is organized x determining the values of sequencing symbols x expansion of a model
statement is performed
To design the structure of macro-assembler, the functions of macro preprocessor and the
conventional assembler are merged. After merging, thefunctions are structured into
passes of the macro assembler.
................................................................................................................................
ANSWER: 16-bit
ANSWER: Bus interface unit is responsible for transferring the data addresseson the buses
necessary for execution unit.
ANSWER: It is accumulator register and used for I/O, arithmetic and logicaloperations by
ANSWER: It is base register. It is used to store base address and is the onlyregister used
as offset address pointer. BX (16-bit) = BL (8-bit) + BH (8bit)
CL (8-bit) + CH (8bit)
ANSWER: It is data register. It is where the data is stored. Whenever an interrupt is called to
print the data, it prints the data stored in data register.
ANSWER:IP (Instruction pointer): 16-bit register that stores the offset addressof next
instructions to be executed.
BP (Base pointer): 16-bit register that stores the offset address of the data orparameters within
the stack.
SP (Stack pointer): 16-bit register that stores the offset address of the top mostelement of the
stack.
ANSWER: 6 byte
Flag register
segment
Data segment
Stack segment
Extra segment
ANSWER: Extra segment is used when data segment is not sufficient enoughfor the
program.
ANSWER: 64 k bytes
ANSWER: Directives (Also called pseudo- operations) indicate how an operandor section of
program is to be processed by the assembler.
data word
DB-data byte
These are the directives used to declare a variable of type double word, wordand byte
respectively.
ANSWER: size of the flag register is 16-bit STATUS FLAGS Carry flag: set
Parity flag: set if the result of an operation contains even number of 1 bits,otherwise reset.
Auxiliary carry flag: set if there is carry from lower nibble, otherwise reset.
Zero flag: set if the result of an arithmetic or logical operation is zero, otherwisereset.
Sign flag: If the MSB of the result is 1 then the flag is set, otherwise reset.
Overflow flag: set when carry out of MSB and carry into MSB is different,otherwise reset.
CONTROL FLAGS
Trap flag: To execute the program in a single step, this flag should be set.
Interrupt flag: If this flag is set, then interrupts are enabled else the interruptsare disabled.
ANSWER: assembler is used to translate the high level language program tomachine code.
Example: MASM
ANSWER: 20 memory locations are reserved and initialized to 0. Dup standsfor duplicate.
ANSWER: Yes
ANSWER: the value of BX is multiplied with the value of AL and stored in AL.
Shift: move numbers to left of right within a register or memory location. Rotate: position
binary data by rotating the information in a register or memorylocation, either from one end
from memory, decodes and executes the instructions. Most Micro Processors are single-
chip devices.
ANSWER: carry flag, Parity flag, Auxiliary carry flag, Zero flag, Overflowflag,Trace flag,
Interrupt flag, Direction flag, and Sign flag.
73) What is the Maximum clock frequency in 8086?
ANSWER: 5 MHz is the Maximum clock frequency in 8086
ANSWER: Accumulator is the register in which Arithmetic and Logiccalculations are done.
ANSWER: Because of pipelining concept. 8086 BIU fetches the nextinstruction when
EU busy in executing another instruction.
77) Which Segment is used to store interrupt and subroutine return addressregisters?
ANSWER: Stack Segment in segment register is used to store interrupt andsubroutine return
address registers.
82) What is the difference between min mode and max mode of 8086?
ANSWER: Minimum mode operation is the least expensive way to operate the 8086
microprocessor because all the control signals for the memory and I/O are generated by the
microprocessor. In Maximum mode some of the control signals must be externally generated.
This requires the addition of an external bus controller. It used only when the system contains
external coprocessors suchas 8087 arithmetic coprocessor.
ANSWER: Stack is a portion of RAM used for saving the content of ProgramCounter and
general purpose registers.
86) What is the position of the Stack Pointer after the PUSH instruction?
ANSWER: The address line is 02 less than the earlier value.
87) What is the position of the Stack Pointer after the POP instruction?
ANSWER: The address line is 02 greater than the earlier value.
interrupt.
ANSWER: An interrupt which can be never be turned off (i.e. disabled) isknown as Non-
Maskable interrupt.
Read Interrupt Mask. Used to check whether the interrupt is Masked or not.
floating-point operations.