0% found this document useful (0 votes)
43 views

QB Viva

Uploaded by

moosaem91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

QB Viva

Uploaded by

moosaem91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SYSTEM SOFTWARE LAB- CS 331- QUESTION BANK WITH ANSWERS

1. What is CPU Scheduler?


Selects from among the processes in memory that are ready to execute, and allocates the
CPU to one of them.
CPU scheduling decisions may take place when a process:
a. .Switches from running to waiting state.
b. .Switches from running to ready state. c
c. .Switches from waiting to ready.
d. Terminates.
Scheduling under a. and d. is non-pre-emptive.
All other scheduling is pre-emptive

2. What are all the scheduling algorithms?


a. FCFS(First Come First Serve)
b. SJF(Shortest Job First)
c. Round robin
d. Priority Scheduling algorithms

3. Explain FCFS(First Come First Served)?


a. The process that requests the CPU first is allocated the CPU first. The code for
b. FCFS scheduling is simple to write and understand.
c. Explain SJF(Shortest Job First)?
d. The process which has the less burst time execute first. If both process have same
burst time then FCFS will be used.

4. Explain Round Robin?


The round-robin (RR) scheduling algorithm is designed especially for timesharing
systems. CPU switch between the processes based on a small unit of time called time
slice.

5. Explain Priority Scheduling algorithm?


CPU is allocated to the process with the highest priority.

6. Which algorithm gives minimum average waiting time?


SJF(Shortest Job First)

7. What is CPU utilization?


We want to keep the CPU as busy as possible. Conceptually, CPU utilization can range
from 0 to 100 percent. In a real system, it should range from 40 percent (for a lightly
loaded system) to 90 percent.
8. What is Throughput?
The amount of work is being done by the CPU. One unit of work is the number of
processes that are completed per unit time, called throughput
9. What is Turnaround time.
The interval from the time of submission of a process to the time of completion is the
turnaround time

10. What is waiting time?


Waiting time is the sum of the periods spent waiting in the ready queue.

11. What is Response time?


the time from the submission of a request until the first response is produced.

12. What are short, long and medium-term scheduling?


a. Long term scheduler determines which programs are admitted to the system for
processing. It controls the degree of multiprogramming. Once admitted, a job becomes a
process.
b. Medium term scheduling is part of the swapping function. This relates to processes that
are in a blocked or suspended state. They are swapped out of real-memory until they are
ready to execute. The swapping-in decision is based on memory-management criteria.
c. Short term scheduler, also known as a dispatcher executes most frequently, and makes
the finest-grained decision of which process should execute next. This scheduler is
invoked whenever an event occurs. It may lead to interruption of one process by pre-
emption.

13. What are turnaround time and response time?


Turnaround time is the interval between the submission of a job and its completion.

14. What is pre-emptive and non-pre-emptive scheduling?


a. Pre-emptive scheduling: The pre-emptive scheduling is prioritized. The highest priority
process should always be the process that is currently utilized.
b. Non-Pre-emptive scheduling: When a process enters the state of running, the state of that
process is not deleted from the scheduler until it finishes its service time.

15. What is deadlock?


Deadlock is a situation that when two or more process waiting for each other and holding the
resource which is required by another process.

16. What are the necessary conditions to occur deadlock?


Mutual exclusion: At least one resource must be held in a non-sharable mode, that is, only
one process at a time can use the resource. If another process requests that resource, the
requesting process must be delayed until the resource has been released.
Hold and wait: A process must be holding at least one resource and waiting to acquire
additional resources that are currently being held by other processes.
No pre-emption: Resources cannot be pre-empted.; that is, a resource can be released only
voluntarily by the process holding it, after that process has completed its task.
Circular wait: A set {P$, Pi, ..., Pn} of waiting processes must exist such that P-0 is waiting
for a resource held by P\, P\ is waiting for a resource held by P?, •••, P.,--i is waiting for a
resource held by Pn, and P, is waiting for a resource held by Pn.

17. Explain about resource allocation graph?


Deadlocks can be described more precisely in terms of a directed graph called a system
resource-allocation graph. If the graph contains no cycles, then no process in the system is
deadlocked. If the graph does contain a cycle, then a deadlock may exist.

18. What are the methods to handle the dead locks?


