Operating System and Virtualization Winter 2022 GTU Paper Solution | 3141601

Here, We provide Operating System and Virtualization GTU Paper Solution Winter 2022. Read the Full OSV GTU paper solution given below.

Operating System and Virtualization GTU Old Paper Winter 2022 [Marks : 70] : Click Here

(a) Describe the four conditions that create deadlock.

Deadlock occurs when a group of processes are blocked and unable to proceed because they are all waiting for each other to release resources. Deadlock can arise under the following four necessary conditions:

  1. Mutual Exclusion: At least one resource must be held in a non-shareable mode, meaning that only one process at a time can use it. While a process holds a resource, no other process can use it.
  2. 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. In other words, a process cannot release a resource that it currently holds until it acquires all the resources it needs.
  3. No Preemption: Resources cannot be forcibly removed from a process that is holding them. In other words, a process cannot be interrupted and have its resources taken away, as that may cause data loss or corruption.
  4. Circular Wait: A set of two or more processes must be waiting for each other to release resources, forming a circular chain of dependencies. For example, Process A is waiting for Resource X, which is being held by Process B, and Process B is waiting for Resource Y, which is being held by Process C, and so on, until Process N is waiting for Resource X, which is being held by Process A.

(b) Differentiate between single threaded and multithreaded process models.

(c) Consider the following scenario of processes for Round Robin
Scheduling with time quantum 2.

Process Arrival Time Execution Time
P1 0 9
P2 1 5
P3 2 3
P4 3 4

Draw the Gantt chart for the execution of processes, showing their start
time and end time. Calculate average turnaround time and average
waiting time of the processes.
Examine the effect if time quantum is too large and too small.

(a) Describe the two strategies for providing processor resources in a virtual

In a virtual environment, there are two primary strategies for providing processor resources to virtual machines (VMs):

  1. Dedicated Resource Allocation: In this strategy, the hypervisor allocates dedicated physical CPU cores or logical processors to each VM. Each VM has exclusive access to its allocated resources and can utilize them without any interference from other VMs. This approach provides predictable performance and can ensure that each VM gets the required amount of processing power to run its workloads efficiently. However, it can lead to underutilization of CPU resources, as some VMs may not utilize their allocated resources fully, leading to wasted CPU cycles.
  2. Shared Resource Allocation: In this strategy, the hypervisor allows multiple VMs to share physical CPU resources, such as CPU cores or logical processors. The hypervisor schedules CPU time for each VM in a fair manner, ensuring that each VM gets a proportional share of CPU resources based on its resource allocation settings. This approach provides better CPU utilization, as idle CPU cycles from one VM can be utilized by other VMs. However, shared resource allocation can lead to performance degradation if multiple VMs require high CPU utilization simultaneously, leading to competition for CPU resources and potential resource contention.

(b) Describe hardware approaches to mutual exclusion.

(c) Consider a disk queue with I/O requests of the following cylinders in
their arriving order 6,10,12,54,97,73,128,15,44,110,34,45
The disk head is assumed to be at Cylinder 23 and moving in the direction
of decreasing number of cylinders. The disk consists of total 150
cylinders. Calculate the disk head movement using SCAN and C -SCAN
scheduling algorithm.

(c) Calculate the number of page faults for the following reference string
using LRU(Least recently used) page replacement algorithm with frame
size as 3.
5 0 2 1 0 3 0 2 4 3 0 3 2 1 3 0 1 5

(a) Describe characteristics of monitor.

