OS Answer Key
OS Answer Key
Part-A
3. Define throughput
If the CPU is busy executing processes, then work is being done. One measure of work is
the number of processes that are completed per time unit, called throughput. For long processes,
this rate may be one process per hour; for short transactions, it may be ten processes per second.
From the point of view of a particular process, the important criterion is how long it takes
to execute that process. The interval from the time of submission of a process to the time of
completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to
get into memory, waiting in the ready queue, executing on the CPU, and doing I/O
7. Give two hardware instructions and their definitions which can be used for implementing
mutual exclusion
Locks and semaphores are the two hardware instructions for implementing mutual
exclusion.
Semaphores is the process when the message to send will be send by holding two
flags, in a specified manner based on the alphabet code.
Lock is the process of securing the database with some password.
8. What is semaphore
9. Define swapping
Further, virtual memory abstracts main memory into an extremely large, uniform
array of storage, separating logical memory as viewed by the user from physical
memory
Part-B
First Come First Serve (FCFS) is an operating system scheduling algorithm that
automatically executes queued requests and processes in order of their arrival. It is the easiest
and simplest CPU scheduling algorithm. In this type of algorithm, processes which requests the
CPU first get the CPU allocation first. This is managed with a FIFO queue. The full form of
FCFS is First Come First Serve.
As the process enters the ready queue, its PCB (Process Control Block) is linked with the
tail of the queue and, when the CPU becomes free, it should be assigned to the process at the
beginning of the queue.
Advantages of FCFS
4
Easy to program
First come first served
Disadvantages of FCFS
Here, are cons/ drawbacks of using FCFS scheduling algorithm:
It is a Non-Preemptive CPU scheduling algorithm, so after the process has been allocated
to the CPU, it will never release the CPU until it finishes executing.
The Average Waiting Time is high.
Short processes that are at the back of the queue have to wait for the long process at the
front to finish.
Not an ideal technique for time-sharing systems.
Because of its simplicity, FCFS is not very efficient.
1. Contention scope – Control scope defines the extent to which contention takes place.
Contention refers to the competition among the ULTs to access the KLTs.
Contention scope can be further classified into Process Contention Scope
(PCS) and System Contention Scope (SCS).
Process Contention Scope: Process Contention Scope is when the contention takes
place in the same process.
5
System contention scope (SCS): System Contention Scope refers to the contention that
takes place among all the threads in the system.
2. Allocation domain – The allocation domain is a set of multiple (or single) resources for
which a thread is competing.
Advantages of PCS over SCS:
The purpose of the swapping in operating system is to access the data present in the hard
disk and bring it to RAM so that the application programs can use it. The thing to remember is
that swapping is used only when data is not present in RAM.
Although the process of swapping affects the performance of the system, it helps to run
larger and more than one process. This is the reason why swapping is also referred to as
memory compaction.
The concept of swapping has divided into two more concepts: Swap-in and Swap-out.
o swap-out is a method of removing a process from RAM and adding it to the hard disk.
o Swap-in is a method of removing a program from a hard disk and putting it back into the
main memory or RAM.
Example: Suppose the user process's size is 2048KB and is a standard hard disk where
swapping has a data transfer rate of 1Mbps. Now we will calculate how long it will take to
transfer from main memory to secondary memory.
Advantages of Swapping
1. It helps the CPU to manage multiple processes within a single main memory.
6
Disadvantages of Swapping
1. If the computer system loses power, the user may lose all information related to the
program in case of substantial swapping activity.
2. If the swapping algorithm is not good, the composite method can increase the number of
Page Fault and decrease the overall processing performance.