0% found this document useful (0 votes)
19 views26 pages

Important Instructions To Examiners:: Winter - 2024 Examination Model Answer - Only For The Use of RAC Assessors

The document provides model answers for the Winter 2024 examination in Operating Systems, detailing important instructions for examiners regarding assessment criteria. It includes questions and answers on various topics such as command line and GUI operating systems, system calls, process control blocks, CPU and I/O burst cycles, and scheduling criteria. Additionally, it outlines conditions for deadlock and differentiates between user-level and kernel-level threads, emphasizing the importance of understanding over exact wording in responses.

Uploaded by

amanukey107
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)
19 views26 pages

Important Instructions To Examiners:: Winter - 2024 Examination Model Answer - Only For The Use of RAC Assessors

The document provides model answers for the Winter 2024 examination in Operating Systems, detailing important instructions for examiners regarding assessment criteria. It includes questions and answers on various topics such as command line and GUI operating systems, system calls, process control blocks, CPU and I/O burst cycles, and scheduling criteria. Additionally, it outlines conditions for deadlock and differentiates between user-level and kernel-level threads, emphasizing the importance of understanding over exact wording in responses.

Uploaded by

amanukey107
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/ 26

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Important Instructions to examiners:


1) The answers should be examined by key words and not as word-to-word as given in the
model answer scheme.
2) The model answer and the answer written by candidate may vary but the examiner may
try to assess the understanding level of the candidate.
3) The language errors such as grammatical, spelling errors should not be given more
Importance (Not applicable for subject English and Communication Skills).
4) While assessing figures, examiner may give credit for principal components indicated in
the figure. The figures drawn by candidate and model answer may vary. The examiner
may give credit for any equivalent figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed
constant values may vary and there may be some difference in the candidate’s answers
and model answer.
6) In case of some questions credit may be given by judgement on part of examiner of
relevant answer based on candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on
equivalent concept.
8) As per the policy decision of Maharashtra State Government, teaching in English/Marathi
and Bilingual (English + Marathi) medium is introduced at first year of AICTE diploma
Programme from academic year 2021-2022. Hence if the students in first year (first and
second semesters) write answers in Marathi or bilingual language (English +Marathi), the
Examiner shall consider the same and assess the answer based on matching of concepts
with model answer.

Q. Sub Answer Marking


No Q.N. Scheme
1. Attempt any FIVE of the following: 10M
a) State any two command line based operating systems and two GUI based 2M
operating system
Ans. Command Line Based Operating Systems: MS-Dos, unix Correct
Type 1M
GUI Based Operating System: Microsoft Windows, Linux, Android, each
Apple iOS.
b) Define system call and enlist its types. 2M
Ans. System call provides an interface between a running program and Definition
1M
operating system. It allows user to access services provided by
Any Two
operating system. Types 1M
OR

Page 1 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

A system call is a method for a computer program to request a


service from the kernel of the operating system on which it is
running.
Types Of System Call
1.Process and Job Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
c) Define PCB with suitable diagram 2M
Ans. PCB: Process Control Block is a data structure that contains
information of the process related to it. The process control block is Definition
1M
also known as a task control block, entry of the process table, etc. Diagram
1M

d) Describe CPU and I/O burst cycle with suitable diagram 2M


Ans. CPU Burst:The time when the process is being executed in the CPU
is called CPU Burst cycle. Definition
1/2M each
OR
It is the amount of time required by a process or can be said the Diagram
amount of time required by the process to finish. 1M

I/O burst cycle: It is a time when process is busy in working with


I/O resources.

Page 2 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

e) State any four criteria in CPU scheduling 2M


Ans. Scheduling criteria: Four
Correct
1.CPU utilization. Criteria
2.Throughput. 1/2M each
3.Turnaround time.
4.Waiting time.
5. Response time.
f) Define the term paging 2M
Ans. Paging: The process of retrieving processes in the form of pages Correct
Definition
from the secondary storage into the main memory is known as 2M
paging.
g) Draw the structure of unix operating system 2M
Ans.
Correct
Diagram
2M

Page 3 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

2. Attempt any THREE of the following: 12M


a) Differentiate between multitasking and multiprogramming. 4M
Ans. Multiprogramming Multi-tasking Any four
It includes the single CPU It uses multiple tasks for the correct
points 1M
to execute the program. task allocation. each
Concept of Context Concept of Context Switching
Switching is used. and Time Sharing is used.
Switching occurs when the Switching occurs after the time
process currently running slice of the current process is
stops. finished.
Multi-programming In multi-tasking also increases
increases CPU utilization CPU utilization and it also
by organizing jobs . increases responsiveness.
The idea is to reduce the The idea is to further extend the
CPU idle time for as long CPU Utilization concept by
as possible. increasing responsiveness Time
Sharing.
It uses job scheduling Time sharing mechanism is
algorithms so that more used so that multiple tasks can
than one program can run run at the same time.
at the same time.
Execution of process takes Execution of process takes less
more time. time.
Throughput is less Throughput is moderate
Less Efficiency Moderate Efficiency

b) List activities performed in process management and file 4M


management Listing
activities of
Ans. 1.Process Management: each 2M
A program is a set of instructions. When CPU is allocated to a
program, it can start its execution. A program in execution is a
process. A word processing program run by a user on a PC is a
process. A process needs various system resources including CPU
time, memory, files and I/O devices to complete the job execution.
These resources can be given to the process when it is created or
allocated to it while it is running.

Page 4 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

The operating system responsible for the following activities in


connection with process management:
 Creation and deletion of user and system processes.
 Suspension and resumption of processes.
 A mechanism for process synchronization.
 A mechanism for process communication.
 A mechanism for deadlock handling.

2. File Management
A file is a collected of related information defined by its creator.
Computers can store files on the disk (secondary storage), which
provide long term storage. Some examples of storage media are
magnetic tape, magnetic disk and optical disk. Each of these media
has its own properties like speed, capacity, and data transfer rate and
access methods. A file system normally organized into directories to
ease their use. These directories may contain files and other
directions.

The operating system responsible for the following activities in


connection with file management:
 The creation and deletion of files.
 The creation and deletion of directions.
 The support of primitives for manipulating files and
directions.
 The mapping of files onto secondary storage.
 The backup of files on stable storage media.

c) Define the term inter process communication. Explain any one 4M


technique of IPC Correct
Definition
Ans. Inter-process communication: 1M
Cooperating processes require an Inter process communication (IPC)
mechanism that will allow them to exchange data and information. Diagram of
model 1M
There are two models of IPC
1.Shared memory Explanation
In this, all processes who want to communicate with other processes 2M

can access a region of the memory residing in an address space of a


process creating a shared memory segment. All the processes using

Page 5 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

the shared memory segment should attach to the address space of the
shared memory. All the processes can exchange information by
reading and/or writing data in shared memory segment. The form of
data and location are determined by these processes who want to
communicate with each other. These processes are not under the
control of the operating system. The processes are also responsible
for ensuring that they are not writing to the same location
simultaneously. After establishing shared memory segment, all
accesses to the shared memory segment are treated as routine
memory access and without assistance of kernel.

2.Message Passing
In this model, communication takes place by exchanging messages
between cooperating processes. It allows processes to communicate
and synchronize their actions without sharing the same address space.
It is particularly useful in a distributed environment when
communication process may reside on a different computer connected
by a network. Communication requires sending and receiving
messages through the kernel. The processes that want to
communicate with each other must have a communication link
between them. Between each pair of processes exactly one
communication link.

Page 6 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

d) Describe necessary conditions leading to deadlock 4M


Ans. Deadlock:
Deadlock is a situation when two or more processes get locked and Any four
cannot processed further because of inter-dependability. In real correct
world, deadlocks can arise when two persons wait for phone calls conditions
from one another. 1M each
OR
Deadlock is defined as, "a situation where a set of processes are
blocked because each process is holding a resource and waiting for
another resource acquired by some other process".

Necessary Conditions to Deadlock:

 Mutual Exclusion: At least one resource is 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. Each resource is
either currently assigned to exactly one process or is available.

 Hold and Wait: There must exist a process that is holding at least
one resource and is waiting to acquire additional resources that are
currently being held by another process. Process currently holding
resources granted earlier can request new resources.

 No Pre-emption: Resources cannot be pre-empted, i.e. resource


can only be released voluntarily by the process holding it, after the
process has completed its task. Resources previously granted
cannot be forcibly taken away from a process. They must be
explicitly released by the process holding them.

 Circular Wait: There exist a set (P0, P1, ----- Pn) of waiting
processes such that P0 is waiting for a resource which is held by
P1, P1 is waiting for a resource which is held by P2. Pn-1 is
waiting for resources which are held by Pn and Pn is waiting for a
resource which is held by P0. Thus, there must be a circular chain
of two or more processes, each of which is waiting for a resource
held by the next member of the chain.

Page 7 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

3. Attempt any THREE of the following: 12M


a) Difference between user level and kernel level thread. (Any four 4M
points) Any 4
Ans. Parameters User Level Thread Kernel Level Thread correct
points 1M
Implemente Kernel threads are
User threads are each
d by implemented by
implemented by user-
Operating System
level libraries.
(OS).
The operating System Kernel threads are
Recognize doesn‟t recognize user- recognized
level threads directly. by Operating System.
Context Context switch time is Context switch time is
switch time less. more.
No hardware support is
Hardware Hardware support is
required for context
support needed.
switching.
If one kernel thread
If one user-level thread
performs a blocking
Blocking performs a blocking
operation then another
operation operation then the entire
thread can continue
process will be blocked.
execution.
Multithreaded
Multithread applications cannot take Kernels can be
ing full advantage of multithreaded.
multiprocessing.
Creation
User-level threads can be Kernel-level level
and
created and managed threads take more time
Managemen
more quickly. to create and manage.
t
Any operating system Kernel-level threads
Operating
can support user-level are operating system-
System
threads. specific.
The application code
Thread doesn‟t contain thread
Managed by a thread
Managemen management code; it‟s
library at the user level.
t an API to the kernel
mode.
POSIX threads, Mach C- Java threads, POSIX
Example
Threads. threads on Linux.

Page 8 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Allows for true


Simple and quick to parallelism,
create, more portable, multithreading in
Advantages does not require kernel kernel routines, and
mode privileges for can continue execution
context switching. if one thread is
blocked.
Requires more time to
Cannot fully utilize
create/manage,
Disadvantag multiprocessing, entire
involves mode
es process blocked if one
switching to kernel
thread blocks.
mode.
b) Describe First Come First Served (FCFS) scheduling algorithm 4M
with example
Ans. Note: Any other relevant example shall be considered Explanation
2M
First Come First-Served (FCFS) Scheduling
FCFS scheduling is non preemptive algorithm. Once the CPU is
allocated to a process, it keeps the CPU until it releases the CPU, Example
either by terminating or by requesting I/O. In this algorithm, a 2M
process, that a request the CPU first, is allocated the CPU first. FCFS
scheduling is implemented with a FIFO queue. When a process enters
the ready queue, its PCB is linked to the tail of the queue. When the
CPU is available, it is allocated to the process at the head of the
queue. Once the CPU is allocated to a process, that process is
removed from the queue. The process releases the CPU by its own.
Example :
Process Burst Time
P1 24
P2 3
P3 3
Suppose that the processes arrive in the order: P1, P2, P3
The Gantt Chart for the schedule is:

• waiting time for P1 = 0; P2 = 24; P3 = 27


• Average waiting time: (0 + 24 + 27)/3 = 17

Page 9 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

c) Describe the concept of segmentation in Operating System with 4M


suitable example.
Segmentatio
Ans. Note: Any other relevant example shall be considered n 2M,
SEGMENTATION
 A user program can be subdivided using segmentation, in which (Diagram
the program and its associated data are divided into a number of optional)
segments. Example
 A segment is a logical unit such as main program, procedure, 2M
function, method, object, local variables, global variables,
common block, stack, symbol table, arrays etc
 In segmentation, the entire logical address space is considered as a
collection of segments with each segment having a number and a
length.
 The length of a segment may range from 0 to some maximum
value as specified by the hardware and may also change during the
execution. The user specifies each logical address consisting of a
segment number (s) and an offset (d).

The hardware architecture of segmentation and the use of a segment


table is illustrated in Figure. A logical address consists of two parts:

 A segment number: The segment number is used as an index to


the segment table. It is represented by s.
 An offset into that segment: It is represented by d. The offset d
of the logical address must be between 0 and the segment limit. If
it is not, we trap to the operating system (logical addressing
attempt beyond the end of the segment). When an offset is legal,
it is added to the segment base to produce the address in the
physical memory of the desired byte. The segment table is thus
essentially an array of base–limit register pairs.

Page 10 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Example: Consider the situation shown in the diagram. We have 5


segments numbered from 0 through 4. the segments are actually
stored in physical memory as shown in the diagram.
The Segment table has a separate entry for each segment, giving the
beginning address of the segment in physical memory & the length of
that segment.
for example: Segment 2 is 400 word long, beginning at location
4300. Thus reference to the word 53 of segment 2 is mapped on the
location: 4300+53=4353.
A reference to segment 3 word 852 is mapped to 3200 (the base
address of segment 3 )+ 852 =4052. a reference to word 1222 of
segment 0 would result in trap to the OS, Since this segment is only
1000 word long.
d) Describe Single level and two level directory structure 4M
Ans. Single-level directory:
 This is the simplest directory structure. All the files are stored in
Single level
the same directory which is easy to support and understand. But a directory
unique name must be assigned to each file. structure
 If the number of files in the directory increases, it may become explanation
difficult to remember names of all files. 2M
 Less time required to search the file, because all files are stored in
same directory.

Page 11 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Two-level directory: Two level


 A single level directory often leads to the confusion of file names directory
between different users. The solution here is to create separate structure
explanation
directory for each user.
2M
 In two level directories each user has its own directory. It is called
User File Directory (UFD). Each UFD has a similar structure, but
lists only the files of a single user.
 When a user job starts or users logs in, the systems Master File
Directory (MFD) is searched. The MFD is indexed by the user
name or account number and each entry points to the UFD for
that user.
 When a user refers to a particular file, only his own UFD is
searched. Thus different users may have files with the same name.
 To create a file for a user, OS searches only those users UFD to
ascertain whether another file of that name exists.
 To delete a file checks in the local UFD so that accidentally delete
another user‟s file with the same name.

4. Attempt any THREE of the following: 12M


a) Describe multiprocessor system with advantage and 4M
disadvantage.
Ans. Multiprocessor Operating System refers to the use of two or more
central processing units (CPU) within a single computer system. Explanation
● These multiple CPUs are in a close communication sharing the of
multiproces
computer bus, memory and other peripheral devices. These systems sor system
are referred as tightly coupled systems. 2M
● These types of systems are used when very high speed is required
(Diagram
to process a large volume of data. optional)

Page 12 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

● These systems are generally used in environment like satellite


control, weather forecasting etc.

Advantages: Any 1
1. Less time duration required for the large process. Advantage
1M,
2. Increase throughput. i.e. more work done in less time.
3. Economy of scale. Any 1
Disadvantag
4. Increased reliability. e
1M
Disadvantages:
1. If one processor fails then it will affect in speed.
2. These systems are expensive.
b) List and describe any four services of operating system 4M
Ans. Services of operating system
1)User interface
2) Program execution
3) I/O operations
4) File-system manipulation List any
5) Communications four
6) Error detection services
2M
7) Accounting
Description
(8) Resource allocation
of any 4
(9) Protection and security
1⁄2M each

Description of services of operating system


1. User interface: Almost all operating systems have a user interface
(UI).Almost all operating systems have a user interface (UI). It varies
between Command-Line (CLI), Graphics User Interface (GUI).

2. Program execution: The system must be able to load a program


into memory and to run that program, end execution, either normally
or abnormally (indicating error)

Page 13 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

3. I/O operations: - Since user programs cannot execute I/O


operations directly, the operating
system must provide some means to perform I/O. Each program
requires an input and produces output.
4. File-system manipulation: There are many details in file creation,
deletion, allocation, and
naming that users should not have to per-form. Blocks of disk space
are used by files and must be tracked. Deleting a file requires
removing the name file information and freeing the allocated blocks.
Protections must also be checked to assure proper file access.
5. Communications: Message passing between systems requires
messages to be turned into packets of information, sent to the net-
work controller, transmitted across a communications medium, and
reassembled by the destination system. Packet ordering and data
correction must take place. Again, user programs might not
coordinate access to the network device, or they might receive
packets destined for other processes.
6. Error detection: Error detection occurs at both the hardware and
software levels. At the hardware level, all data transfers must be
inspected to ensure that data have not been corrupted in transit.
7. Accounting: We may want to keep track at which users use how
much and what kind of computer resources. What was the login time
for a particular user; is he working on the system right now, what is
the process ID for the user, all such in formations we can manage
using accounting service provided by many multiuser systems.
8. Resource allocation: When there are multiple users or multiple
jobs running at the same time. Resources must be allocated to each of
them. Many different types of resources are managed by the operating
system.
9. Protection and security: The owners of information stored in
multiuser or networked computer system may want to control use of
the information. When several separate processes execute
concurrently, it should not be possible for one process to interfere
with the others or with the operating system itself, and protection
involves ensuring that all access to system resources is controlled.
Security of the system from outsiders is important.

Page 14 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

c) Describe the concept of scheduling queues with diagram 4M


Ans. Ready queue keeps the processes ready and waiting for CPU in a list
The ready queue is implemented as linked list. The header of ready Concept of
scheduling
queue points to the first and last Process Control Block and each PCB queues
has a pointer to next PCB in the ready queue. 2M
Device queue is a queue in which a list of processes waits for a
particular I/O device. Each device has its own device queue. Diagram
2M
Fig. shows the queuing diagram of process scheduling. queue is
represented by rectangular box. The circles represent the resources
that serve the queues. The arrows indicate the flow of processes in the
system.

Queues are of two types - Ready queue and I/O queue. A newly
arrived process is put in the ready queue. Processes are waiting in
ready queue for allocating the CPU. Once the CPU is assigned to the
process, then process will execute. While executing the process, one
of the several events could occur.

1. The process could issue an I/O request and then OS places it in an


I/O queue.
2. The process could create new sub process and waits for its
termination.
3. The process could be removed forcibly from the CPU, as a result of
interrupt and put back in the ready queue.

Page 15 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

d) Write steps of Banker’s algorithm to avoid deadlock 4M


Ans. Banker’s Algorithm:
This algorithm calculates resources allocated, required and available Correct
steps 4M
before allocating resources to any process to avoid deadlock. It
contains two matrices on a dynamic basis. Matrix A contains
resources allocated to different processes at a given time. Matrix B
maintains the resources which are still required by different processes
at the same time.
Algorithm F: Free resources
Step 1: When a process requests for a resource, the OS allocates it on
a trial basis.
Step 2: After trial allocation, the OS updates all the matrices and
vectors. This updating can be done by the OS in a separate work area
in the memory.
Step 3: It compares F vector with each row of matrix B on a vector to
vector basis.
Step 4: If F is smaller than each of the row in Matrix B i.e. even if all
free resources are allocated to any process in Matrix B and not a
single process can completes its task then OS concludes that the
system is in unstable state.
Step 5: If F is greater than any row for a process in Matrix B the OS
allocates all required resources for that process on a trial basis. It
assumes that after completion of process, it will release all the
recourses allocated to it. These resources can be added to the free
vector.
Step 6: After execution of a process, it removes the row indicating
executed process
from both matrices.
Step 7: This algorithm will repeat the procedure step 3 for each
process from the matrices and finds that all processes can complete
execution without entering unsafe state. For each request for any
resource by a process OS goes through all these trials of imaginary
allocation and updation. After this if the system remains in the safe
state, and then changes can be made in actual matrices.

e) Explain swapping in operating system with diagram and 4M


example.

Page 16 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Ans. Swapping:A process must be in the main memory so that it can Swapping
execute. Swapping is a memory/process management technique used explanation
by the operating system to increase the utilization of the processor. A 2M
process in execution may go into blocked state due to expiry of time
quantum, occurrence of interrupt,etc. when a process is in blocked
state and next process is waiting for execution then operating system
performs swapping. Swapping is a process of moving blocked Diagram
process from the main memory to the backing store and new process 1M
from backing store to main memory. Swapping forms a queue of
temporarily suspended process and the execution continues with the
Example
newly arrived process. 1M

In the above diagram, two processes P1 and P2 are shown. A process


P1 is in main memory and in blocked state. Process P2 is in backing
store waiting for its turn to execute .As P1 is blocked, operating
system swap out this process by moving it from main memory to
backing store and swap in process P2 by loading it from backing store
to main memory.
This process of swap out and swap in is called as swapping of
processes.

Example: Consider three processes P1,P2 and P3 are in memory. A


Round-Robin CPU scheduling algorithm is in use. A process P1 starts
its execution. When a time quantum expires memory manager swaps
out the process P1 and swaps in process P2. If P1 requires more time
than the time quantum then it is added to blocked queue and waits for
its turn for execution. Once a time quantum of P2 expires, manager

Page 17 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

swaps out it and swaps in P3. When time quantum of P3 expires,


manager swaps out it and swaps in P1. This cycle of swap out and
swap in continues till all the processes complete their execution.
5. Attempt any TWO of the following: 12M
a) Describe use of following commands with syntax: 6M
i) ps
ii) wait
iii) sleep
iv) kill
Ans. i) ps: Display the characteristics of process. The command invoked
without options simply lists out the processes associated with a
user at a particular terminal: Each
Syntax: ps [option] command’s
$ ps use
PID TTY TIME COMMAND/cmd 1M
30 01 0:03 sh Syntax of
56 01 0:00 ps each
$_ 1/2 M
Following are the some options:
Parameter Description

-a Displays all processes except session headers and


processes without a terminal.
-c Displays additional scheduler information about the
process.
-d Displays all processes except session headers.
-e Displays all processes.
-f Displays a full format listing.
-j Displays job information.
-l Displays a long listing.

ii) wait: wait is a built-in shell command which waits for a given
process to complete, and returns its exit status. wait waits for the
process identified by process ID pid (or the job specified by job
ID jobid), and reports its termination status.
Syntax: wait pid
Example: wait 2112
Wait for process 2112 to terminate, and return its exit status.

Page 18 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

iii) sleep: The sleep command is used to delay for a specified amount
of time. The sleep command pauses for an amount of time defined by
NUMBER. SUFFIX may be "s" for seconds (the default), "m" for
minutes, "h" for hours, or "d" for days.
Syntax: sleep NUMBER[suffix]
Example: sleep 10
Delay for 10 seconds.

iv)kill command
 The kill command will kill a process using the kill signal and
PID given by the user.
 The kill command allows you to send signals to processes based
on their process ID (PID).
 The command uses one or more PID numbers as its arguments.
Syntax:
kill [signal] PID
Kill pid1 pid2 ….

Example: To terminates the job with the PID number 105.


$ kill 105
b) Write two uses of following operating system tools: 6M
i) User management For uses of
ii) Security Policy each tool
2M
iii) Performance Monitor
Ans. i) User Management: As the administrator, it is your job to create
and manage the accounts for all required users. Linux comes with
several tools for user management. User management includes
everything from creating a user to deleting a user on your system.
Following are the Linux command line tools for managing users and
groups:
1. useradd.
2. usermod.
3. userdel.
Useradd: Creating New User: To add new users in Linux system we
can use useradd command.
Syntax: useraddlogin_name
Example: useraddxyz

Page 19 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

ii)Security Policy: Security refers to providing a protection system to


computer system resources such as CPU, memory, disk, software
programs and most importantly data/information stored in the
computer system. Following are the best practices for securing
linuxos
Keep System Updated: Always keep system updated with latest
releases patches, security fixes and kernel when it‟s available.
$ yum updates
$yum check-update
Deactivate Networking Ports: With the help of „netstat„ networking
command you can view all open ports and associated programs. Use
„chkconfig„ command to disable all unwanted network services from
the system.
Lock and Unlock Features:They are very useful, instead of
removing an account from the system, you can lock it for an week or
a month. To lock a specific user, you can use the follow command.
$ passwd -1 accountname
Use Strong Password Policy
Use SFTP, not FTP:File Transfer Protocol (FTP) is not safe
anymore, even if you encrypt your connection. SFTP is “FTP over
SSH” (also called “secure FTP”), and it encrypts all the data,
credentials and files included.
Install Antimalware/Antivirus Software: It is true that there are
free anti-malware programs out there, but as you might expect you
get what you pay for. Paid software means better programmers and
greater safety

iii)Performance Monitor: It is really very tough job for every


System or Network administrator to monitor and debug Linux System
Performance problems every day.
top command: Linux top command is a performance monitoring
program which is used frequently by many system administrators to
monitor Linux performance and it is available under many
Linux/Unix like operating systems.
The top command is much useful for system administrator to monitor
and take correct action whenrequired.
$ top

Page 20 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

vmstat: Linux vmstat command used to display statistics of virtual


memory, kernerl threads, disks, system processes, I/O blocks,
interrupts, CPU activity and much more.
$vmstat
c) Given a page reference string with (03) pages frames. Calculate 6M
the page faults with “Optimal” and “LRU” page replacement
algorithm respectively
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7.
Ans. Optimal Page Replacement

Ref 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7
For optimal
stri
algorithm
ng
3M
F1 7 7 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
F2 0 0 0 0 0 0 4 4 4 0 0 0 0 0 0 0 0
F3 1 1 1 3 3 3 3 3 3 3 3 1 1 1 1 1
PF √ √ √ √ √ √ √ √ √
Total Page faults: 9 in optimal Page replacement

LRU: For
Re 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 LRU
f algorithm
stri 3M
ng
F1 7 7 7 2 2 2 2 4 4 4 0 0 0 1 1 1 1 1
F2 0 0 0 0 0 0 0 0 3 3 3 3 3 3 0 0 0
F3 1 1 1 3 3 3 2 2 2 2 2 2 2 2 2 7
PF √ √ √ √ √ √ √ √ √ √ √ √
Total Page faults: 12 in LRU page replacement

6. Attempt any TWO of the following: 12M


a) Calculate average waiting time for SJF (shortest Job First) and 6M
Round Robin (RR) algorithm table: (Time slice is 4ms)

Page 21 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Ans. SJF:
Gantt chart: SJF:
Gantt chart
1M
Calculation
Waiting Time of P1: 19 ms 2M
Waiting Time of P2: 0 ms RR:
Waiting Time of P3: 10 ms Gantt chart
Waiting Time of P4: 4 ms 1M
Average waiting time=(19+0+10+4)/4=8.25ms Calculation
2M
ii)Round Robin :
Gantt Chart:

Waiting Time of P1: 12+6=18 ms


Waiting Time of P2: 4 ms
Waiting Time of P3: 8+8+4=20 ms
Waiting Time of P4: 12+8=20 ms
Average waiting time=(18+4+20+20)/4=15.5 ms
b) Explain linked and indexed file allocation method with neat 6M
diagram.
Ans. Linked File Allocation:
With linked allocation, each file is a linked list of disk blocks; the Linked file
disk blocks may be scattered any where on the disk. The directory allocation with
contains a pointer to the first (and last) blocks of the file. For example diagram 3M
a file of 5 blocks, which starts at block 9 might continue at block 16,
then block 1, block 10, and finally block 25. Each block contains a
pointer to the next block. These pointers are not made available to the
user, thus if sector is 512 words and a disk address (the pointer)
requires two words, then the user sees blocks of 510 words.

Page 22 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

Fig: Linked File Allocation

Advantages of Linked File Allocation Method:


1. Any free blocks can be added to a chain.
2. There is no external fragmentation.
3. Best suited for sequential files that are to be processed
sequentially.
4. No need to know the size of the file in advance.
5. The disk address of first block can be used to locate the rest of the
blocks.
6. Never necessary to defragment disk. Blocks are completely
utilized here. So no disk fragmentation.
7. No need to compact or relock files.

Disadvantages of Linked File Allocation Method:


1. There is no accommodation of the principle of locality that is
series of accesses to different parts of the disk are required.
2. Space is required for the pointers, 1.5% of disk is used for the
pointers and not for information. If a pointer is lost or damaged or
bug occurs in operating system or disk hardware failure occur, it
may result in picking up the wrong pointer.
3. This method cannot support direct access.

Indexed File Allocation: Indexed file


allocation
• Linked allocation solves the external fragmentation and size with
declaration problems of contiguous allocation. However linked diagram 3M
allocation cannot support direct access, since the blocks are
scattered all over the disk.Mostly pointers to blocks are scattered
all over the disk.

Page 23 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

• Indexed allocation solves this problem by bringing all of the


pointers together into one location the Index Block.
• Each file has its own index block, which is an array of disk block
addresses. The ith entry in the index block points to the ith block
of the file. The directory contains the address of the index block.
• To read the ith block we use pointer in ith index block entry to
find and read the desired block. When the file is created, all
pointers in the index block are set to nil. When the ith block is
first written a lock is removed from the free space list and its
address is put in the ith index block entry.

Advantages of Indexed File Allocation Method:


1. Does not suffer from external fragmentation.
2. Support both sequential and direct access to the file.
3. No need for user to know size of the file in advance.
4. Indexing of free space can be done by mean of the bit map.
5. Entire block is available for data as no space is occupied by
pointers.

Disadvantages of Indexed File Allocation Method:


1. It required lot of space for keeping pointers so wasted space of
memory.
2. Indexed allocation is more complex and time consuming.
3. Overhead of index blocks is not feasible for very small file.
4. Overhead of index blocks is not feasible for very big file also,
because it is difficult to manage
levels of indices.
5. Keeping index in memory requires space.

Page 24 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

c) Describe variable partitioning technique of memory management 6M


with suitable example.
Ans. In variable-sized memory partitioning, the main memory is divided
into blocks of the different sizes. In variable memory partitioning the
Concept of
partitions can vary in number and size. Variable-sized memory variable
partitioning takes place at run-time when a process asks for a block of partitioning
the main memory. If enough main memory is available, the process is technique
assigned a block of the main memory of exactly the same size that is with
required.The operating system keeps a table indicating which parts of advantages
and
memory are available and which are occupied. disadvantag
In this partitions are not made before the execution or during system es
configure. 3M
Initially RAM is empty and partitions are made during the run-time
according to process‟s need instead of partitioning during system Suitable
Example
configure. 3M
The size of partition will be equal to incoming process.
The partition size varies according to the need of the process so that
theinternal fragmentation can be avoided to ensure efficient
utilization ofRAM.
Number of partitions in RAM is not fixed and depends on the number
ofincoming process and main memory‟s size

Advantages of Variable Partitioning:


 No internal fragmentation: In variable partitioning, space in
main memory is allocatedstrictly according to the need of
process; hence there is no case ofinternal fragmentation. There
will be no unused space left in thepartition.

Page 25 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

WINTER – 2024 EXAMINATION


Model Answer – Only for the Use of RAC Assessors

Subject: Operating System Subject Code: 22516

 No restriction on Degree of Multiprogramming: More number


of processes can be accommodated due to absenceof internal
fragmentation. A process can be loaded until thememory is
empty.
 No Limitation on the size of the process:As the partition size
is decided according to the process size, theprocess size can‟t
be restricted in variable partitioning.

Disadvantages of Variable Partitioning:


 Difficult Implementation: Implementing variable partitioning
is difficult as compared to fixed partitioning as it involves
allocation of memory during runtime rather than during
system configure.
 External Fragmentation: There will be external fragmentation
inspite of absence of internal fragmentation.

Example:

Suppose in above example: Process P1 (2MB) and process P3 (1MB)


completed their execution. Two spaces are left i.e. 2 MB and 1 MB.
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. Because, the process must be contiguously present in main
memory to get executed, results in External Fragmentation. So, P5 of
size 3 MB cannot be accommodated in spite of required available
space.

Page 26 / 26

You might also like