Nothing Special   »   [go: up one dir, main page]

Model Asnwer Paper

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

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

WINTER – 2019 EXAMINATION


Subject Name: Operating System Model Answer 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.

Q. Sub Answer Marking


No Q. Scheme
. N.

1. Attempt any Five of the following: 10 M


a Define real time operating system. List its any four applications of 2M
it.
Ans Real time Operating System: 1 Mark :-
A real time system has well defined fixed time constraints. Processing Definition;
should be done within the defined constraints -Hard and Soft real time 1 Mark :-
system. for any 4
OR correct
The real-time operating system used for a real-time application means application
for those applications where data processing should be done in the fixed s
and small quantum of time.

Types of real time operating system


1. Hard real-time
2. Soft real-time

Applications:
1. Flight Control System
2. Simulations
3. Industrial control
4. Military applications

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

b Explain any 4 services provided by OS. 2M


Ans 1.User Interface: All operating systems have a user interface that 1 marks for
allows users to communicate with the system. Three types of user explaining
interfaces are available: any 4
a. Command line interface (CLI) services
b. Batch interface
c. Graphical user interface (GUI)

2. Program execution: The operating system provides an environment


where the user can conveniently run programs. It also performs other
important tasks like allocation and deallocation of memory, CPU
scheduling etc. It also provides service to end process execution either
normally or abnormally by indicating error.

3. I/O operations: When a program is running, it may require


input/output resources such as a file or devices such as printer. So the
operating system provides a service to do I/O.

4.File system manipulation: Programs may need to read and write data
from and to the files and directories. Operating system manages the
secondary storage. Operating system makes it easier for user programs
to accomplish their task such as opening a file, saving a file and deleting
a file from the storage disk.

5.Communication: In the system, one process may need to exchange


information with another process. Communication can be implemented
via shared memory or through message passing, in which packets of
information are moved between processes by the operating system.

6.Error detection: Operating systems detects CPU and memory


hardware such as a memory error or power failure, a connection failure
on a network or lack of paper in the printer etc.

7.Resource allocation: Operating system manages resource allocation


to the processes. These resources are CPU, main memory, file storage
and I/O devices.

8.Accounting: Operating system keeps track of usages of various


computer resources allocated to users.

9.Protection & security: When several separate processes execute


concurrently, one process should not interfere with the other processes
or operating system itself. Protection provides controlled access to
system resources. Security is provided by user authentication such as
password for accessing information.

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

c Draw process state diagram. 2M


Ans 2 Marks:-
for correct
well
labelled
diagram (1
mark:-
specifying
correct
states in
the
diagram)

process state diagram

d Explain any four scheduling criteria. 2M


Ans 1. CPU utilization: In multiprogramming the main objective is to keep Any four
CPU as busy as possible. CPU utilization can range from 0 to 100 scheduling
percent. criteria: 1/2
mark each
2.Throughput: It is the number of processes that are completed per unit
time. It is a measure of work done in the system. When CPU is busy in
executing processes, then work is being done in the system. Throughput
depends on the execution time required for any process. For long
processes, throughput can be one process per unit time whereas for short
processes it may be 10 processes per unit time.

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

4.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 (ready queue). A process waits in ready queue till
CPU is allocated to it. Once the CPU is allocated to the process, it starts
its execution and if required request for resources. When the resources
are not available that process goes into waiting state and when I/O
request completes, it goes back to ready queue. In ready queue again it
waits for CPU allocation.

5.Response time: The time period from the submission of a request


until the first response is produced is called as response time. It is the
time when system responds to the process request not the completion of

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

a process. In the system, a process can Produce some output fairly early
and can continue computing new results while previous results are being
output to the user.
e Define virtual memory 2M
Ans Virtual memory is a memory management capability of an operating 2 marks for
system (OS) that uses hardware and software to allow a computer to any
compensate for physical memory shortages by temporarily transferring relevant
data from random access memory (RAM) to disk storage. definition
OR
Virtual memory is the separation of user logical memory from physical
memory. This separation allows an extremely large virtual memory to
be provided for programmers when only a smaller physical memory is
available. Virtual memory makes the task of programming much easier,
because the programmer no longer needs to worry about the amount of
physical memory available, or about what code can be placed in
overlays, but can concentrate instead on the problem to be programmed.
f Write syntax for following commands: i)Sleep ii)Kill 2M
Ans i)sleep 1 mark
Syntax: each for
sleep NUMBER[SUFFIX]… correct
sleep OPTION syntax

ii) kill
Syntax: kill pid
g Describe any four file attributes 2M
Ans File attributes: Any four
 Name: The symbolic file name is the only information kept in attributes:
human readable form. ½ mark
 Identifier: File system gives a unique tag or number that each
identifies file within file system and which is used to refer files
internally.
 Type: This information is needed for those systems that support
different types.
 Location: This information is a pointer to a device and to the
location of the file on that device.
 Size: The current size of the file (in bytes, words or blocks) and
possibly the maximum allowed size are included in this attribute.
 Protection: Access control information determines that who can
do reading, writing, executing and so on.
 Time, Date and User Identification: This information may be
kept for creation, Last modification and last use. These data can
be useful for protection, security and usage monitoring.

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

2. Attempt any Three of the following: 12M


a Enlist types of operating system. Explain multiprogramming OS in 4M
detail.
Ans Types of operating system 1 Mark:-
1.Batch Systems Listing;
2.Multiprogramming 1 Mark:-
3.Multitasking Diagram
4.Time-Sharing Systems 2 Marks:-
5.Desktop Systems Explanatio
6.Distributed system n
7.Clustered system
8.Real Time system:

Multiprogramming:
 In multiprogramming, more than one program lies in the
memory.
 The scheduler selects the jobs to be placed in ready queue from a
number of programs.
 The ready queue is placed in memory and the existence of more
than one program in main memory is known as
multiprogramming.
 Since there is only one processor, there multiple programs
cannot be executed at a time.
 Instead the operating system executes part of one program, then
the part of another and so on.
 Example of multiprogramming: user can open word, excel,
access and other applications in a system.

b List components of OS. Explain process management in detail. 4M


Ans List of System Components: 1 Mark:-
1. Process management Listing;
2. Main memory management 3 Marks:-
3. File management Explanation
4. I/O system management
5. Secondary storage management

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

Process Management: The operating system manages many kinds of


activities ranging from user programs to system programs like printer
spooler, name servers, file server etc.
Each of these activities is encapsulated in a process.
 A process includes the complete execution context (code, data,
PC, registers, OS resources in use etc.).
 The basic unit of software that the operating system deals with in
scheduling the work done by the processor is either a process or
a thread, depending on the operating system.
 It’s tempting to think of a process as an application, but that
gives an incomplete picture of how processes relate to the
operating system and hardware.
 The application you see (word processor or spreadsheet or game)
is, indeed, a process, but that application may cause several other
processes to begin, for tasks like communications with other
devices or other computers.
 There are also numerous processes that run without giving you
direct evidence that they ever exist. A process, then, is software
that performs some action and can be controlled by a user, by
other applications or by the operating system.
 It is processes, rather than applications, that the operating system
controls and schedules for execution by the CPU. In a single-
tasking system, the schedule is straightforward.
 The operating system allows the application to begin running,
suspending the execution only long enough to deal with
interrupts and user input.
 The five major activities of an operating system in regard to
process management are
1. Creation and deletion of user and system processes.
2. Suspension and resumption of processes.
3. A mechanism for process synchronization.
4. A mechanism for process communication.
5. A mechanism for deadlock handling.
c With neat diagram explain inter process communication model. 4M
Ans Inter-process communication: Cooperating processes require an Inter- Define
process communication (IPC) mechanism that will allow them to inter
exchange data and information. process
There are two models of IPC communica
1. Shared memory tion -1
mark;
diagram of
model - 1
mark;
explanation

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

- 2 marks

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

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

 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.
d Describe I/O Burst and CPU Burst cycle with neat diagram. 4M
Ans CPU burst cycle: It is a time period when process is busy with CPU. Explanatio
I/O burst cycle: It is a time period when process is busy in working n: 2 marks,
with I/O resources. Diagram:2
marks
 A process execution consists of a cycle of CPU execution and
I/O wait.
 A process starts its execution when CPU is assigned to it, so
process execution begins with a CPU burst cycle.
 This is followed by an I/O burst cycle when a process is busy
doing I/O operations.
 A process switch frequently from CPU burst cycle to I/O burst
cycle and vice versa.
 The complete execution of a process starts with CPU burst cycle,
followed by I/O burst cycle, then followed by another CPU burst
cycle, then followed by another I/O burst cycle and so on.
 The final CPU burst cycle ends with a system request to
terminate execution.

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

3. Attempt any Three of the following: 12M


a Explain ‘PS’ command with any four options. 4M
Ans ps command: It is used to display the characteristics of a process. This four
command when execute without options, it lists the processes associated options-1M
with a user at a particular terminal. each
Syntax: $ ps [options]
Example: $ ps
output:

Each line in the output shows PID, the terminal with which the process
is associated, the cumulative processor time that has been consumed
since the process has been started and the process name.
Options:
-f : It is used to display full listing of attributes of a process. It includes
UID (user ID),PPID(Parent ID),C(amount of CPU time consumed by
the process) and STIME(chronological time that has elapsed since the
process started).
Example: $ ps -f

-u: Shows the activities of any specified user at any time.


Example: $ ps -u abc

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

-a: It shows the processes of all users.


Example: $ ps -a

-e: It displays processes including user and system processes.


example: $ ps -e

b Explain deadlock? What are necessary conditions for deadlock? 4M


Ans In multiprogramming environment, several processes may compete for a finite Deadlock
number of resources. A process requests resources and if the resources are not description-
available then the process enters into the waiting state. Sometimes a waiting 2M,
process is never again able to change its status because the resources requested
necessary
by it are held by other waiting processes. This situation is called as deadlock.
When a process request for resources held by another waiting process which in conditions -
turn is waiting for resources held by another waiting process and not a single 1/2 M each
process can execute its task, then deadlock occurs in the system.

Example: Consider a system with three disk drives and three processes. When
each process request one disk drive, system allocates one disk drive to each
process. Now there is no more drive available in the system. If all three
processes request for one more disk drive, then all three processes will go into
the waiting state and system will go in deadlock state. Because any one process
from the three can execute only when one of them will release the disk drive
allocated to it.

Necessary Conditions:
1. Mutual exclusion: At least one resource must be held in a non-
sharable mode; that is, only one process at a time can use the resource.
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

10 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

other processes.

3. No pre-emption: Resources cannot be pre-empted i.e a resource can


be released only voluntarily by the process holding it.

4. Circular wait: A set {P0,P1…Pn} of waiting processes must exist


such that P0 is waiting for a resource held by P1,P1 is waiting for a
resource held by P2,…,Pn-1 is waiting for a resource held by Pn and Pn is
waiting for a resource held by P0. Each process is waiting for the
resources held by other waiting processes in circular form.
c Explain partitioning and its types. 4M
Ans An important operation of memory management is to bring programs Explanation
into main memory for execution by the processor. Partitioning is a of fixed
technique that divides a memory into multiple partitions. These partitioning
partitions can be of different size or same size. -2M,
Types of partitioning Variable
 Fixed partitioning i.e. static partitioning partitioning-
 Variable partitioning i.e. dynamic partitioning 2M

Fixed Partitioning: Main memory is divided into multiple partitions of


fixed size at the time of system generation. A process may be loaded
into a partition of equal size or greater size. Partitions can be of equal
size or unequal size.
Equal size partitioning: Main memory is
divided into equal size partitions. Any process
with less or equal size can be loaded in any
available partition.

OR

Unequal size partitioning: Main memory is


divided into multiple partitions of unequal
size. Each process can be loaded into the
smallest partition within which the process
will fit.

Variable partitioning: When a process enters in main memory, it is


allocated exact size that is required by that process. So in this method,
partitions can vary in size depending on memory space required by a
process entering in main memory. Operating system maintains a table
indicating which parts of memory are available and which are occupied.
When new process arrives and it needs space, system searches for

11 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

available memory space in main memory. If it is available, then memory


is allocated to the process by creating a partition in memory.
For example: Consider following table with process and memory space.
Process Memory space
P1 20 M
P2 14 M
P3 18 M

d Describe sequential and direct access method. 4M


Ans Sequential access: Information from the file is processed in order i.e. description
one record after another. It is commonly used access mode. For of sequential
example, editors and compilers access files in sequence. access-2M,
A read operation read information from the file in a sequence i.e. read Direct
next reads the next portion of the file and automatically advances a file access-2M
pointer.
A write operation writes information into the file in a sequence i.e. write
next appends to the end of the file and advances to the end of the newly
written material. Such a file can be reset to the beginning.
In some operating systems, a program may be able to skip forward or
backward n records for some integer n.

As shown in above diagram, a file can be rewind (moved in backward


direction) from the current position to start with beginning of the file or
it can be read or write in forward direction.

Direct access: It is also called as relative access. A file is made up of


fixed length logical records that allow programs to read and write
records rapidly in no particular order. Direct access method is based on
disk model of a file which allows random access to any file block.
For direct access a file is viewed as a numbered sequence of blocks or
records. So we can directly read block 14, then block 53 and so on. This
method is used for immediate access to large amount of information.
Database can be accessed with direct access method. For example, when

12 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

a query concerning a particular subject arrives, we compute which block


contains the answer and then read that block directly to provide the
desired information.
Read n operation is used to read the nth block from the file whereas
write n is used to write in that block. The block numbers provided by
the user to the operating system is a relative block number. A relative
block number is an index relative to the beginning of the file. The first
relative block of file is 0; the next is 1 and so on. Actual absolute disk
address of the block is different from the relative address. The use of
relative block numbers allow the operating system to decide where the
file should be placed and helps t prevent the user from accessing
portions of the file system that may not be part of his file.

4 Attempt any Three of the following: 12M


a Write Unix command for following: 4M
i)create a folder OSY ii) create a file FIRST in OSY folder
iii) List/display all files and directories.
iv) Write command to clear the screen
Ans i) create a folder OSY: Each correct
$mkdir OSY command-
1M
ii)create a file FIRST in OSY folder:
$cd OSY
$cat>FIRST or $ touch FIRST

iii) List/display all files and directories:


$ls

iv) to clear screen:


$clear
b What is purpose of system call? State two system calls with their 4M
functions.
Ans System call provides an interface between a running program and purpose of
operating system. It allows user to access services provided by system call-
operating system. This system calls are procedures written using C, 2M, Two
C++ and assembly language instructions. Each operating system has its system calls-
own name for each system call. Each system call is associated with a 1M each
number that identifies itself.
System calls:
Process Control: Program in execution is a process. A process to be
executed must be loaded in main memory. while executing it may need
to wait, terminate or create & terminate child processes.
 end, abort
 load, execute
 create process, terminate process

13 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

 get process attributes, set process attributes


 wait for time
 wait event, signal event
 allocate and free memory

File Management: System allows us to create and delete files. For


create and delete operation system call requires the name of the file and
other attributes of the file. File attributes include file type, file size,
protection codes, accounting information and so on. Systems access
these attributes for performing operations on file and directories. Once
the file is created, we can open it and use it. System also allows
performing reading, writing or repositioning operations on file.
 create file, delete file
 open, close
 read, write, reposition
 get file attributes, set device attributes
 logically attach or detach devices

3. Device Management: When a process is in running state, it requires


several resources to execute. These resources include main memory,
disk drives, files and so on. If the resource is available, it is assigned to
the process. Once the resource is allocated to the process, process can
read, write and reposition the device.
 request device, release device
 read, write, reposition
 get device attributes, set device attributes
 logically attach or detach devices

4. Information Maintenance: Transferring information between the


user program and the operating system requires system call. System
information includes displaying current date and time, the number of
current user, the version number of the operating system, the amount of
free memory or disk space and so on. Operating system keeps
information about all its processes that can be accessed with system
calls such as get process attributes and set process attributes.
 get time or date, set time or date
 get system data, set system data
 get process, file, or devices attributes
 set process, file, or devices attributes

5. Communication: Processes in the system, communicate with each


other. Communication is done by using two models: message passing
and shared memory. For transferring messages, sender process
connects itself to receiving process by specifying receiving process

14 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

name or identity. Once the communication is over system close the


connection between communicating processes.
 create, delete communication connection
 send, receive messages
 transfer status information
 attach or detach remote devices.
c State and describe types of scheduler. 4M
Ans There are three types of scheduler: list-1M,
 Long term scheduler description
 Short term scheduler of each-1
 Medium term scheduler

1. Long term scheduler: It selects programs from job pool and


loads them into the main memory. It controls the degree of
multiprogramming. The degree of multiprogramming is the number of
processes loaded (existing) into the main memory. System contains I/O
bound processes and CPU bound processes. An I/O bound process
spends more time for doing I/O operations whereas CPU bound process
spends more time in doing computations with the CPU. So It is the
responsibility of long term scheduler to balance the system by loading
some I/O bound and some CPU bound processed into the main
memory. Long term scheduler executes only when a process leaves the
system, so it executes less frequently. When long term scheduler
selects a process from job pool, the state of process changes from new
to ready state.

2. Short term scheduler: It is also known as CPU scheduler. This


scheduler selects processes that are ready for execution from the
ready queue and allocates the CPU to the selected process.
Frequency of execution of short term scheduler is more than other
schedulers. When short term scheduler selects a process, the state of
process changes from ready to running state.

3.Medium term scheduler: When a process is in running state, due to


some interrupt it is blocked. System swaps out blocked process and
store it into a blocked and swapped out process queue. When space is
available in the main memory, the operating system looks at the list of
swapped out but ready processes. The medium term scheduler selects
one process from that list and loads it into the ready queue. The job of
medium term scheduler is to select a process from swapped out
process queue and to load it into the main memory. This scheduler
works in close communication with long term scheduler for loading
process into the main memory.

d Explain Round Robin algorithm with suitable example. 4M

15 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Ans It is preemptive scheduling algorithm. A small unit of time known as a explanation


time quantum or time slice is used for pre-emption of a currently of round
running process. Ready queue is implemented as a circular queue. CPU robin -2M,
is assigned to the entire processes one by one, on first come first serve example-2M
basis, for a specific time period. Every process executes for specified
time period and CPU is given to the next process when time quantum
expires.
A new process is added at the tail of the ready queue when it enters
the system. CPU scheduler selects first process from head of the ready
queue and executes it for a specified time quantum. Once the time
quantum expires, dispatcher is invoked to pre-empt current running
process and CPU is given to the next process placed at the head of the
ready queue. The running process may have a CPU burst time less or
greater than time quantum. If burst time of running process is less than
the time quantum then, the process itself releases the CPU. The
scheduler then selects next process from ready queue and executes it. If
burst time of running process is longer than time quantum then, context
switch occurs and the process is place at the tail of ready queue for
remaining burst time execution.

Example:
Process Burst Time
P1 24
P2 3
P3 3
Time quantum: 4 ms
The resulting RR schedule is as follows:

P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30

CPU is allocated to process P1 for 4 ms. Since it requires another 20


milliseconds, it is preempted after the first time quantum and the CPU
is given to the next process in the queue, process P2. Process P2 does
not need 4 milliseconds, so it quits before its time quantum expires.
The CPU is then given to the next process, process P3. Once each
process has received 1 time quantum, the CPU returns to process P1
for an additional time quantum.
e Explain PCB with diagram. 4M
Ans Each process is represented as a process control block (PCB) in the explanation-
operating system. It contains information associated with specific 2M,
process. diagram-2M
Process State: It indicates current state of a process. Process state can
be new, ready, running, waiting and terminated.
Process number: Each process is associated with a unique number
16 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

which is known process identification number.


Program Counter: It indicates the address of the next instruction to
be executed for the process.
CPU Registers: The registers vary in number and type depending on
the computer architecture. Register includes accumulators, index
registers, stack pointers and general purpose registers plus any
condition code information.
Memory Management Information: It includes information such as
value of base and limit registers, page tables, segment tables,
depending on the memory system used by OS.
Accounting Information: This information includes the amount of
CPU used, time limits, account holders, job or process number and so
on. It also includes information about listed I/O devices allocated to the
process such as list of open files.
Each PCB gives information about a particular process for which it is
designed.

5 Attempt any Two of the following: 12M


a Enlist the operating system tools. Explain any two in detail. 6M
Ans Following are the operating tools: For List=2
 User Management Marks and
 Security policy Explanatio
 Device Management n any two
 Performance Monitor for 4
 Task Scheduler Marks

A) User management:
 User management includes everything from creating a user to
deleting a user on your system. User management can be done
in three ways on a Linux system.
 Command line tools include commands like useradd, userdel,
usermod, passwd, etc. These are mostly used by the server
administrators.
Useradd: With useradd commands you can add a user.

17 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Syntax: useradd -m -d /home/<userName> -


c "<userName>" <userName>
Example: useradd -m -d /home/xyz -c "xyz" xyz
File /etc/default/useradd contains some user default options.
The command useradd -D can be used to display this file.
Syntax: useradd -D

Userdel: To delete a user account userdel command is used.


Syntax: userdel -r <userName>

Usermod: The command usermod is used to modify the properties of


an existing user.
Syntax: usermod -c <'newName'> <oldName>
Example: usermod -c 'vppoly' john

Using passwd command


Passwd: A user can set the password with the command passwd. Old
password has to be typed twice before entering the new one.
Syntax: passwd <userName>
Example: passwd vppoly

B) Device Management:
Device management is the process of managing the implementation,
operation and maintenance of a physical and/or virtual device.
All Linux device files are located in the /dev directory, which is an
integral part of the root (/) filesystem because these device files must
be available to the operating system during the boot process.
Example: ls –l /dev
Above example gives the list of device file from kernel.
Udev supplies a dynamic device directory containing only the nodes
for devices which are connected to the system. It creates or removes
the device node files in the /dev directory.

C) Performance Monitor:
It is very tough job for every system or network administrator to
monitor and debug Linux System Performance problems every day.
The commands discussed below are some of the most fundamental
commands when it comes to system analysis and debugging Linux
server issues such as:
1) vmstat: Virtual memory statistics
The vmstat command reports information about processes, memory,
paging, block IO, traps, and cpu activity.
$ vmstat 3

2)top: Process activity monitoring command

18 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

top command display Linux processes. It provides a dynamic real-time


view of a running system i.e. actual process activity. By default, it
displays the most CPU-intensive tasks running on the server and
updates the list every five seconds.
$ top

3) free: Show Linux server memory usage


free command shows the total amount of free and used physical and
swap memory in the system, as well as the buffers used by the kernel.
# free

4) iostat: Montor Linux average CPU load and disk activity


iostat command report Central Processing Unit (CPU) statistics and
input/output statistics for devices, partitions and network filesystems
(NFS).
# iostat

5) netstat Linux network and statistics monitoring tool


netstat command displays network connections, routing tables,
interface statistics, masquerade connections, and multicast
memberships.
# netstat –tulpn
b Explain multithreading model in detail. 6M
Ans Many systems provide support for both user and kernel threads, Each
resulting in different multithreading models. model=2M
Following are three multithreading model:

Many-to-One Model
 The many-to-one model maps many user-level threads to one
kernel thread.
 Thread management is done by the thread library in user space,
so it is efficient; but the entire process will block if a thread
makes a blocking system call.
 Also, because only one thread can access the kernel at a time,
multiple threads are unable to nm in parallel on
multiprocessors.
 Example: Green threads- a thread library available for Solaris

19 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Advantages:
 More concurrency because of multiple threads can run in
parallel on multiple CPUs.
 Less complication in the processing.
Disadvantages:
 Thread creation involves light-weight process creation.
 Kernel thread is an overhead.
 Limiting the number of total threads.

One-to-One Model
 The one-to-one model maps each user thread to a kernel thread.
 It provides more concurrency than the many-to-one model by
allowing another thread to run when a thread makes a blocking
system call; it also allows multiple threads to run in parallel on
multiprocessors.
 The only drawback to this model is that creating a user thread
requires creating the corresponding kernel thread.
 Because the overhead of creating kernel threads can burden the
performance of an application, most implementations of this
model restrict the number of threads supported by the system.
 Linux, along with the family of Windows operating systems,
implement the one-to-one model.

Advantages:
 Mainly used in language system, portable libraries.
 One kernel thread controls multiple user thread.

Disadvantages:
 Parallelism is not supported by this model.
 One block can blocks all user threads.

Many-to-Many Model
 The many-to-many model multiplexes many user-level threads
to a smaller or equal number of kernel threads.
 The number of kernel threads may be specific to either a
particular application or a particular machine (an application
may be allocated more kernel threads on a multiprocessor than
on a uniprocessor).

20 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

 The one-to-one model allows for greater concurrency, but the


developer has to be careful not to create too many threads
within an application (and in some instances may be limited in
the number of threads she can create).
 The many-to-many model suffers from neither of these
shortcomings: developers can create as many user threads as
necessary, and the corresponding kernel threads can run in
parallel on a multiprocessor.
 Also, when a thread performs a blocking system call, the kernel
can schedule another thread for execution.

Advantages:
 Many threads can be created as per user’s requirement.
 Multiple kernel or equal to user threads can be created.
Disadvantages:
 True concurrency cannot be achieved.
 Multiple threads of kernel is an overhead for operating system
c Explain LRU page replacement algorithm for following reference 6M
string. 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
Calculate the page fault.
Ans LRU: LRU
 The Least Recently Used (LRU) page replacement policy explanation
replaces the page that has not been used for the longest =2M
period of time. Calculation
 LRU replacement associates with each page the time of that =4 M
page's last use.
 When a page must be replaced, LRU chooses the page that has
not been used for the longest period of time.
 The LRU policy is often used as a page-replacement algorithm
and is considered to be good.
 An LRU page-replacement algorithm may require substantial
hardware assistance.

21 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Counters:
 In the simplest case, we associate with each page-table entry a
time-of-use field and add to the CPU a logical clock or counter.
 The clock is incremented for every memory reference.
 Whenever a reference to a page is made, the contents of the
clock register are copied to the time-of-use field in the page-
table entry for that page.
 In this way, we always have the "time" of the last reference to
each page. We replace the page with the smallest time value.

Stack:
 Another approach to implementing LRU replacement is to keep
a stack of page numbers.
 Whenever a page is referenced, it is removed from the stack
and put on the top.
 In this way, the most recently used page is always at the top of
the stack and the least recently used page is always at the
bottom.

Reference String: 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
(Frame size have not mentioned in question so assume frame size as 3
or 4)
LRU: Assume frame size=3
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 4 4 4 0 1 1 * 1 *
0 0 0 * 0 * 0 0 3 3 * 3 0 0 *

1 1 3 3 2 2 2 * 2 * 2 7
Page Fault=12
Assume frame size=4
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 7 3 3 * * 3 7
0 0 0 * 0 * 0 * 0 * 0 *
1 1 1 4 1 * 1 *
2 2 2 * * 2 * 2
Page fault=08

6 Attempt any Two of the following: 12M


a The jobs are scheduled for execution as follows: 6M
SJF=3 m
FCFS=3 m
(1m-gantt
chart, 2m
calculation

22 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Process Arrival Time Burst Time of AWT)


P1 0 7
P2 1 4
P3 2 10
P4 3 6
P5 4 8

i) SJF
ii) FCFS
Also find average waiting time using Gantt chart.
Ans SJF: Note:
Non-Preemptive SJF
Gantt Chart:
P1 P2 P4 P5 P3
0 7 11 17 25 35

Process Arrival Burst Waiting


Time Time Time
P1 0 7 0
P2 1 4 7-1=6
P3 2 10 25-2=23
P4 3 6 11-3=8
P5 4 8 17-4=13
Average waiting Time=(0+6+23+08+13)/5 = 50/5=10

OR

Preemptive SJF
Gantt Chart:
P1 P2 P1 P4 P5 P3
0 1 5 11 17 25 35

Process Arrival Burst Waiting Time


Time Time
P1 0 7 0+(5-1)=4
P2 1 4 1-1=0
P3 2 10 25-2=23
P4 3 6 11-3=8
P5 4 8 17-4=13

Average Waiting Time=4+0+23+8+13/5=9.6

23 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

ii) FCFS
Gantt chart:
P1 P2 P3 P4 P5
0 7 11 21 27 35

Process Arrival Burst Waiting Time


Time Time
P1 0 7 0-0=0
P2 1 4 7-1=6
P3 2 10 11-2=9
P4 3 6 21-3=18
P5 4 8 27-4=23

Average waiting Time=0+6+9+18+23/5 =56/5=11.2

b List free space management techniques? Describe any one in 6M


detail.
Ans A file system is responsible to allocate the free blocks to the file Listing=1M
therefore it has to keep track of all the free blocks present in the disk. Explanation
There are mainly four approaches by using which, the free blocks in =3M
the disk are managed. And
 Bit Vector Diagram=2
 Linked List M
 Grouping
 Counting
Bit Vector:
 The free-space list is implemented as a bit map or bit vector.
 Each block is represented by 1 bit. If the block is free, the bit is
1; if the block is allocated, the bit is 0.
 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
15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0
0 0 1 1 1 1 0 0 1 1 1 1 1 1 0

0=Free block
1= Allocated block

The main advantage of this approach is its relative simplicity and its
efficiency in finding the first free block or n consecutive free blocks on
the disk.

24 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

Linked List
 In this approach, the free disk blocks are linked together i.e. a
free block contains a pointer to the next free block.
 The block number of the very first disk block is stored at a
separate location on disk and is also cached in memory.
 In this approach, link all the disk blocks together, keeping a
pointer to the first free block.
 This block contains a pointer to the next free disk block, and so
on.

c Enlist different file allocation methods? Explain contiguous


allocation method in detail.
Ans From the user’s point of view, a file is an abstract data type. It can be created, 1m- listing,
opened, written, read, closed and deleted without any real concern for its 2m for
implementation. The implementation of a file is a problem for the operating diagram, 3m
system. for
The main problem is how to allocate space to these files so that disk space is explanation
effectively utilized and files can be quickly accessed.
Three major methods of allocating disk space are in wide use:
 Contiguous
 Linked
 Indexed
Contiguous Allocation
• The contiguous allocation method requires each file to occupy
a set of contiguous addresses on the disk. Disk addresses define
a linear ordering on the disk. Contiguous allocation of a file is
defined by the disk address of the first block and its length. If
the file is ‘n’ blocks long and starts at location ‘b’, then it
occupies blocks b, b+1, b+2, - - - - - b+n-1. The directory entry
for each file indicates the address of the starting block and the
length of the area allocated for this file.
• Contiguous allocation supports both sequential and direct

25 | 2 6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)

access.
• For direct access to block ‘i’ of a file, which starts at block ‘b’,
we can immediately access block b+i. The difficulty with
contiguous allocation is finding space for a new file.
• For direct access to block ‘i’ of a file, which starts at block ‘b’,
we can immediately access block b+i.
• The difficulty with contiguous allocation is finding space for a
new file.
• If file to be created are ‘n’ blocks long, we must search free
space list for ‘n’ free contiguous blocks.

Advantages of Contiguous File Allocation Method:


1. Supports both sequential and direct access methods.
2. Contiguous allocation is the best form of allocation for
sequential files. Multiple blocks can be brought in at a time to
improve I/O performance for sequential processing.
3. It is also easy to retrieve a single block from a file. For
example, if a file starts at block ‘n’ and the ith block of the file
is wanted, its location on secondary storage is simply n + i.
4. Reading all blocks belonging to each file is very fast.
5. Provides good performance.

Disadvantages of Contiguous File Allocation Method:


1. Suffers from external fragmentation.
2. Very difficult to find contiguous blocks of space for new files.
3. Also with pre-allocation, it is necessary to declare the size of
the file at the time of creation which many a times is difficult to
estimate.
4. Compaction may be required and it can be very expensive.

26 | 2 6
22516
21222
3 Hours / 70 Marks Seat No.
15 minutes extra for each hour

Instructions – (1) All Questions are Compulsory.


(2) Answer each next main Question on a new page.
(3) Illustrate your answers with neat sketches wherever
necessary.
(4) Figures to the right indicate full marks.
(5) Assume suitable data, if necessary.
(6) Mobile Phone, Pager and any other Electronic
Communication devices are not permissible in
Examination Hall.

Marks

1. Attempt any FIVE of the following: 10


a) State and describe any two advantages of multiprocessor
system.
b) State any four types of system calls.
c) Draw a neat labelled diagram for process state.
d) State difference between preemptive scheduling and
non-preemptive scheduling.
e) Define the term fragmentation in terms of memory.
f) Give commands to perform following tasks:
i) To add delay in script
ii) To terminate a process
g) List any four operations performed on a file.

P.T.O.
22516 [2]
Marks
2. Attempt any THREE of the following: 12
a) Describe working of time sharing system with neat diagram.
b) List and describe any four services of operating system.
c) Differentiate between shared memory system and message
passing system of interprocess communication.
d) State and describe any two scheduling criteria.

3. Attempt any THREE of the following: 12


a) Describe use of ps and wait commands with suitable example.
b) Describe prevention of deadlock occurrence with respect to
hold and wait necessary condition.
c) With suitable diagram, describe the concept of variable
partitioning of memory.
d) Describe linked file allocation method with suitable example.
Also list its one advantage.

4. Attempt any THREE of the following: 12


a) Differentiate between command line based operating system
and GUI based operating system (Any four points)
b) Describe various activities performed by following operating
system components.
i) Main memory management
ii) File management
c) With suitable diagram, describe use of scheduling queues in
process scheduling.
d) Write steps required for Banker’s algorithm to avoid deadlock.
e) With suitable example, describe any one free space management
technique.
22516 [3]
Marks
5. Attempt any TWO of the following: 12
a) Calculate average waiting time for following data using First
Come First Served (FCFS) and Shortest Job First (SJF)
algorithms.
Process Burst time Arrival time
P0 08 0
P1 04 1
P2 05 2
P3 03 3
b) Describe with example, use of following tools:
i) Device Management
ii) Performance monitor
iii) Task scheduler
c) Describe the concept of virtual memory with respect to
paging. Also draw paging hardware diagram and describe
its working with example.

6. Attempt any TWO of the following: 12


a) Describe one-to-one multithreading model with suitable
diagram. Also write any two advantages of one-to-one model
over many-to-one model.
b) Consider the following page reference string arrival with
three page frames:-
5, 6, 7, 8, 9, 7, 8, 5, 9, 7, 8, 7, 9, 6, 5, 6
Calculate number of page faults with optimal and FIFO
(First In First Out) page replacement algorithms.
c) Describe following directory structures in short with neat
sketches:
i) Single level
ii) Two level
iii) Tree structured
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)

WINTER – 2022 EXAMINATION


MODEL ANSWER
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 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) Differentiate between Multi programmed and Multitasking operating 2M
system (Any two points)
Ans. Features Multiprogramming Multitasking
Any two
It allows multiple A supplementary of the relevant
Basic
points,
programs to utilize multiprogramming 1M each
the CPU system also allows for
simultaneously. user interaction.
Mechanis Based on the context Based on the time-
m switching sharing mechanism.
mechanism.
Objective It is useful for It is useful for running
reducing/decreasing multiple processes at the

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

CPU idle time and same time, effectively


increasing increasing CPU and
throughput as much system throughput.
as possible.
Execution When one job or In a multiprocessing
process completes its system, multiple
execution or switches processes can operate
to an I/O task in a simultaneously by
multi-programmed allocating the CPU for a
system, the system fixed amount of time.
momentarily
suspends that
process. It selects
another process from
the process
scheduling pool
(waiting queue) to
run.
CPU In a multiuser In a single-user
Switching environment, the environment, the CPU
CPU switches switches between the
between processes of various
programs/processes programs.
quickly.
Timing It takes maximum It takes minimum time to
time to execute the execute the process.
process.

b) List any four services provided by O.S. 2M


Ans.  User Interface
 Program Execution ½ M each
for any 4
 I/O Operation services
 File system Manipulation
 Communication
 Error Detection
 Resource Allocation
 Accounting
 Protection and security

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

c) Define : Process, PCB 2M


Ans. Process:-A process is a program in execution. Process is also called
as job, task or unit of work. Correct
Definition
1M each
PCB:-Process Control Block is a data structure that contains
information of the process related to it. The process control block is
also known as a task control block, entry of the process table, etc.
d) Define CPU and I/O burst cycle. 2M
Ans. CPU burst cycle: It is a time period when process is busy with CPU.
Correct
I/O burst cycle: It is a time period when process is busy in working Definition
1M each
with I/O resources.
e) Differentiate between paging and segmentation. 2M

Ans. Parameters Paging Segmentation Any two


relevant
differences
Individual In Paging, we break a In the case of – 1M each
Memory process address space Segmentation, we break
into blocks known as a process address space
pages. into blocks known as
sections/segments.
Memory Size The pages are blocks The sections/segments
of fixed size. are blocks of varying
sizes.
Accountability The OS divides the The compiler mainly
available memory into calculates the size of
individual pages. individual segments,
their actual address as
well as virtual address.
Speed This technique is This technique is
comparatively much comparatively much
faster in accessing slower in accessing
memory. memory than Paging.
Size The available memory The user determines the
determines the individual segment
individual page sizes. sizes.
Fragmentation The Paging technique The Segmentation
may underutilize some technique may not use
of the pages- thus some of the memory

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

leading to internal blocks at all. Thus, it


fragmentation. may lead to external
fragmentation.
Logical A logical address A logical address
Address divides into page divides into section
offset and page offset and section
number in the case of number in the case of
Paging. Segmentation.
Data Storage In the case of Paging, In the case of
the page table leads to Segmentation, the
the storage of the page segmentation table leads
data. to the storage of the
segmentation data.
f) Write syntax of following commands- 2M
(i) Kill
(ii) Sleep 1M for each
Ans. i) kill correct
syntax
Syntax: kill Pid

ii) sleep
Syntax: sleep NUMBER[SUFFIX]…
sleep OPTION
g) List any four file operations. 2M
Ans.  Creating a file
 Writing a file: Any four
operations
 Reading a file: ½ M each
 Repositioning within a file
 Deleting a file
 Appending new information to the end of the file
 Renaming an existing 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) Explain Time sharing O.S. 4M
Ans. In time sharing system, the CPU executes multiple jobs by switching
among them. The switches occur so frequently that the users can
interact with each program while it is running. It includes an

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

interactive computer system which provides direct communication


between the user and the system. A time-sharing system allows many Relevant
users to share the computer resources simultaneously. The time- Explanation
4M
sharing system provides the direct access to many users where CPU
time is divided among all the users on scheduled basis. The operating
system allocates a time slice to each user. When this time is expired,
it passes control to the next user on the system. The time allowed is
extremely small and the users are given the impression that each of
them has their own CPU and they are the sole owner of the CPU. In
this time slice each user gets attention of the CPU. The objective of
time-sharing system is to minimize response time of process.
Example: The concept of time-sharing system is shown in figure:

In above figure, the user 5 is active but user 1, user 2, user 3, and user
4 are in waiting state whereas user 6 is in ready status.
b) Describe any two components of O.S. 4M
Ans. List of System Components:
1. Process management Description
2. Main memory management of any two
components
3. File management of OS
4. I/O system management 2M each
5. Secondary storage management

1.Process Management:
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 5 / 21
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)

WINTER – 2022 EXAMINATION


MODEL ANSWER
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. Main-Memory Management
Main memory is a large array of words or bytes, ranging in size from
hundreds of thousands to billions. Each word or byte has its own
address. Main memory is a repository of quickly accessible data
shared by the CPU and I/O devices. The central processor reads
instructions from main memory during the instruction fetch cycle and
both reads and writes data from main memory during the data fetch
cycle. The main memory is generally the only large storage device
that the CPU is able to address and access directly.
The operating system responsible for the following activities in
connection with main memory s management:
 Keeping track of which parts of memory are currently being used
and by whom.
 Deciding which processes (or parts thereof) and data to move into
and out of memory. 3. Allocating and deallocating memory space
as needed.
3. File Management
A file is a collected of related information defined by its creator.
Computer 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.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

4. I/O device Management


Input / Output device management provides an environment for the
better interaction between system and the I / O devices (such as
printers, scanners, tape drives etc.). To interact with I/O devices in an
effective manner, the operating system uses some special programs
known as device driver. The device drivers take the data that
operating system has defined as a file and then translate them into
streams of bits or a series of laser pulses (in regard with laser printer).
The I/O subsystem consists of several components:
 A memory management component that includes buffering,
caching, spooling
 A general device driver interface
 Drivers for specific hardware devices

5. Secondary-Storage Management
The computer system provides secondary storage to back up main
memory. Secondary storage is required because main memory is too
small to accommodate all data and programs, and the data that it
holds is lost when power is lost. Most of the programs including
compilers, assemblers, word processors, editors, and formatters are
stored on a disk until loaded into memory. Secondary storage consists
of tapes drives, disk drives, and other media.
The operating system is responsible for the following activities in
connection with disk management:
 Free space management
 Storage allocation
 Disk scheduling.

c) Explain shared memory model of Interprocess communication 4M


(IPC)
Ans. Inter-process communication: Cooperating processes require an Explanation
Inter- process communication (IPC) mechanism that will allow them 3M
Diagram
to exchange data and information. 1M

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

Shared memory

 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.
 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) Describe different scheduling criteria. 4M
Ans.  CPU utilization: - In multiprogramming the main objective is to
keep CPU as busy as possible. CPU utilization can range from 0 Any four
scheduling
to 100 percent. criteria -1M
each
 Throughput: - It is the number of processes that are completed
per unit time. It is a measure of work done in the system. When
CPU is busy in executing processes, then work is being done in
the system. Throughput depends on the execution time required
for any process.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

 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) Draw and explain process state diagram. 4M
Ans. Different process states are as follows:
1. New Process
2. Ready state
diagram
3. Running 2M
4. Waiting Explanation
5. Terminated 2M

New: When a process enters into the system, it is in new state. In this
state a process is created. In new state the process is in job pool.

Ready: When the process is loaded into the main memory, it is ready
for execution. In this state the process is waiting for processor
allocation.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

Running: When CPU is available, system selects one process from


main memory and executes all the instructions from that process. So,
when a process is in execution, it is in running state. In single user
system, only one process can be in the running state. In multiuser
system, there can be multiple processes which are in the running
state.

Waiting State: When a process is in execution, it may request for I/O


resources. If the resource is not available, process goes into the
waiting state. When the resource is available, the process goes back to
ready state.

Terminated State:
When the process completes its execution, it goes into the terminated
state. In this state the memory occupied by the process is released.
b) Describe conditions for deadlock prevention. 4M
Ans. By ensuring that at least one of below conditions cannot hold, we can
prevent the occurrence of a deadlock. Any four
conditions
1M each
1.Mutual Exclusion:
The mutual-exclusion condition must hold for non-sharable
resources. Sharable resources do not require mutually exclusive
access, thus cannot be involved in a deadlock.

2.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.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 these resources are implicitly

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

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.

4.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) Explain fixed size memory partitioning. 4M


Ans. Fixed Size Memory Partitioning (Static)
 Memory is divided into number of fixed size partitions, which is Correct
called as fixed or static memory partitioning. Explanation
4M
 Each partition contains exactly one process.
 The number of programs to be executed depends on number of
partitions.
 When the partition is free, a selected process from the input queue
is loaded into the free partition.
 When the process terminates, the partition becomes available for
another process.
 The operating system keeps a table indicating parts of memory
which are available and which are occupied.
 Initially, all memory is available for user processes and it is
considered as one large block of available memory, a hole.
 When a process arrives, large enough hole of memory is allocated
to the processes.

d) Explain linked file allocation method. 4M
Ans. Linked Allocation:
 This allocation is on the basis of an individual block. Each block Correct
explanation
contains a pointer to the next block in the chain. 4M,
 The disk block can be scattered anywhere on the disk.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

 The directory contains a pointer to the first and the last blocks of
Diagram
the file. Optional
 To create a new file, simply create a new entry in the directory.
 The following figure shows the linked allocation.

 There is no external fragmentation since only one block is needed


at a time.
 The size of a file need not be declared when it is created.
 A file can continue to grow as long as free blocks are available
 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 command line and Graphical user interface. 4M
(Any four points)

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

Ans. Any four


Parameter Command Line Graphic User points 1M
Interface(CLI) Interface(GUI) each

Definition Interaction is by Interaction with devices is by


typing commands graphics and visual
components and icons

Understan Commands need to Visual indicators and icons


ding be memorized are easy to understand

Memory Less memory is More memory is required as


required for storage visual components are
involved.

Working Use of keyboard for Use of mouse for interaction


Speed commands makes makes it slow
CLI quicker.

Resources Only keyboard Mouse and keyboard both


used can be used

Accuracy High Comparatively low

Flexibility Command line Structure and design can


interface does not change with updates
change, remains
same over time
b) Write any four systems call related to file management. 4M
Ans. System calls related to file management are:
1. create new file Any 4
2. delete existing file system calls
1M each
3. open file
4. close file
5. create directories
6. delete directories
7. read, write, reposition in file
8. getfile attributes
9. set file attributes

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

c) Compare between Long term and short term scheduler. (Any 4M


four points)
Ans. Any four
points 1M
Sr. Long Term Scheduler Short Term Scheduler each
No

1 It is job scheduler It is CPU scheduler

2 It selects processes from job It selects processes from


pool and loads them into ready queue which are ready
memory for execution to execute and allocates
CPU to one of them

3 Access job pool and ready Access ready queue and


queue CPU

4 It executes much less It executes frequently. It


frequently. It executes when executes when CPU is
memory has space to available for allocation
accommodate new process.

5 Speed is less than short term Speed is fast


scheduler

6 It controls the degree of It provides lesser control


multiprogramming over degree of
multiprogramming

7 It chooses a good process It chooses a new process for


that is a mix-up of a processor quite frequently.
input/output bound and CPU
bound.

d) Solve given problem by using SJF and FCFS scheduling 4M


algorithm using Gantt chart. Calculate the average waiting time
for each algorithm

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

Ans. Gantt Chart SJF


For each
scheduling
Gantt chart
Waiting Time 1M,
P1=17
P2=3 Each
P3=0 average
waiting time
P4=10 calculation
Average waiting time=Waiting time of all processes / Number of 1M
processes
=(17+3+0+10) /4
=30/4
=7.5 milliseconds (ms)

Gantt Chart FCFS

Waiting Time
P1=0
P2=9
P3=16
P4=19
Average waiting time=Waiting time of all processes / Number of
processes
=(0+9+16+19) /4
=44/4
=11 milli seconds (ms)

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

e) Describe free space management technique. (Any two) 4M


Ans. A file system is responsible to allocate the free blocks to the file
therefore it has to keep track of all the free blocks present in the Any 2
disk.There are mainly four approaches by using which, the free techniques
Correct
blocks in the disk are managed. Explanation
2M each
1. Bit Vector
2. Linked List

1 )Bit Vector:
The free-space list is implemented as a bit map or bit vector.
Each block is represented by 1 bit. If the block is free, the bit is 1; if
the block is allocated, the bit is 0.
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 finding the first free block or n consecutive free blocks
on the disk.

2) Linked List
In this approach, the free disk blocks are linked together i.e. a free
block contains a pointer to the next free block. The block number of
the very first disk block is stored at a separate location on disk and is
also cached in memory. In this approach, link all the disk blocks
together, keeping a pointer to the first free block. This block contains
a pointer to the next free disk block, and so on.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

5. Attempt any TWO of the following: 12


a) Write two uses of following O.S. tools 6M
(i) Device Management
(ii) Performance monitor 2 uses of
(iii) Task Scheduler each tool
2M
Ans. i) Device management:
 Managing all the hardware or virtual devices of computer system.
 Allow interaction with hardware devices through device driver.
 Used to install device and component-level drivers as well as
associated software.
 Allocate devices to the process as per process requirement and
priority.
 Deallocate devices either temporarily or permanently depending
on condition.
 Keeping track of all device’s data and location.
 Monitoring device status like printers, storage drivers and other
devices.
 Used to enforce the predetermined policies and decides which
process receives the device when and for how long.
ii) Performance monitor
1. Monitor various activities on a computer such as CPU or memory
usage.
2. Used to examine how programs running on their computer affect
computer’s performance
3. It is used to identify performance problems or bottleneck that
affect operating system or installed applications.
4. Used to observe the effect of system configuration changes.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

iii) Task scheduler


1. Assign processor to task ready for execution
2. Executing predefined actions automatically whenever a certain set
of condition is met.
(Any two relevant uses shall be considered)
b) Writer the outputs of following commands 6M
(i) Wait 2385018
(ii) Sleep 09
(iii) PS –u Asha
Ans. i) Wait command waits until the termination of specified process ID
2385018 2M for each
ii) Sleep command is used to delay for 9 seconds during the execution correct
output
of a processi.e. it will pause the terminal for 9 seconds.
iii) ps command with -u is used to display data/processes for the
specific user Asha.
c) Given a page reference string with three (03) page frames. 6M
Calculate 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,0,1
Ans. (Representation of frame can be in any order) Calculate
i) Optimal page fault
with
Ref 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 relevant
diagram-
F1 7 7 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7 7 7 3M each
F2 0 0 0 0 0 0 4 4 4 0 0 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 1 1
Fault F F F F F F F F F
Total page faults- 9

ii) LRU
Ref 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
F1 7 7 7 2 2 2 2 4 4 4 0 0 0 1 1 1 1 1 1 1

F2 0
0 0 0 0 0 0 0 3 3 3 3 3 3 0 0 0 0 0
F3 1 1 1 3 3 3 2 2 2 2 2 2 2 2 2 7 7 7
Fault F F F F F F F F F F F F
Total page faults-12

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

6. Attempt any TWO of the following: 12


a) Solve given problem by using 6M
(i) Pre-emptive SJF
(ii) Round Robin (Time Slice = 3 ms)
Calculate average waiting time using Gantt Chart

Ans. (i) Pre emptive SJF:


Each
method 3M
-
1M for
Gantt chart,

Waiting Time= (Total completion time –Burst time ) – Arrival 1M for


Waiting
time time
calculation,
P11 –(17-8)-0 = 9ms,
P12- (5 – 4) -1 =0ms, 1M for
P13- ( 26-9)-2 =15ms, Average
waiting time
P14- ( 10-5)-3 =2ms
Average waiting time :- (9+0+15+2)/4= 26/4=6.5 ms

(ii) Round Robin (Time Slice = 3 ms)

Waiting time: - P11 = (23-8)-0 =15ms,


P12-(16 – 4)- 1 =11ms,
P13-(26-9)-2 =15ms,
P14-(21-5)-3 =13ms
Average waiting time:- (15+11+15+13)/4=54/4= 13.5ms

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

b) Consider the following memory map and assume a new process 6M


P4 comes with memory requirements of 6 KB.
Locate (Draw) this process in memory using. Each fit
i) First fit diagram 2M
ii) Best Fit
iii) Worst Fit

Ans. First Fit: Allocate Best Fit: Allocate Worst fit: Allocate
the first free block the smallest free the largest free
to the new process block that is big block to the new
P4. enough to process P4.
accommodate new
process P4.
O. S. O. S. O. S.
P1 P1 P1
P4 6KB <FREE> 12 KB <FREE> 12 KB
<FREE> 6KB P2 P2
P2 <FREE> 19 KB P4 6 KB
<FREE> 19 KB P3 <FREE> 13 KB
P3 P4 6 KB P3
<FREE> 7 KB <FREE> 1 KB <FREE> 7 KB

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


terms of two level and tree structure.
Ans. 1) Two-level directory: -
In the two-level structures, each user has its own user file directory Explanation
of structure
(UFD). The UFD lists only files of a single user. System contains a 2M each,
master file directory (MFD) which is indexed by user name or
account number. Each entry in MFD points to the UFD for that user. Constructio
When a user refers to a particular file, only his own UFD is searched. n of
structure
Different users can have files with the same name, as long as all the 1M each
file names within each UFD are unique.

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

WINTER – 2022 EXAMINATION


MODEL ANSWER
Subject: Operating System Subject Code: 22516

When we create a file for a user, operating system searches only that
user’s UFD to find whether same name file already present in the
directory. For deleting a file again operating system checks the file
name in the user’ UFD only.

2. Tree structure:-
In this directory structure user can create their own sub-directories
and organize their files. The tree has a root directory and every file
has a unique path name. A directory contains a set of files or
subdirectories. All directories have the same internal format. One bit
in each directory entry defines the entry as a file (0) or as a
subdirectory (1). Each process has a current directory. Current
directory contains files that are currently required by the process.
When reference is made to a file, the current directory is searched. If
a file needed that is not in the current directory, then the user usually
must either specify a path name or change the current directory.

Page 21 / 21
22516
22223
3 Hours / 70 Marks Seat No.

Instructions – (1) All Questions are Compulsory.


(2) Illustrate your answers with neat sketches wherever
necessary.
(3) Figures to the right indicate full marks.
(4) Assume suitable data, if necessary.
(5) Mobile Phone, Pager and any other Electronic
Communication devices are not permissible in
Examination Hall.
(6) Preferably, write the answer in sequential order.

Marks

1. Attempt any FIVE of the following: 10


a) State any two features of Linux.
b) Difference between Time sharing system and Real time
system (any 2 points)
c) State any four services of operating system.
d) Write the difference between pre-emptive and non-preemptive
scheduling.
e) Define following terms :
i) Virtual Memory
ii) Paging

f) List any four file attributes and it's meaning.


g) Define Deadlock.

P.T.O.
22516 [2]
Marks
2. Attempt any THREE of the following: 12
a) Explain different types of system calls.
b) Draw and explain process control block in detail.
c) State and explain four scheduling criteria.
d) Define fragmentation. Explain Internal and External Fragmentation

3. Attempt any THREE of the following: 12


a) Describe multiprocessor OS with it's advantages. (any two)
b) Explain different components of operating system.
c) Explain different types of schedulers.
d) Explain two level directory structure with suitable diagram.

4. Attempt any THREE of the following: 12


a) Explain real time OS. Explain it's types.
b) Draw process state diagram and describe each state.
c) Describe any four condition for deadlock.
d) Differentiate between paging and segmentation (any 4 points)
e) Explain fixed and variable memory management.

5. Attempt any TWO of the following: 12


a) Explain the working of interprocess communication considering
i) Shared memory
ii) Message passing
b) With neat diagram explain multilevel queue scheduling.
c) Write two uses of following operating system tools.
i) Security policy
ii) User Management
iii) Task scheduler
22516 [3]
Marks
6. Attempt any TWO of the following: 12
a) List file allocation method and explain any one in details.
b) For the page reference string
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
Calculate the page faults applying.
i) Optimal
ii) LRU
iii) FiFo page
Replacement algorithms for a memory with three frames.
c) Consider the four processes P1, P2, P3 and P4 with
length of CPO Burst time. Find out Avg waiting time
and Avg turn around time for the following Algorithms.
i) FCFS
ii) RR (Slice-4ms)
iii) SJF
Process Arrival time Burst time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)


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 (yashpatil4549@gmail.com)

You might also like