a. We can use a protocol to prevent or avoid deadlocks, ensuring that the system will
never enter a deadlock state.
b. We can allow the system to enter a deadlock state, detect it, and recover.
c. We can ignore the problem altogether and pretend that deadlocks never occur in
the system.
d. The third solution is the one used by most operating systems

19. What are the deadlock avoidance algorithms?


A dead lock avoidance algorithm dynamically examines there source-allocation state to
ensure that a circular wait condition can never exist. The resource allocation state is defined
by the number of available and allocated resources, and the maximum demand of the process.
There are two algorithms:
Resource allocation graph algorithm
a. Banker’s algorithm
b. Safety algorithm
c. Resource request algorithm

20. What is Bankers Algorithm.


It is an algorithm which used in a banking system to ensure that the bank never allocated its
available cash in such a way that it could no longer satisfy the needs of all its customers.
21. What is a Safe State and what is its use in deadlock avoidance?
When a process requests an available resource, system must decide if immediate allocation
leaves the system in a safe state. System is in safe state if there exists a safe sequence of all
processes. Deadlock Avoidance: ensure that a system will never enter an unsafe state.

22. What is starvation and aging?


Starvation is Resource management problem where a process does not get the resources it
needs for a long time because the resources are being allocated to other processes.

23. What is a Safe State and its’ use in deadlock avoidance?


When a process requests an available resource, system must decide if immediate allocation
leaves the system in a safe state
 System is in safe state if there exists a safe sequence of all processes.
 Sequence is safe if for each Pi, the resources that Pi can still request can be satisfied
by currently available resources + resources held by all the Pj, with j If Pi resource
needs are not immediately available, then Pi can wait until all Pj have finished. When
Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and
terminate. When Pi terminates, Pi+1 can obtain its needed resources, and so on.
 Deadlock Avoidance Þ ensure that a system will never enter an unsafe state.

24. Recovery from Deadlock?


 Process Termination:
->Abort all deadlocked processes.
->Abort one process at a time until the deadlock cycle iseliminated.
->In which order should we choose to abort?
 Priority of the process.
How long process has computed, and how much longer tocompletion.
Resources the process has used.
Resources process needs to complete.
How many processes will need to be terminated?
Is process interactive or batch?
 Resource Preemption:
->Selecting a victim – minimize cost.
->Rollback – return to some safe state, restart process for thatstate.
->Starvation – same process may always be picked as victim,include number of
rollback in cost factor.
25. What is semaphore?
Semaphore is a variable whose status reports common resource, semaphore is of two types
one is Binary semaphore and other is Counting semaphore.
26. What is difference between binary semaphore and mutex?
 Mutex is used exclusively for mutual exclusion.
 Both mutual exclusion and synchronization can be used by binary.
 Mutex is given only through the task which takes mutex.
 Options for making the task which takes as DELETE_SAFE are provided by Mutex,
which means the task deletion is not possible when holding the mutex.

27. Why paging is used?


Paging is solution to external fragmentation problem which is to permit the logical address
space of a process to be non-contiguous, thus allowing a process to be allocating physical
memory wherever the latter is available.

28. What is virtual memory?


Virtual memory is memory management technique which is used to execute the process
which has more than actual memory size.

29. What is Demand Paging?


It is memory management technique used in virtual memory such that page will not load
into the memory until it is needed.

30. What are all page replacement algorithms?


a. FIFO(First in First out)
2. Optimal Page Replacement
3. LRU(Least-Recently-used)

31. Which page replacement algorithm will have less page fault rate?
Optimal Page Replacement
32. What is thrashing?
It is situation that CPU spends more time on paging than executing.

33. What is swapping


A process must be in memory to be executed. A process, however, can be swapped
temporarily out of memory to a backing store and then brought back into memory for
continued execution. This process is called swapping.

34. What is fragmentation?


fragmentation is a phenomenon in which storage space is used inefficiently, reducing
capacity or performance.
35. Explain External fragmentation?
As processes are loaded and removed from memory, the free memory space is broken
into little pieces. External fragmentation exists when there is enough total memory space
to satisfy a request, but the available spaces are not contiguous.

36. Explain Internal fragmentation?


