Question from operating system
1)
A thread is a
A)
Task
B)
Program
C)
Process
D)
Light-weight process
উত্তর:-
Light-weight process
বিবরণ:-
2)
A page fault occurs
A)
when the page is not in the memory
B)
when the page is in the memory
C)
when the process enters the blocked state
D)
when the process is in the ready state
উত্তর:-
when the page is not in the memory
বিবরণ:-
3)
What is a shell ?
A)
It is a hardware component
B)
It is a command interpreter
C)
It is a part in compiler
D)
It is a tool in CPU scheduling
উত্তর:-
It is a command interpreter
বিবরণ:-
4)
Banker's algorithm for resource allocation deals with
A)
Deadlock prevention
B)
Deadlock avoidance
C)
Deadlock recovery
D)
Mutual exclusion
উত্তর:-
Deadlock avoidance
বিবরণ:-
5)
The time spent by a process in ready queue is called
A)
waiting time
B)
turnaround time
C)
response time
D)
none of these
উত্তর:-
waiting time
বিবরণ:-• Arrival Time: Time at which the process arrives in the ready queue.
• Completion Time: Time at which the process completes its execution.
• Burst Time: Time required by a process for CPU execution.
• Turn Around Time: Time Difference between completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time
• Waiting Time(W.T): Time Difference between turn around time and burst time.
Waiting Time = Turn Around Time – Burst Time
Response time is the total amount of time it takes to respond to a request for service.
6)
Variable partition memory allocation can lead to
A)
external fragmentation
B)
internal fragmentation
C)
both A) and B)
D)
none of these
উত্তর:-
external fragmentation
বিবরণ:-Variable (or dynamic) Partitioning in Operating System
Variable partitioning is part of the contiguous allocation technique. It is used to alleviate the problem faced by fixed partitioning. As opposed to fixed partitioning, in variable partitioning, partitions are not created until a process executes. At the time it is read into main memory, the process is given exactly the amount of memory needed. This technique, like the fixed partitioning scheme previously discussed have been replaced by more complex and efficient techniques.
Various features associated with variable partitioning.
• Initially RAM is empty and partitions are made during the run-time according to process’s need instead of partitioning during system configure.
• The size of partition will be equal to incoming process.
• The partition size varies according to the need of the process so that the internal fragmentation can be avoided to ensure efficient utilisation of RAM.
• Number of partitions in RAM is not fixed and depends on the number of incoming process and Main Memory’s size.
Advantages of Variable Partitioning
1. No Internal Fragmentation:
In variable Partitioning, space in main memory is allocated strictly according to the need of process, hence there is no case of internal fragmentation. There will be no unused space left in the partition.
2. No restriction on Degree of Multiprogramming:
More number of processes can be accommodated due to absence of internal fragmentation. A process can be loaded until the memory is empty.
3. No Limitation on the size of the process:
In Fixed partitioning, the process with the size greater than the size of the largest partition could not be loaded and process can not be divided as it is invalid in contiguous allocation technique. Here, In variable partitioning, the process size can’t be restricted since the partition size is decided according to the process size.
Disadvantages of Variable Partitioning
1. Difficult Implementation:
Implementing variable Partitioning is difficult as compared to Fixed Partitioning as it involves allocation of memory during run-time rather than during system configure.
2. External Fragmentation:
There will be external fragmentation inspite of absence of internal fragmentation.
For example, suppose in above example- process P1(2MB) and process P3(1MB) completed their execution. Hence two spaces are left i.e. 2MB and 1MB. Let’s suppose process P5 of size 3MB comes. The empty space in memory cannot be allocated as no spanning is allowed in contiguous allocation. The rule says that process must be contiguously present in main memory to get executed. Hence it results in External Fragmentation.
7)
SPOOLING stands for
A)
Spontaneous Peripheral Operation Online
B)
Small Peripheral Operation Online
C)
Simultaneous Peripheral Operation Online
D)
None of these
উত্তর:-
Simultaneous Peripheral Operation Online
বিবরণ:-
8)
Scheduling a process from Ready Queue to CPU is done by
A)
Short Term Scheduler
B)
Middle Term Scheduler
C)
Long Term Scheduler
D)
Dispatcher
উত্তর:-
Short Term Scheduler
বিবরণ:-
9)
The default remedy of starvation is
A)
ageing
B)
critical section
C)
mutual exclusion
D)
all of these
10)
Which of the following algorithm generally suffers from Belady's anomaly
A)
Optimal
B)
FIFO
C)
LRU
D)
all of these
উত্তর:-
FIFO
বিবরণ:-• A page fault occurs when a page is not found in the memory and needs to be loaded from the disk.
• If a page fault occurs and all memory frames have been already allocated, then the replacement of a page in memory is required on the request of a new page. This is referred to as demand-paging.
• The choice of which page to replace is specified by page replacement algorithms. The commonly used page replacement algorithms are FIFO, LRU, optimal page replacement algorithms, etc.
• Generally, on increasing the number of frames to a process’ virtual memory, its execution becomes faster as fewer page faults occur. Sometimes the reverse happens, i.e. more page faults occur when more frames are allocated to a process. This most unexpected result is termed Belady’s Anomaly.
• This phenomenon is commonly experienced in the following page replacement algorithms:
1. First in first out (FIFO)
2. Second chance algorithm
Random page replacement algorithm
11)
Page stealing is
A)
a sign of efficient system
B)
taking larger disk space's for pages paged out
C)
taking page frames from other working sets
D)
one of the tuning goals
উত্তর:-
taking page frames from other working sets
বিবরণ:-
12)
IPC stands for
A)
Internal Program Controller
B)
Internal Process Control
C)
Interprocess Communication
D)
None of these
উত্তর:-
Interprocess Communication
বিবরণ:-
13)
Suppose that a process is in BLOCKED state waiting from some I/O service. When the service is completed, it goes to the
A)
RUNNING state
B)
READY state
C)
SUSPENDED state
D)
TERMINATED state
উত্তর:-
READY state
বিবরণ:-A process state diagram for pre-emptive scheduling is:
New
A program which is going to be picked up by the OS into the main memory is called a new process.
Ready
Whenever a process is created, it directly enters in the ready state, in which, it waits for the CPU to be assigned. The OS picks the new processes from the secondary memory and put all of them in the main memory.
Running
One of the processes from the ready state will be chosen by the OS depending upon the scheduling algorithm. Hence, if we have only one CPU in our system, the number of running processes for a particular time will always be one.
Block or wait
From the Running state, a process can make the transition to the block or wait state depending upon the scheduling algorithm or the intrinsic behavior of the process.
Completion or termination
When a process finishes its execution, it comes in the termination state. All the context of the process (Process Control Block) will also be deleted the process will be terminated by the Operating system.
Suspend ready
A process in the ready state, which is moved to secondary memory from the main memory due to lack of the resources (mainly primary memory) is called in the suspend ready state.
Suspend wait
Instead of removing the process from the ready queue, it's better to remove the blocked process which is waiting for some resources in the main memory. Since it is already waiting for some resource to get available hence it is better if it waits in the secondary memory and make room for the higher priority process.
14)
The general structure of a process consists of
A)
critical section
B)
reminder section
C)
race condition
D)
both A) and B)
উত্তর:-
both A) and B)
বিবরণ:-There are basically four main sections through which each of the process has to pass through. The universal algorithm is:-
Critical section:-
Consider a system consist of n processes P0 to Pn every process has a segment of code, called as critical section, in which the process perhaps changing common variables updating a table, writing a file and so on. Therefore critical section is that area of code in which the processors try to access the shared information. Therefore critical section occurs in the area where race condition occurs.
Entry section:-
Code just previous to the critical section is termed as the entry section. Every processor must request permission to enter into the critical section, the area of code which execute this request is called as the entry section.
Exit section:-
The code segment just subsequent to the critical section is termed as exit section.
Remainder section:-
The code remaining subsequent to the exit section is remainder section.
15)
Which is the fastest of the following?
A)
Cache memory
B)
RAM
C)
CD-ROM
D)
Register
16)
Round Robin, scheduling scheduling is essentially the preemptive version of
A)
FIFO
B)
Shortest Job First
C)
Shortest Remaining Time First
D)
Longest Time First.
17)
The number of processes completed per unit time is known as
A)
Output
B)
Throughput
C)
Efficiency
D)
Capacity
উত্তর:-
Throughput
বিবরণ:-
18)
The mechanism that brings a page into memory only when it is needed, is called
A)
Segmentation
B)
Fragmentation
C)
Demand paging
D)
Page and replacement
উত্তর:-
Demand paging
বিবরণ:-
19)
Which of the following resources can cause deadlocks?
A)
Read only files
B)
Shared programs
C)
Printers
D)
All of these
20)
In order to allow only one process to enter its critical section, binary semaphores are initialized to
A)
0
B)
1
C)
2
D)
3
উত্তর:-
1
বিবরণ:-Concept:
Semaphore is a counting variable used to synchronize the processes. Two atomic operations that can be performed are wait and signal.
Explanation:
Wait:
It controls the entry of processes in the critical section. When semaphore value becomes negative or zero, then process is blocked. It decreases the value of semaphore by 1.
Signal:
It controls the exit of processes from the critical section. It increases the value of semaphore by 1.
So, in order to allow only one process to enter the critical section, binary semaphore is initialized to 1. Because after entering critical section, semaphore values become 0. After this, no other process can enter the critical section.