A monitor is a synchronization construct that allows concurrent access to shared resources in a mutually exclusive manner. Here are some of the characteristics of a monitor:

  1. Mutual exclusion: A monitor ensures mutual exclusion by allowing only one process to execute within it at any given time. This is accomplished by the monitor’s internal lock, which is acquired by a process before accessing the shared resource.
  2. Condition synchronization: A monitor provides condition variables that allow processes to wait for certain conditions to be true before proceeding. Condition variables are used to prevent busy waiting and improve the efficiency of the system.
  3. Data abstraction: A monitor provides an abstraction layer that hides the implementation details of the shared resource from the processes that use it. This allows the shared resource to be modified without affecting the processes that use it.
  4. Blocking: When a process attempts to enter a monitor that is already locked, it is blocked and added to a queue associated with the monitor. The process is then unblocked when the monitor becomes available, and it is allowed to enter the monitor.
  5. Atomicity: All operations on the shared resource are atomic, meaning that they are executed as a single, indivisible operation. This ensures that the shared resource remains consistent and that race conditions do not occur.
  6. Nested monitor calls: A monitor can be called from within another monitor, and the calling process will be granted access to the inner monitor only after releasing the lock on the outer monitor. This prevents deadlocks from occurring when multiple processes attempt to enter nested monitors.

(b) Write Peterson’s solution for achieving mutual exclusion.

(c) Write the different states a process can hold. Explain the types of events
that lead to each state transition for a process.


(a) Segmentation suffers from internal fragmentation or external
fragmentation? Justify.

Segmentation is a memory management scheme that divides the memory into variable-sized logical segments, each representing a specific part of the program, such as code, data, or stack. These segments are independent of each other and can grow or shrink dynamically during program execution.

Segmentation can suffer from both internal and external fragmentation.

Internal fragmentation occurs when a segment is allocated more memory than it actually needs. This can happen when a segment’s size is not an exact multiple of the memory allocation unit, such as a page size. As a result, the excess memory is wasted and cannot be used by other segments, leading to internal fragmentation.

External fragmentation occurs when there is enough free memory available in the system, but it is fragmented into small, non-contiguous blocks. When a process requests memory allocation, it may not be able to find a large enough contiguous block of memory to satisfy its request, even though the total free memory is sufficient. This can result in external fragmentation.

However, segmentation is generally more susceptible to internal fragmentation than external fragmentation. This is because each segment has its own size and memory requirements, which makes it difficult to allocate memory exactly as needed. Also, when a segment grows or shrinks, it may leave behind small unused holes or gaps, leading to internal fragmentation.

In contrast, paging, which is another memory management scheme, suffers mainly from external fragmentation, as it allocates memory in fixed-sized pages that can be easily arranged into a contiguous block. Also, paging is less susceptible to internal fragmentation as the page size is usually chosen to be a multiple of the memory allocation unit, reducing the wastage of memory due to internal fragmentation.

(b) In a paging scheme,16 bit addresses are used with a page size of 512 bytes.
If the logical address is 0000010001111101, how many bits are used for
the page number and offset? What will be the physical address, if the
frame address corresponding to the computed page number is 15.

(c) Describe the elements which uniquely characterize a process while
program is executing.

(a) Explain how resource allocation graph can depict the deadlock situation?

A resource allocation graph is a graphical representation of a system’s resource allocation and can be used to identify whether a deadlock has occurred in the system.

In a resource allocation graph, the resources and processes are represented as nodes, and the allocation of resources to processes is represented by directed edges from resource nodes to process nodes. Additionally, requests for resources are represented by directed edges from process nodes to resource nodes. If a process is waiting for a resource that is currently allocated to another process, a circular dependency or cycle is formed in the graph. If there is a cycle in the graph, it indicates that a deadlock has occurred.

The presence of a cycle in the graph implies that there is a circular chain of processes and resources, where each process is waiting for a resource that is held by another process in the chain. This situation results in a deadlock where none of the processes can proceed as they are all waiting for resources that are held by other processes in the cycle. Therefore, a resource allocation graph can depict the deadlock situation by identifying the cycle in the graph, which shows the dependencies between processes and resources.

(b) Explain the handling of multiple non interactive and multiple interactive
jobs in case of multiprogramming.

(c) Distinguish between
(i) Static and dynamic allocation of memory
(ii) Swapping and paging
(iii) Page, frame and segment


(a) Describe the two difficulties with the use of equal size fixed partitions.