Consider a multiple-partition allocation scheme with a hole of 18,464 bytes. Suppose that
the next process requests 18,462 bytes. If we allocate exactly the requested block, we are
left with a hole of 2 bytes. The overhead to keep track of this hole will be substantially
larger than the hole itself. The general approach to avoiding this problem is to break the
physical memory into fixed-sized blocks and allocate memory in units based on block
size. With this approach, the memory allocated to a process may be slightly larger than
the requested memory. The difference between these two numbers is internal
fragmentation.

37. What is paging?


Paging is a memory-management scheme that permits the physical address space of a
process to be non-contiguous. Paging avoids the considerable problem of fitting memory
chunks of varying sizes onto the backing store.

38. What is frame?


Breaking main memory into fixed number of blocks called frames.

39. What is page?


Breaking logical memory into blocks of same size is page.

40. What is the best page size when designing an operating system?
The best paging size varies from system to system, so there is no single best when it
comes to page size. There are different factors to consider in order to come up with a
suitable page size, such as page table, paging time, and its effect on the overall efficiency
of the operating system.

41. What is virtual memory?


Virtual memory is hardware technique where the system appears to have more memory that
it actually does. This is done by time-sharing, the physical memory and storage parts of the
memory one disk when they are not actively being used.

42. What is Throughput, Turnaround time, waiting time and Response time?
Throughput – number of processes that complete their execution per time unit. Turnaround
time – amount of time to execute a particular process. Waiting time – amount of time a
process has been waiting in the ready queue. Response time – amount of time it takes from
when a request was submitted until the first response is produced, not output (for time-
sharing environment).

43. Explain Belady's Anomaly?


Also called FIFO anomaly. Usually, on increasing the number of frames allocated to a
process virtual memory, the process execution is faster, because fewer page faults occur.
Sometimes, the reverse happens, i.e., the execution time increases even when more
frames are allocated to the process. This is Belady's Anomaly. This is true for certain
page reference patterns.

44. What is fragmentation? Different types of fragmentation?


Fragmentation occurs in a dynamic memory allocation system when many of the free
blocks are too small to satisfy any request.
 External Fragmentation: External Fragmentation happens when a dynamic memory
allocation algorithm allocates some memory and a small piece is left over that cannot
be effectively used. If too much external fragmentation occurs, the amount of usable
memory is drastically reduced. Total memory space exists to satisfy a request, but it is
not contiguous
 Internal Fragmentation: Internal fragmentation is the space wasted inside of allocated
memory blocks because of restriction on the allowed sizes of allocated blocks.
Allocated memory may be slightly larger than requested memory; this size difference
is memory internal to a partition, but not being used Reduce external fragmentation
by compaction
->Shuffle memory contents to place all free memory together in one large block.
->Compaction is possible only if relocation is dynamic, and is done at execution time.

45. Explain Segmentation with paging?


Segments can be of different lengths, so it is harder to find a place for a segment in
memory than a page. With segmented virtual memory, we get the benefits of virtual
memory but we still have to do dynamic storage allocation of physical memory. In order
to avoid this, it is possible to combine segmentation and paging into a two-level virtual
memory system. Each segment descriptor points to page table for that segment. This give
some of the advantages of paging (easy placement) with some of the advantages of
segments (logical division of the program).

46. Under what circumstances do page faults occur? Describe the actions taken by the operating
system when a page fault occurs?
A page fault occurs when an access to a page that has not been brought into main
memory takes place. The operating system verifies the memory access, aborting the
program if it is invalid. If it is valid, a free frame is located and I/O is requested to read
the needed page into the free frame. Upon completion of I/O, the process table and page
table are updated and the instruction is restarted

47. Define the basic functions of assembler.


* Translating mnemonic operation codes to their machine language
equivalents.
* Assigning machine addresses to symbolic labels used by the
programmer.
48. What is meant by assembler directives? Give example.
These are the statements that are not translated into machine instructions, but they provide
instructions to assembler itself.
example START,END,BYTE,WORD,RESW and RESB.
49. What are forward references?
It is a reference to a label that is defined later in a program.
Consider the statement
10 1000 STL RETADR
....
....
80 1036 RETADR RESW 1
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.

