Winter 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2023 EXAMINATION


MODEL ANSWER

Subject: Operating Systems 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 anyequivalent 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: 10


a) Define real time operating system, along with any two applications of it. 2M
Ans. Real Time operating system is a special-purpose operating system
used in computers that has well defined fixed time constraints for Definition
processing any task. 1M,
OR Any two
Real-time operating systems (RTOS) are used in environments where application
s
a large number of events, mostly external to the computer system,
1/2M each
must be accepted and processed in a short time or within certain
deadlines.
OR Any relevant Definition

Applications: (any other relevant application shall be considered)

Page 1 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

1. Flight Control System


2. Simulations
3. Industrial control
4. Military applications
5. Airline Traffic Control System
6. Airline Reservation System
7. Defence application systems like RADAR
8. Heart Pacemaker
9. Network Multimedia Systems
10. Missile Guidance system
11. Weather Forecasting
12. Online Transaction system
13. Network and Multimedia Systems
14. Ticket Reservation System
15. Command Control Systems
16. Medical Critical Care Systems.

b) List any four services provided by operating system. 2M


Ans.  User Interface Any four
1/2M each
 Program Execution
 I/O Operation
 File system Manipulation
 Communication
 Error Detection
 Resource Allocation
 Accounting
 Protection and security
c) Draw neat labelled process state diagram along with the correct 2M
directions of arrows

Page 2 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Ans.
Correct
diagram
2M

d) Define CPU bound program and I/O bound program 2M


Ans. CPU bound program: If execution of a program is highly dependent
on the CPU then it is known as CPU bound program.
Each
OR
definition
If a task does a lot operations using CPU, it's called a CPU-bound task.
1M
I/O bound program: If execution of a program is dependent on the
input-output system and its resources, such as disk drives and
peripheral devices then it is known as I/O bound program.
e) Define paging and segmentation 2M
Ans. Paging is a memory management scheme that permits the physical
address space of process to be noncontiguous. Logical memory is Correct
divided into blocks of same size called as pages. definition
OR 1M each
Paging is a storage mechanism used in OS to retrieve processes from
secondary storage to the main memory as pages.
OR
The process of retrieving processes in the form of pages from the
secondary storage into the main memory is known as paging.

Segmentation is a memory management scheme that permits


dividing logical address space into multiple segments.
OR
Segmentation divides the Computer’s physical memory and
program’s address space into segments.

Page 3 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

f) What is the use of PS command? Write long forms of UID, PID in 2M


the output of this command.
Ans. ps command: It is used to display the characteristics of a process. Use of ps
This command is used to list the processes associated with a user at a command
1M
particular terminal.
UID - (Owner) User-id full form
of each
PPID - Parent Process-id 1/2M
g) List any four file operations. 2M
Ans.  Creating a file Any four
 Writing a file operations
 Reading a file 1/2M each
 Repositioning within a file
 Deleting a file
 Appending new information to the end of the file
 Renaming an existing file.
 Truncating a file
 Creating copy of a file, copy file to another I/O device such as
printer or display
2. Attempt any THREE of the following: 12
a) Describe multiprocessor OS with its advantages (any two) 4M
Ans.  Multiprocessor systems are also known as parallel systems or
tightly coupled systems. Descriptio
n of
 These systems have two or more processors in close multiproce
communication and they share computer resources such as bus, ssor OS-
clock, memory and peripheral devices. 3M

 The whole task of multiprocessing is managed by the operating Any two


system, which allocates different tasks to be performed by the advantages
1/2M each
various processors in the system.
 Applications designed for the use in multiprocessing are said to
be threaded, which means that they are broken into smaller
routines that can be run independently.
 Multiple CPUs are linked together so that a job can be divided
and executed more quickly. When a job is completed, the results
from all CPUs are compiled to provide the final output.

Page 4 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

CPU CPU CPU

MEMORY PERIPHERALS

OR

Note: Any other relevant advantage shall be considered


Advantages
 Increased reliability: Due to the multiprocessing system,
processing tasks can be distributed among several processors. This
increases reliability as if one processor fails; the task can be given
to another processor for completion.
 Increased throughout: As several processors increase, more
work can be done in less time.
 The economy of Scale: As multiprocessors systems share
peripherals, secondary storage devices, and power supplies, they
are relatively cheaper than single-processor systems.
 Reduce Cost
b) Write down the responsibilities of the following components of 4M
OS
i) Memory Management Responsibi
ii) File Management lities of
Ans. i) Memory Management: each
manageme
 Keeping track of which parts of memory are currently being used
nt
and by whom. 2M

Page 5 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

 Deciding which processes (or parts thereof) and data to move into
and out of memory.
 Allocating and deallocating memory space as needed.
 Managing swap spaces, which store inactive pages of memory.
 Implementing policies for memory allocation.

File Management:
 The creation and deletion of files.
 The creation and deletion of directory
 The support of primitives for manipulating files and directions.
 The mapping of files onto secondary storage.
 The backup of files on stable storage media.
 Adding and editing the data in files.
 Moving files from one location to another.
 Store, arrange, or accessing files on a disk or other storage
locations.
c) Explain shared memory method of IPC using neat labelled 4M
diagram
Ans. Inter-process communication: Cooperating processes require an Explanatio
Inter- process communication (IPC) mechanism that will allow them n
to exchange data and information. 3M,
diagram
1M

 In this, all processes who want to communicate with other


processes can access a region of the memory residing in an
address space of a process creating a shared memory segment.
 All the processes using 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.

Page 6 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

 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.
d) Explain following terms with respect to scheduling 4M
i) CPU utilization
ii) Throughput
iii) Turnaround time
iv) Waiting time
Ans.  CPU utilization: In multiprogramming the main objective is to Each term
keep CPU as busy as possible. CPU utilization can range from 0 1M
to 100 percent.
 Throughput: It is the number of processes that are completed per
unit time. It is a measure of work done in the system.Throughput
depends on the execution time required for any process.
 Turnaround time: The time interval from the time of submission
of a process to the time of completion of that process is called as
turnaround time. It is the sum of time period spent waiting to get
into the memory, waiting in the ready queue, executing with the
CPU, and doing I/O operations.
 Waiting time: It is the sum of time periods spent in the ready
queue by a process. When a process is selected from job pool, it is
loaded into the main memory. A process waits in ready queue till
CPU is allocated to it.

3. Attempt any THREE of the following: 12


a) Explain following commands with their syntax 4M
i) kill
ii) Sleep
iii) Wait
iv) Exit

Page 7 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Ans. i)kill Each


Syntax: kill pid command
Kill command is used to stop execution of particular process by Syntax
sending an interrupt signal to the process ½M

Explanatio
ii)Sleep n½M
Syntax: sleep NUMBER[SUFFIX]
The sleep command pauses the execution for specified time in
command.

iii)Wait
Syntax: wait [pid]
Wait command waits for running process to complete and return the
exit status.

iv) Exit
Syntax: exit
used to quit the shell
(OR)
Syntax: exit[n]
The terminal window will close and return a status of n
b) What is deadlock? Discuss any one method of deadlock 4M
prevention
Ans. A deadlock is a situation where a set of processes are blocked
because each process is holding a resource and waiting for another Deadlock
resource acquired by some other process. definition
Methods for deadlock prevention (Any 1) 1M
1. Eliminate Mutual Exclusion:
The mutual-exclusion condition must hold for non-sharable Any 1
method
resources.
3M
Mutual section from the resource point of view is the fact that a
resource can never be used by more than one process simultaneously
which is fair enough but that is the main reason behind the deadlock.
If a resource could have been used by more than one process at the
same time then the process would have never been waiting for any
resource.Read-only files are a good example of a sharable resource. If
several processes attempt to open a read-only file at the same time,
they can be granted simultaneous access to the file.

Page 8 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

A process never needs to wait for a sharable resource.Sharable


resources, in contrast, do not require mutually exclusive access and
thus cannot be involved in a deadlock

2. Eliminate Hold and Wait:


One way to avoid this Hold and Wait is when a process requests a
resource; it does not hold any other resources. One protocol that can
be used requires each process to request and be allocated all its
resources before it begins execution. Another protocol that can be
used is, to allow a process to request resources only when the process
has none. A process may request some resources and use them.
Before it requests any additional resources, it must release all the
resources that are currently allocated to it.

3. Eliminate No Preemption:
If a process that is holding some resources requests another resource
that cannot be immediately allocated to it, then all resources currently
being held are preempted. That is this resources are implicitly
released. The preempted resources are added to the list of resources
for which the process is waiting. Process will be restarted only when
all the resources i.e. its old resources, as well as the new ones that it is
requesting will be available.Preemption ensures that resources are
efficiently utilized and prevents deadlocks caused by the hold and
wait condition.

4. Eliminate Circular Wait:


Circular-wait condition never holds is to impose a total ordering of all
resource types, and to require that each process requests resources in
an increasing order of enumeration.
Let R = {R1, R2, ..., Rn} be the set of resource types. We assign to
each resource type a unique integer number, which allows us to
compare two resources and to determine whether one precedes
another in our ordering. Formally, define a one-to-one function F: R
_ N, where N is the set of natural numbers.
c) Describe concept of free space management technique using bit 4M
map method

Page 9 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Ans. Bit Map:


The free-space list is implemented as a bit map or bit vector. Correct
Each block is represented by 1 bit. If the block is free, the bit is 1; if Explanatio
the block is allocated, the bit is 0. n 4M
For example, consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12,
13 are free and the rest of the blocks are allocated.
The free-space bit map would be : 0011110011111100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0

1=Free block 0=Allocated block

The main advantage of this approach is its relative simplicity and its
efficiency in findingthe first free block or n consecutive free blocks
on the disk.
d) Draw the diagram of linked file allocation method and explain it. 4M
Linked Allocation:
Ans. This allocation is on the basis of an individual block. Each block
contains a pointer to the next block in the chain. Correct
Diagram
 In this scheme, each file is a linked list of disk blocks which need 2M
not be contiguous. The disk blocks can be scattered anywhere on
the disk. Explanatio
n 2M
 The directory contains a pointer to the first and the last blocks of
the file.

 Creating a file is easy. We simply create a new entry in the device


directory. A write to a file removes first free block from free space
list and write to it. This new block is then linked to the end of the
file. To read a file, we simply read block by following the pointers
from block to block.

 There is no external fragmentation with linked allocation.

Page 10 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

 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.

 This method cannot support direct access.

 This method is used only for a sequential access files

 This method requires more space to store pointers

 So instead of blocks, clusters are used for allocation but this


creates internal fragmentation.

4. Attempt any THREE of the following: 12


a) Compare between CLI based OS and GUI based OS (Any four 4M
points)

Page 11 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Ans. Any 4
COMMAND LINE GRAPHIC USER points 1M
INTERFACE (CLI) INTERFACE (GUI) each

Definition Interaction is by Interaction with


typing commands devices is by graphics
and visual components
and icons

Understanding Commands need to Visual indicators and


be memorized icons are easy to
understand

Memory Less memory is More memory is


required for storage required as visual
components are
involved.

Working Use of keyboard for Use of mouse for


Speed commands makes interaction makes it
CLI quicker and slow
faster

Resources Only keyboard Mouse and keyboard


used both can be used

Accuracy High Comparatively low

Menu In CLI, there are no While in GUI, menus


menus provided. are provided

Flexibility Command line Structure and design


interface does not can change with
change, remains updates
same over time

Example DOS, UNIX Windows, Linux

Page 12 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

b) What are the different types of system calls? Give examples of 4M


Ans. each
Types of System Calls: Listing of
1.Process Control Types 2M
2.File management
3.Device Management Example
4.Information Maintenance of any two
system
5.Communication:
calls
1. System calls for Process Control: 2M
● Create/ Terminate process
● Load/Execute Process.
● End/Abort process.
● Ready process/Dispatch process.
● Suspend process/Resume Process.
● Get/Set Process Attributes.
● Wait event, signal event
● Allocate and deallocate memory
2. System call for File management:
● create new file, delete existing file
● open, close file
● Create and delete directories
● read, write, reposition
● get/set file attributes
3. System call for Device Management:
● request device, release device
● read, write, reposition
● get/set device attributes
● logically attach or detach devices
4. System call for Information Maintenance:
● get/set time or date
● get/set system data
● get/set process, file, or device attributes
5. System Communication:
● create, delete communication connection
● send, receive messages
● transfer status information
● attach or detach remote devices

Page 13 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

c) Explain working of CPU switch from process to process with neat 4M


labelled diagram.
Ans. A CPU switch from process to process is referred as context switch.
A context switch is a mechanism that store and restore the state or Explanatio
context of a CPU in Process Control block sothat a process execution n
can be resumed from the same point at a later time. When 2M
thescheduler switches the CPU from one process to another process,
Diagram
the context switch savesthe contents of all process registers for the 2M
process being removed from the CPU, in its process control block.
Context switch includes two operations such as state save and state Relevant
restore. State save operation stores the current information of running Explanatio
process into its PCB. State restoreoperation restores the information n shall be
of process to be executed from its PCB. Switching the CPU from one considered
process to another process requires performing state save operation
for thecurrently executing process (blocked) and a state restore
operation for the process ready for execution. This task is known as
context switch.

Page 14 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

d) Solve given problem by using FCFS scheduling algorithm. Draw 4M


correct Gantt chart and calculate average waiting time and
average turnaround time
Process Arrival Burst
Time Time
P0 0 10
P1 1 29
P2 2 3
P3 3 7
P4 4 12

Gantt Chart
Ans.
Gantt
chart
2M,
FCFS
Waiting time Average
P0=0 waiting
P1= (10-1) = 9 time
P2= (39-2) = 37 calculation
P3= (42-3) = 39 1M,
P4= (49-4) = 45
Average Waiting time = Waiting time of all processes / Number of
processes Average
= (0+9+37+39+45)/5 = 26 ms turnaroun
Turnaround Time d time
calculation
P0=10
1M
P1=39-1=38
P2=42-2=40
P3=49-3=46
P4=61-4=57
Average Turnaround time = Turnaround time of all processes /
Number of processes
= (10+38+40+46+57)/5
= 191/5
= 38.2 ms

Page 15 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

e) Which hole is taken for next segment request for 8 KB in a 4M


swapping system for First fit, Best fit and Worst fit.

First Fit: Allocate the Best Fit: Allocate the Worst fit: Allocate
Ans. first free block to the smallest free block the largest free block Any
new process that is big enough to to the new process Correct
accommodate new representat
OS process OS ion 4M
4 KB OS 4 KB
<FREE> 1 4 KB 9 KB
KB 9 KB <FREE>
8 KB 20 KB 12 KB
16 KB 8 KB
20 KB
16 KB <FREE> 0 16 KB
8 KB KB 8 KB
2 KB 8 KB 2 KB
6 KB 2 KB 6 KB
6 KB

OR
First Fit: Allocate the Best Fit: Allocate the Worst fit: Allocate
first free block to the smallest free block the largest free block
new process that is big enough to to the new process
accommodate new
process
OS OS OS
4 KB 4 KB 4 KB
9 KB 9 KB 9 KB
20 KB 20 KB 20 KB
16 KB 16 KB 16 KB
8 KB 8 KB 8 KB
2 KB 2 KB 2 KB
6 KB 6 KB 6 KB

Page 16 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

5. Attempt any TWO of the following: 12


a) Write two uses of the following operating system tools: 6M
i) Security Policy
ii) User Management
iii) Performance Monitor
Ans. i) Security Policy:
-As OS security policies and procedures cover a large area, there are Each tool
following techniques to addressing them: with any 2
 Installing and updating anti-virus software valid uses
2M
 Ensure the systems are patched or updated regularly
$ yum updates
$yum check-update
 Implementing user management policies to protect user
accounts and privileges.
 Installing a firewall and ensuring that it is properly set to
monitor all incoming and outgoing traffic.

- Use Secure SSH: Telnet and rlogin protocols uses plain text, not
encrypted format which is the security breaches. SSH is a secure
protocol that use encryption technology during communication with
server. Never login directly as root unless necessary. Use “sudo” to
execute commands.
$ vi /etc/ssh/sshd_config
$ PermitRootLogin no #disable root login
$AllowUsers username # Allow only specific users
$ Protocol 2 #use SSH protocol 2 version

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

Turn Off IPv6: If you are not using a IPv6 protocol, then you should
disable it because most of the applications or policies not required
IPv6 protocol and currently it doesn’t required on the server. Go to
network configuration file and add followings lines to disable it.
# vi /etc/sysconfig/network
NETWORKING_IPV6=no
IPV6INIT=no

Page 17 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Enables Iptables (Firewall): It is highly recommended to enable


Linux firewall to secure unauthorised access of your servers. Apply
rules in iptables to filters incoming, outgoing and forwarding packets.
We can specify the source and destination address to allow and deny
in specific udp/tcp port number.
Use Strong Password Policy: Passwords are always a security
problem because humans are. People often cannot be bothered to
come up with a lot of different passwords, so they use the same ones
in different places or combinations that are easy to remember, like
“password” or “abcde”. Basically, a gift to hackers. Make it a
requirement that any password must contain both upper and lower
case, be a mix of numbers, letters and symbols and you’ll be way
safer.
ii) User Management:
-As the administrator, it is your job to create and manage the accounts
for all required users.
-User management includes everything from creating a user to
deleting a user on your system and also assigning the passwords to
created users using “passwd” command.
Following are the Linux command line tools for managing users and
groups:
1. useradd.
2. usermod.
3. userdel.
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.
 The top command used to display all the running and active
real-time processes in ordered list and updates it regularly. It
display CPU usage, Memory usage, Swap Memory, Cache
Size, Buffer Size, Process PID, User, Commands and much
more. It also shows high memory and CPU utilization of a
running processes.
 Linux vmstat command used to display statistics of virtual
memory, kernel threads, disks, system processes, I/O blocks,
interrupts, CPU activity and much more.

Page 18 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

b) Differentiate between process and thread (any two Points). Also 6M


discuss the benefits of multithreaded programming.
Ans.
Process Thread
Definition A process is a A thread is a lightweight
program under process that can be Differentia
execution i.e. an active managed independently te - any 2
program. by a scheduler. valid
Running Processes run in Threads within the same points
mechanism separate memory process run in a shared 2M
spaces. memory space.
Benefits
Process is heavy It is a lightweight process 4M
Concept weight and any and a segment of a
program is in process.
execution.
PCB The process has its Thread has Parents’ PCB,
own Process Control its own Thread Control
Block, Stack, and Block, and Stack and
Address Space. common Address space.

Context Context switching Context switching


Switching between the process between threads of the
is more expensive same process is less
expensive

Dependency Processes are Threads are dependent


independent.
Controlling Process is controlled Threads are controlled by
by the operating programmer in a program
system.

Benefits of multithreaded programming:


The benefits of multithreaded programming can be broken down into
four major categories:
Responsiveness:
Multithreading an interactive application may allow a program to
continue running even if part of it is blocked or is performing a
lengthy operation, thereby increasing responsiveness to the user. For

Page 19 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

instance, a multithreaded Web browser could allow user interaction in


one thread while an image was being loaded in another thread.

Resource sharing:
Processes may only share resources through techniques such as
shared memory or message passing. Such techniques must be
explicitly arranged by the programmer. However, threads share the
memory and the resources of the process to which they belong by
default. The benefit of sharing code and data is that it allows an
application to have several different threads of activity within the
same address space.

Economy:
Allocating memory and resources for process creation is costly.
Because threads share the resources of the process to which they
belong, it is more economical to create and context-switch threads.
Empirically gauging the difference in overhead can be difficult, but in
general it is much more time consuming to create and manage
processes than threads. In Solaris, for example, creating a process is
about thirty times slower than is creating a thread, and context
switching is about five times slower.

Scalability:
The benefits of multithreading can be greatly increased in a
multiprocessor architecture, where threads may be running in parallel
on different processors. A single-threaded process can only run on
one processor, regardless how many are available. Multithreading on
a multi-CPU machine increases parallelism.

c) Find out the total number of page faults using: 6M


i. Least Recently used Page Replacement
ii. Optimal Page Replacement
Page replacement algorithms of memory management, if the
pages are coming in the order:
70120304230321201701

Page 20 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Ans. i) LRU:
Considering frame size is 3: LRU
3M

Total Page faults using LRU Page Replacement/Fault=12

ii) Optimal:
Considering Frame size is 3:

Optimal
3M

Total Page faults using Optimal Page Replacement/Page Fault=09


6. Attempt any TWO of the following: 12
a) How pre-emptive scheduling is better than non pre-emptive 6M
scheduling by solving following problem using SJF (Solve it by
using pre-emptive SJF and non-pre-emptive SJF also).

Reason
2M

Pre-
Following are the reason, why pre-emptive scheduling is better emptive
Ans. than non pre-emptive scheduling: SJF
 Preemptive scheduling is quite flexible because critical processes 2M
are allowed to access the CPU because they come in the ready
queue and no matter which process is currently running. Non- NonPre-
preemptive scheduling is tough because if an essential process is emptive
assigned to the ready queue, the CPU process is not be SJF
2M
interrupted.

Page 21 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

 Preemptive scheduling allows a process to be interrupted in the


midst of its execution, taking the CPU away and allocating it to
another process. Non-preemptive scheduling ensures that a
process relinquishes control of the CPU only when it finishes
with its current CPU burst.

Page 22 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

b) List free space management technique with the help of neat 6M


diagram, explain any one technique in detail.
Ans. A file system is responsible to allocate the free blocks to the file Listing
therefore it has to keep track of all the free blocks present in the disk. free space
There are mainly two approaches by using which, the free blocks in manageme
the disk are managed. nt
Following are the free space management technique: 1M
1) Bitmap
Explanatio
2) Linked List n
3) Grouping 3M
Bit Vector
The first method that we will discuss is the bit vector method. Also Diagram
known as the bit map, this is the most frequently used method to 2M
implement the free space list. In this method, each block in the hard
disk is represented by a bit (either 0 or 1). If a block has a bit 0 means
that the block is allocated to a file, and if a block has a bit 1 means
that the block is not allocated to any file, i.e., the block is free.
For example, consider a disk having 16 blocks where block numbers
2, 3, 4, 5, 8, 9, 10, 11, 12, and 13 are free, and the rest of the blocks,
i.e., block numbers 0, 1, 6, 7, 14 and 15 are allocated to some files.
The bit vector for this disk will look like this-

We can find the free block number from the bit vector using the
following method-
Block number = (Number of bits per word )* (number of 0-value
words) + (offset of first bit)
We will now find the first free block number in the above example.
The first group of 8 bits (00111100) constitutes a non-zero word since
all bits are not 0. After finding the non-zero word, we will look for
the first 1 bit. This is the third character of the non-zero word. Hence,
offset = 3.
Therefore, the first free block number = 8 * 0 + 3 = 3.
Linked List:
Another method of doing free space management in operating
systems is a linked list. In this method, all the free blocks existing in
the disk are linked together in a linked list. The address of the first

Page 23 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

free block is stored somewhere in the memory. Each free block


contains a pointer that contains the address to the next free block. The
last free block points to null, indicating the end of the linked list.
For example, consider a disk having 16 blocks where block numbers
3, 4, 5, 6, 9, 10, 11, 12, 13, and 14 are free, and the rest of the blocks,
i.e., block numbers 1, 2, 7, 8, 15 and 16 are allocated to some files. If
we maintain a linked list, then Block 3 will contain a pointer to Block
4, and Block 4 will contain a pointer to Block 5.

Grouping: The third method of free space management in operating


systems is grouping. This method is the modification of the linked list
method. In this method, the first free block stores the addresses of the
n free blocks. The first n-1 of these blocks is free. The last block in
these n free blocks contains the addresses of the next n free blocks,
and so on.
For example, consider a disk having 16 blocks where block numbers
3, 4, 5, 6, 9, 10, 11, 12, 13, and 14 are free, and the rest of the blocks,
i.e., block numbers 1, 2, 7, 8, 15 and 16 are allocated to some files.
If we apply the Grouping method considering n to be 3, Block 3 will
store the addresses of Block 4, Block 5, and Block 6. Similarly, Block
6 will store the addresses of Block 9, Block 10, and Block 11. Block
11 will store the addresses of Block 12, Block 13, and Block 14. This
is also represented in the following figure

Page 24 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

c) Draw and explain directory structure of a file system in terms of 6M


single level, two level and tree structure.
Ans. A directory is a container that is used to contain folders and files. Relevant
Following are the logical structures of a directory: explanatio
1) Single level n shall be
2) Two level considered
3) Tree structure
Single
level
Single-level directory: Diagram
The single-level directory is the simplest directory structure. 1M
In it, all files are contained in the same directory, which makes it Explanatio
easy to support and understand. n 1M
Single level directory has a significant limitation, however, when
the number of files increases or when the system has more than one
user. Since all the files are in the same directory, they must have Two Level
a unique name. If two users call their dataset test, then the unique Diagram
name rule violated. 1M
Explanatio
•Simple operations like file creation, search, deletion, and updating
n 1M
are possible with a single-level directory structure.
•The single-level directory is easier to understand in practical life.
•Two file names cannot be the same. In case two files are given the Tree Level
same name, the previous one is overridden. Diagram
•If the number of files is very large, searching a particular file is 1M
very inefficient.
•Segregation of important and unimportant files is not possible. Explanatio
•The single-level directory is not useful for multi-user systems. n 1M

Fig:Single level Directory Structure

Page 25 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

Two-level directory:
As we have seen, a single level directory often leads to confusion of
files names among different users. The solution to this problem is to
create a separate directory for each user.
In the two-level directory structure, each user has their own user
files directory (UFD). The UFDs have similar structures, but each
lists only the files of a single user. System’s master file directory
(MFD) is searched whenever a new user id is created.
 Searching is very easy.
 There can be two files with the same name in two different user
directories. Since they are not in the same directory, the same
name can be used.
 Grouping is easier.
 A user cannot enter another user’s directory without permission.
 Implementation is easy.
 It does not allow users to create subdirectories.

Fig: Two Level Directory structure

Tree Structure/ Hierarchical Structure:


Tree directory structure of operating system is most commonly used
in our personal computers. User can create files and subdirectories
too, which was a disadvantage in the previous directory structures.
This directory structure resembles a real tree upside down, where
the root directory is at the peak. This root contains all the
directories for each user. The users can create subdirectories and
even store files in their directory.

Page 26 / 27

Downloaded by Yash Patil ([email protected])


lOMoARcPSD|38558715

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating Systems Subject Code: 22516

A user do not have access to the root directory data and cannot
modify it. And, even in this directory the user do not have access to
other user’s directories. The structure of tree directory is given
below which shows how there are files and subdirectories in each
user’s directory.
•The root directory is highly secured, and only the system
administrator can access it. We can see how there can be
subdirectories inside the user directories. A user cannot modify the
root directory data. Also, a user cannot access another user's
directory.
•Allows subdirectories inside a directory.
•Searching is easy.
•Allows grouping.
•Segregation of important and unimportant files is easy.
•As one user cannot enter another user’s directory, this restricts
sharing of files.
•Too many subdirectories may make the search complicated.
•Users cannot modify the root directory’s data.

Fig: Tree Structure/ Hierarchical Structure

Page 27 / 27

Downloaded by Yash Patil ([email protected])

You might also like