(i) Static allocation of memory refers to the allocation of memory during the compilation or assembly of a program, whereas dynamic allocation of memory refers to the allocation of memory during the execution of the program.

(ii) Swapping and paging are two memory management techniques used by operating systems. Swapping involves moving an entire process from main memory to secondary storage, while paging involves dividing the process into fixed-size pages and moving only the required pages to and from main memory.

(iii) In a paging memory management scheme, the process is divided into fixed-size pages, whereas in a frame memory management scheme, the physical memory is divided into fixed-size frames. A segment is a logical unit of a program, such as a procedure or a data structure, which can be of variable size. Segmentation is a memory management scheme in which a process is divided into variable-sized segments.

(b) Explain how input output is managed in virtual environment.

(c) Consider the following scenario of processes with priority. If the
scheduling of processes is priority based, Draw the Gantt chart. Calculate
turnaround time and waiting time for each process. Also compute
average turnaround time and average waiting time for the system.

Process Arrival Time Execution Time Priority
P1 0 9 2
P2 1 5 1
P3 2 3 3
P4 3 4 4

(a) Describe the function of kernel in operating system.

The kernel is the core component of an operating system that manages system resources and provides services to user-level processes. It is responsible for managing memory, process scheduling, I/O operations, and security. Some of the key functions of the kernel include:

  1. Memory management: The kernel manages the memory resources of the system, including allocating and deallocating memory to processes, and managing virtual memory.
  2. Process management: The kernel manages the processes running on the system, including scheduling processes, providing inter-process communication, and handling process synchronization and deadlock prevention.
  3. Device management: The kernel manages the I/O devices of the system, including device drivers and interrupt handlers.
  4. File system management: The kernel provides a file system interface for user processes to access files and directories on the system.
  5. Security management: The kernel provides security services to protect the system and user processes from unauthorized access and malicious attacks.

(b) Give example of Best fit and worst fit memory allocation strategy.

(c) Consider a system with the following information. Determine whether
the system is in safe state. If not in safe state, give reasons. If the system
is in safe state, find the safe sequence of processes. Consider Need
assuming Maximum Allocation.
Total Resources(31)
Total Resources of R1 type – 15
Total Resources of R2 type – 8
Total Resources of R3 type – 8

Processes Max Alloc
R1 R2 R3 R1 R2 R3
1 5 6 3 2 1 0
2 8 5 6 3 2 3
3 4 9 2 3 0 2
4 7 4 3 3 2 0
5 4 3 3 1 0 1


(a) Differentiate the preemptive and nonpreemptive scheduling.

Preemptive and non-preemptive scheduling are two different approaches used by the operating system for scheduling processes.

Preemptive Scheduling:

In preemptive scheduling, the currently executing process can be interrupted by the operating system to allow another process to execute. The time quantum is defined for each process, and when a process has exceeded its time quantum, the operating system preemptively interrupts the execution of the process and moves it to the ready queue. This approach ensures that all processes get a fair share of CPU time, but the context switch overhead is higher as the operating system has to save and restore the state of the interrupted process.

Non-Preemptive Scheduling:

In non-preemptive scheduling, the currently executing process continues to execute until it voluntarily relinquishes the CPU, either by waiting for I/O, terminating, or being blocked for some other reason. In this approach, the process completes its execution without any interference from the operating system, and only then the next process is selected from the ready queue. This approach is simple to implement, but it may lead to some processes monopolizing the CPU, resulting in other processes experiencing long waiting times.

To summarize, preemptive scheduling is characterized by the interruption of currently executing processes, while non-preemptive scheduling allows the current process to execute to completion before selecting the next process.

(b) Describe Linux VServer architecture.

(c) Discuss the race condition in producer- consumer problem. Discuss the
use of semaphore to solve producer-consumer problem. Also Discuss the
solution of producer consumer problem with message passing.

“Do you have the answer to any of the questions provided on our website? If so, please let us know by providing the question number and your answer in the space provided below. We appreciate your contributions to helping other students succeed.”