50. What are the three different records used in object program?
The header record, text record and the end record are the three different records used in
object program.
The header record contains the program name, starting address and
length of the program.
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 the program
where execution is to begin.
51. What is the need of OPTAB (operation code table) in assembler?
The operation code table contains the mnemonic operation code and its
machine language equivalent. Some assemblers it may also contain information about
instruction format and length. OPTAB is usually organized as a hash table, with mnemonic
operation code as the key.
52. . Write the steps required to translate the source program to object program.
• Convert mnemonic operation codes to their machine language
equivalents.
• Convert symbolic operands to their equivalent machine addresses
• Build the machine instruction in the proper format.
• Convert the data constants specified in the source program into their internal machine
representation
• Write the object program and assembly listing.
53. What are the two different types of jump statements used in MASM assembler?
• Near jump
A near jump is a jump to a target in the same segment and it is
assembled by using a current
code segment CS.
• Far jump
A far jump is a jump to a target in a different code segment and it is
assembled by using different segment registers .
54. What is meant by external references?
Assembler program can be divided into many sections known as control
sections and each control section can be loaded and relocated independently of the 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.
55. What are the basic functions of loaders?
• Loading – brings the object program into memory for execution
• Relocation – modifies the object program so that it can be loaded at an address different
from the location originally specified
• Linking – combines two or more separate object programs and also
supplies the information needed to reference them.
56. . Define macro processor.
Macro processor is system software that replaces each macro instruction with the
corresponding group of source language statements. This is also called as expanding of
macros.
57. What do macro expansion statements mean?
These statements give the name of the macro instruction being invoked
and the arguments to be used in expanding the macros. These statements are also known as
macro call.
58. What are the directives used in macro definition?
MACRO - it identifies the beginning of the macro definition
MEND - it marks the end of the macro definition
59. What are the data structures used in macro processor?
DEFTAB – the macro definitions are stored in a definition table i.e. it contains a macro
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 macro
definition in DEFTAB. it also serves as an index to DEFTAB
ARGTAB – it is used to store the arguments during the expansion of macro invocations.
60. Define conditional macro expansion.
If the macro is expanded depends upon some conditions in macro
definition (depending on the arguments supplied in the macro expansion) then it is called as
conditional macro expansion.
61. What is the use of macro time variable?
Macro time variable can be used to store working values during the macro expansion. Any
symbol that begins with the character & and then is not a macro instruction parameter is
assumed to be a macro time variable.
62. What are the statements used for conditional macro expansion?
IF-ELSE-ENDIF statement
WHILE-ENDW statement
63. What is meant by positional parameters?
If the parameters and arguments were associated with each other
according to their positions in the macro prototype and the macro invocation statement, then
these parameters in macro definitions are called as positional parameters.

64. What are known as nested macro call?


The statement, in which a macro calls on another macro, is called nested macro call. In the
nested macro call, the call is done by outer macro and the macro called is the inner macro.
65. How the macro is processed using two passes?
Pass1: processing of definitions
Pass 2:actual-macro expansion.
66. Give the advantage of line by line processors.
• 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 that can be loaded
once.
67. What is meant by line by line processor?
This macro processor reads the source program statements, process the
statements and then the output lines are passed to the language translators as they are
generated, instead of being written in an expanded file.
68. Give the advantages of general-purpose macro processors.
• The programmer does not need to learn about a macro facility for each compiler.
• Overall saving in software development cost and maintenance cost.
69. What is meant by general-purpose macro processors?
The macro processors that are not dependent on any particular
programming language, but can be used with a variety of different languages are known as
general purpose macro processors.
Eg. The ELENA macro processor.
70. What are the important factors considered while designing general purpose macro
processors?
• comments
• grouping of statements
• tokens
• syntax used for macro definitions
71. How the nested macro calls are executed?
The execution of nested macro call follows the LIFO rule. In case of nested macro calls the
expansion of the latest macro call is completed first.
72. Mention the tasks involved in macro expansion.
• identify the macro calls in the program
• the values of formal parameters are identified
• maintain the values of expansion time variables declared in a macro
• expansion time control flow is organized
• determining the values of sequencing symbols
• expansion of a model statement is performed
73. How to design the pass structure of a macro assembler?
To design the structure of macro-assembler, the functions of macro
pre-processor and the conventional assembler are merged. After merging, the functions are
structured into passes of the macro assembler.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy