OSY-EPA With Solution
OSY-EPA With Solution
Winter- Unit 4- Q1 d Define CPU bound program and I/O bound program 2
2023 CPU Q2 d Explain following terms w.r.t. Scheduling: a) CPU Utilization b) Throughput c) Turn around time 4
Scheduling d) Waiting time
and Q3 b What is deadlock? Discuss any one method of deadlock prevention 4
Algorithms Q4 d Solve given problem bys using FCFS scheduling algorithm. Draw correct Gantt Chart and calculate
average waiting time and average turn around time
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question Number as per MSBTE paper Marks
Year Name
Process Arrival Time Burst Time (in ms)
P0 0 10
P1 1 29
P2 2 3
P3 3 7
P4 4 12
Q6 a How pre-emptive scheduling is better than non-preemptive scheduling by solving following problem 6
using SJF (solve it by using pre-emptive SJF and non-pre-emptive SJF also)
Process Arrival Time Burst Time (in ms)
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Summer- Unit 4- Q1 d Write the difference between preemptive and non-preemptive scheduling 2
2023 CPU Q1 g Define Deadlock 2
Scheduling Q2 c State and explain four scheduling criteria 4
and Q4 c Describe any four condition for deadlock 4
Algorithms Q4 d Explain fixed and variable memory management 4
Q5 b With neat diagram explain multilevel queue scheduling 6
Q6 c Consider the four processes P1, P2, P3 and P4 with length of CPU burst time. Find out Average
waiting time and Average Turn-around time for the following algorithms
1) FCFS 2) RR (Slice: 4ms) 3) SJF
Process Arrival Time Burst Time (in ms)
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Winter- Unit 4- Q1 d Define CPU and I/O burst cycle. 2
2022 CPU Q2 d Describe different scheduling criteria. 4
Scheduling Q3 b Describe conditions for deadlock prevention. 4
and Q4 d Solve given problem by using SJF and FCFS scheduling algorithm using Gantt chart. Calculate the 4
Algorithms average waiting time for each algorithm.
Process Burst Time (in ms)
P1 9
P2 7
P3 3
P4 7
Q6 a Solve given problem by using (i) Pre-emptive SJF (ii) Round Robin (Time Slice = 3 ms) Calculate 6
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question Number as per MSBTE paper Marks
Year Name
average waiting time using Gantt Chart.
Process A.T B. T. (in ms)
P11 0 8
P12 1 4
P13 2 9
P14 3 5
Summer- Unit 4- Q1 d State difference between preemptive scheduling and non-preemptive scheduling. 2
2022 CPU Q2 d State and describe any two scheduling criteria. 4
Scheduling Q3 b Describe prevention of deadlock occurrence with respect to hold and wait necessary condition. 4
and Q4 d Write steps required for Banker’s algorithm to avoid deadlock. 4
Algorithms Q5 a Calculate average waiting time for following data using First Come First Served (FCFS) and Shortest 6
Job First (SJF) algorithms.
Process A.T B. T. (in ms)
P0 0 8
P1 1 4
P2 2 5
P3 3 3
Hard Real-Time operating system: In Hard RTOS, all critical tasks must be completed within the
specified time duration, i.e., within the given deadline. Not meeting the deadline would result in critical
failures such as damage to equipment or even loss of human life. Consider an on-stock trading software. If
someone wants to sell a particular share, the system must ensure that command is performed within a
given critical time. Otherwise, if the market falls abruptly, it may cause a huge loss to the trader.
Soft Real-Time operating system: Soft RTOS accepts a few delays via the means of the Operating
system. In this kind of RTOS, there may be a closing date assigned for a particular job, but a delay for a
small amount of time is acceptable. So, cut off dates are treated softly via means of this kind of RTOS. For
Example, This type of system is used in Online Transaction systems and Livestock price quotation
Systems.
Firm Real-Time operating system: In Firm RTOS additionally want to observe the deadlines. However,
lacking a closing date might not have a massive effect, however may want to purposely undesired effects,
like a massive discount within the fine of a product. For Example, this system is used in various forms of
Multimedia applications.
Winter- Unit 1 Q1 a: Differentiate between Multi programmed and multi-tasking operating system (Any two points). 2M
2022 Overview of Answer:
Operating
System
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Multiprogramming Multi-tasking
It includes the single CPU to execute the program. It uses multiple tasks for the task allocation. Any two
Concept of Context Switching is used. Concept of Context Switching and Time Sharing relevant
is used. points,
Switching occurs when the process currently Switching occurs after the time slice of the 1M each
running stops. current process is finished.
Multi-programming increases CPU utilization by In multi-tasking also increases CPU utilization
organizing jobs . and it also increases responsiveness.
The idea is to reduce the CPU idle time for as The idea is to further extend the CPU Utilization
long as possible. concept by increasing responsiveness Time
Sharing.
It uses job scheduling algorithms so that more Time sharing mechanism is used so that
than one program can run at the same time. multiple tasks can run at the same time.
Execution of process takes more time. Execution of process takes less time.
Q2 a :Explain Time sharing O.S. 4M
Answer:
Relevant
Explanation
4M
Multiprogramming:
OR
Figure of multiprogramming system
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
1. In multiprogramming, more than one program lies in the memory.
2. The scheduler selects the jobs to be placed in ready queue from a number of programs.
3. The ready queue is placed in memory and the existence of more than one program in main
memory is known as multiprogramming.
4. Since there is only one processor, there multiple programs cannot be executed at a time.
5. Instead, the operating system executes part of one program, then the part of another and
so on.
6. Example of multiprogramming: user can open word, excel, access and other applications in
a system.
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. 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.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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.
• Allocating and deallocating memory space as needed.
3. File Management
A file is a collected of related information defined by its creator. Computers can store files on the disk
(secondary storage), which provide long term storage. Some examples of storage media are magnetic
tape, magnetic disk and optical disk. Each of these media has its own properties like speed, capacity, and
data transfer rate and access methods. A file system normally organized into directories to ease their use.
These directories may contain files and other directions.
The operating system responsible for the following activities in connection with file management:
• The creation and deletion of files.
• The creation and deletion of directions.
• The support of primitives for manipulating files and directions.
• The mapping of files onto secondary storage.
• The backup of files on stable storage media.
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
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
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.
Q4 b Explain any four types of system call. 4
Answer:
1. Process and Job Control
• A running program needs to be able to halt its execution either normally (end) or abnormally
(abort). If the program discovers an error in its input and wants to terminate abnormally, it may also
want to define an error level.
• A process or job executing one program may want to load and execute another program. This
allows the control card interpreter to execute program as directly by the control cards of the user
job. If we create a new job or process, we should able to control its execution.
• We may also want to terminate a job or process that we created (terminate process). If we find that
it is incorrect or no longer needed we need waiting time to finish execution (wait time). Another set
of system calls are helpful in debugging a program.
Example of Process related system call:
a. End, Abort.
b. Load, Execute.
c. Create process, Terminate process.
d. Ready process, Dispatch process.
e. Suspend process, Resume process.
f. Get process attributes, Set process attributes.
g. Wait for Time.
h. Wait event, Signal event.
i. Change priority of process.
2. File Management
• We can identify several common system calls dealing with files. We first need to be able to create
and delete files such a system call requires the name of the file and perhaps some of its attributes.
• Once, the file is created, we need to open it and use it. We may also read, write and reposition.
Finally we need to close the file, indicating that we are no longer using it.
Example of file related system call:
a. Create file, Delete file
b. Open a file, Close a file.
c. Create directory.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
d. Read, Write, Reposition.
e. Get file attributes, Set file attributes.
f. Create a link.
g. Change working directory.
3. Device Management
• Files can be thought of as abstract or virtual devices. Thus manyof the system calls for files are
also needed for devices.
• If there are multiple users of the system however we must first request the device to ensure that we
have exclusive use of it. After we are finished with the device, we must release it. These functions
are similar to the open/close system calls for files.
• Once, the device has been requested we can read, write and reposition the device just as with
files.
System call related to device management:
a. Request device, Release device.
b. Read, Write, Reposition.
c. Get device attributes, set device attributes.
4. Information Maintenance
• Many system calls exist simply for the purpose of transferring information between the user
program and the operating system. For example most systems have a system call to return the
current time and date.
• Other system calls may return information about the system such as the number of current users,
the version number of the operating system, the amount of free memory or disk space and so on.
• In addition the operating system keeps information about all of its jobs and processes and there are
system calls to access this information. Generally, there are also calls to reset it. (get process
attributes and set process attributes).
Information Maintenance related system call:
a. Get Time or Date, Set Time or Date.
b. Get system Data, Set system Data.
c. Get process, File or Device attributes.
d. Set process, File or Device attributes.
5. Communication
• There are two models of inter-process communication, the message-passing model and the shared
memory model.
• Message-passing uses a common mailbox to pass messages between processes
• Shared memory use certain system calls to create and gain access to regions of memory owned by
other processes
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Communication related system calls:
a. Establish a connection.
b. Send, receive messages.
c. Terminate a connection
Q5 a Explain the use of following OS tools: i) Device Manager ii) Task Scheduler 6
Answer:
i) Device Manager use:
1. Managing all the hardware or virtual devices of computer system.
2. Allow interaction with hardware devices through device driver.
3. Used to install device and component-level drivers as well as associated software.
4. Allocate devices to the process as per process requirement and priority.
5. Deallocate devices either temporarily or permanently depending on condition.
6. Keeping track of all device’s data and location.
7. Monitoring device status like printers, storage drivers and other devices.
8. Used to enforce the predetermined policies and decides which process receives the device when and for
how long.
User Management: As the administrator, it is your job to create and manage the accounts for all required
users. Linux comes with several tools for user management. User management includes everything from
creating a user to deleting a user on your system.
Following are the Linux command line tools for managing users and groups:
1. useradd.
2. usermod.
3. userdel.
Useradd: Creating New User: To add new users in Linux system we can use useradd command.
Syntax: useradd login_name
Example: useradd xyz
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
passwd Command: The passwd command is used to set up passwords for users.
Syntax: password user_name
Example: $ passwd vijay
Changing password for vijay:
(current) UNIX password: 123 45
Enter new UNIX password: abc@123
Retype new UNIX password: abc@123
passwd: password updated successfully
Usermod: Modifying Properties of User: The command usermod is used to modify the properties of an
existing user.
Syntax: usermod -c <'newName'> <oldName>
Userdel: Delete a user account: To delete a user account userdel command is used.
Syntax: userdel -r <userName>
Performance Monitor: It is really very tough job for every System or Network administrator to monitor and
debug Linux System Performance problems every day.
top Command: Linux top command is a performance monitoring program which is used frequently by many
system administrators to monitor Linux performance and it is available under many Linux/Unix like
operating systems. The top command 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.
The top command is much useful for system administrator to monitor and take correct action when
required.
$ top
Summer- Unit 2- Q1 c State any four services of Operating System 2
2023 Services and Answer: Refer Q2 b of Summer 2022
Components Q2 a Explain different types of system calls 4
of OS Answer: Refer Q4 b of Summer 2024
Q3 b Explain different components of Operating System 4
Answer: Refer Q2 b of Summer 2024
Winter- Unit 2 Q1 b: List any four services provided by O.S. 2M
2022 Answer:
Services and • User Interface ½ M each
Components • Program Execution for any 4
of OS • I/O Operation services
• File system Manipulation
• Communication
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• Error Detection
• Resource Allocation
• Accounting
• Protection and security
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.
• 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.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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.
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. Oncethe 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 users, 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
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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 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.
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.
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
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
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 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
Summer- Unit 3- Q1 c Draw process state diagram 2
2024 Process Answer:
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Management
Q3 a Define Process. Draw a Process Control Block and explain the information in PCB 4
Answer:
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q5 b Explain user level thread and Kernel level thread with its advantages and disadvantages 6
Answer
User Level Thread: In a user thread, all of the work of thread management is done by the application and
the kernel is not aware of the existence of threads. The thread library contains code for creating and
destroying threads, for passing message and data between threads, for scheduling thread execution and
for saving and restoring thread contexts. The application begins with a single thread and begins running in
that thread. User level threads are generally fast to create and manage.
Advantages of user level thread over Kernel level thread:
1. Thread switching does not require Kernel mode privileges.
2. User level thread can run on any operating system.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
3. Scheduling can be application specific.
4. User level threads are fast to create and manage.
Winter- Unit 3- Q1 c Draw neat labelled process state diagram along with the correct directions of arrows 2
2023 Process Answer: Refer Q1 C of Summer 2024
Management Q1 f What is the use of ps command? Write long form of UID, PID in the output of this command 2
Answer: You can use the ps command to display a list of your processes that are currently running and
obtain additional information about those processes.
UID: User Identification Number
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
PID: Process Identification Number
Q2 c Explain shared Memory Method of IPC using neat labelled diagram 4
Answer: Refer Q2 c of Winter 2022
Q3 a Explain following commands with their syntax: 1) kill 2) sleep 3) wait 4) exit 4
Answer: Refer Q1 f of Winter 2022
Wait: The wait command in Linux is a built-in shell command that pauses script execution until a specific
process or job finishes
Syntax: wait [PID] where PID represents the Process ID of the specific process that the script is waiting for.
Exit: The 'exit' command is a fundamental command in Linux used to exit the current shell session. This
command is widely used in scripting and command-line operations, allowing users and scripts to terminate
a session or a process in a controlled manner.
Syntax: exit
Q4 c Explain working of CPU switch from process to process with neat labelled diagram 4
Answer: Refer Q4 c of Summer 2024
Q5 b Differentiate between process and thread (any two points) also discuss the benefits of 6
multithreading programming
Process Thread
A process is a program under execution i.e A thread is a lightweight process that can be
an active program. managed independently by a scheduler.
Process are heavy weight operations Threads are heavy weight operations
Every process has its own memory space Threads use the memory of the process they belong
to.
Context switching between the process is Context switching between threads of the same
more expensive process is less expensive
Processes are independent. Threads are dependent
Process is controlled by the operating Threads are controlled by programmer in a program.
system.
Benefits of Multithreading
▪ Enhanced performance by decreased development time
▪ Simplified and streamlined program coding
▪ Improvised GUI responsiveness
▪ Simultaneous and parallelized occurrence of tasks
▪ Better use of cache storage by utilization of resources
▪ Decreased cost of maintenance
▪ Better use of CPU resource
Summer- Unit 3- Q2 b Draw and explain process control block in detail 4
2023 Process Answer: Refer Q3 a of Summer 2024
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Management Q3 c Explain different types of Schedulers 4
Answer:
Long term scheduler: Long term scheduler is also known as job scheduler. It chooses the processes from
the pool (secondary memory) and keeps them in the ready queue maintained in the primary memory. Long
Term scheduler mainly controls the degree of Multiprogramming. The purpose of long term scheduler is to
choose a perfect mix of IO bound and CPU bound processes among the jobs present in the pool.
Short term scheduler: Short term scheduler is also known as CPU scheduler. It selects one of the Jobs
from the ready queue and dispatch to the CPU for the execution. A scheduling algorithm is used to select
which job is going to be dispatched for the execution. The Job of the short term scheduler can be very
critical in the sense that if it selects job whose CPU burst time is very high then all the jobs after that, will
have to wait in the ready queue for a very long time.
Medium term scheduler: Medium term scheduler takes care of the swapped out processes. If the running
state processes needs some IO time for the completion then there is a need to change its state from
running to waiting. Medium term scheduler is used for this purpose. It removes the process from the
running state to make room for the other processes. Such processes are the swapped out processes and
this procedure is called swapping. The medium term scheduler is responsible for suspending and resuming
the processes.
Q4 b Draw Process State Diagram and describe each state. 4
Answer: Refer Q3 a of Winter 2022
Q5 a Explain working of Inter-process communication considering a) Shared Memory b) Message 6
Passing
Answer: Refer Q2 c of Winter 2019
Winter- Unit 3 Q1 c : Define : Process, PCB. 2M
2022 Answer:
Process Process:-A process is a program in execution. Process is also called as job, task or unit of work. Correct
management Definition
PCB:-Process Control Block is a data structure that contains information of the process related to it. The 1M each
process control block is also known as a task control block, entry of the process table, etc.
Q1 f : Write syntax of following commands- (i) Kill (ii) Sleep 2M
Answer: 1M for each
i) kill Syntax: kill Pid correct
ii) sleep Syntax: sleep NUMBER[SUFFIX]… sleep OPTION syntax
7 It chooses a good process that is a mix- It chooses a new process for a processor quite
up of input/output bound and CPU bound. frequently.
Q1 f : Give commands to perform following tasks: i) To add delay in script ii) To terminate a 2M
process 1M for each
Answer: correct
i. sleep command
ii. kill name
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q2c : Differentiate between shared memory system and message passing system of inter-process 4M
communication.
Answer:
Basis Shared Memory System Message Passing System
Any four
Communication Communication is established using a Communication is established using the points 1M
shared memory region. message passing facility. each
Data Size Useful for exchanging larger amount of Useful for exchanging small amount of data.
data.
Process Location Useful for the communicating processes Useful for the communicating processes that
that are on same system. are on different remote system.
Speed Communication between the process is Communication speed is comparatively
faster. slower.
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.
wait command: wait until all background processes are completed and then exits and if process ID is
given wait waits for the process identified by process ID pid , and reports its termination status.
Syntax: $ wait
and
$wait pid
Example:
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
1) $ wait
output:
Wait for all background processes to terminate, and return its exit status
2)$wait 4123
output:
Wait for process 4123 to terminate, and return its exit status.
Q4 c : With suitable diagram, describe use of scheduling queues in process scheduling. 4M
Answer:
Scheduling
queue
diagram 1M
And 1M for
each correct
queue
Explanation
Ready queue: The processes that are residing in main memory and are ready and waiting to execute are
kept on a list called the ready queue.
Job queue: As processes enter the system they are put into a job queue.
Device queue: The list of processes waiting for a particular I/O device is called device queue.
Q6 a : Describe one-to-one multithreading model with suitable diagram. Also write any two 4M
advantages of one-to-one model over many-to-one model.
Answer:
One-to-One Model
Explanation
3M Diagram
1M and 1M
each for any
Two
advantages
Figure of One-to-One Model
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
1. The one-to-one model maps each user thread to a kernel thread.
2. 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.
3. The only drawback to this model is that creating a user thread requires creating the
corresponding kernel thread.
4. 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.
5. Linux, along with the family of Windows operating systems, implement the one-to-one model.
Advantages of one-to-one model over many-to-one model.
1. one-to-one model gives greater concurrency than the many-to-one model.
2. It permits any other thread to run while a thread makes a blocking off gadget call.
3. It helps more than one thread to execute in parallel in system.
Winter- Unit 3 Q1 c : Draw process state diagram. 2M
2019 Answer:
Process 1M
management for correct
well
labelled
Process
state
diagram (1
M
specifying
correct
states in
the
diagram)
Figure of process states
Q1 f : Write syntax of following commands: (i) Sleep (ii) Kill 2M
Answer:
i)sleep 1 mark
Syntax: each for
sleep NUMBER[SUFFIX]… correct
sleep OPTION syntax
ii) kill
Syntax: kill pid
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q2 c: With neat diagram explain inter process communication model. 4M
Answer:
Inter-process communication: Cooperating processes require an Inter process communication (IPC) 1 mark
mechanism that will allow them to exchange data and information. Define
There are two models of IPC inter
1.Shared memory process
In this, all processes who want to communicate with other processes can communicati
access a region of the memory residing in an address space of a process on -1
creating a shared memory segment. All the processes using the shared mark;
memory segment should attach to the address space of the shared diagram of
memory. All the processes can exchange information by reading and/or model - 1
writing data in shared memory segment. The form of data and location mark;
are determined by these processes who want to communicate with each explanation
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. 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.
Q3 a : Explain ‘PS’ command with any four options. 4M
Answer:
ps command: It is used to display the characteristics of a process. This command when execute without four
options, it lists the processes associated with a user at a particular terminal. options-1M
Syntax: $ ps [options] each
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:
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
-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
Q4 a : Write unix command for following: (i) Create a folder OSY (ii) Create a file FIRST in OSY 4M
folder (iii) List / display all files and directories. (iv) Write command to clear the screen
Answer:
i) create a folder OSY: Each correct
$mkdir OSY command-
ii)create a file FIRST in OSY folder: 1M
$cd OSY
$cat>FIRST or $ touch FIRST
iii) List/display all files and directories:
$ls
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
iv) to clear screen:
$clear
Q4 c : State and describe types of scheduler. 4M
Answer:
There are three types of scheduler:
• Long term scheduler
• Short term scheduler list-1M,
• Medium term scheduler description
Long term scheduler: of each-1
• 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.
Many-to-One Model
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.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
One-to-One Model
Disadvantages:
• Parallelism is not supported by this model.
• One block can blocks all user threads.
Many-to-Many Model
OR
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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).
• 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).
• he 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 kernels or equal to user threads can be created.
Disadvantages:
• True concurrency cannot be achieved.
• Multiple threads of kernel is an overhead for operating system
Summer- Unit 4- Q1 d State two features of non-preemptive scheduling 2
2024 CPU Answer:
Scheduling 1. Once CPU is allocated to the process, the process keeps the CPU until it releases the CPU either
and by terminating or by switching to the waiting state.
Algorithms 2. A process switches from running state to waiting state or running to terminated state.
3. Low scheduling overhead.
4. Simple to implement and manage.
5. Less responsive in terms of priority for urgent task.
Q2 d What is CPU Scheduler? Explain the preemptive and non-preemptive type of scheduling 4
Answer
CPU Scheduler: When the CPU becomes idle, the CPU scheduler selects one of the processes in the
ready queue for execution. The CPU scheduler selects a process from the processes in memory that are
ready to execute and allocates the CPU to that process.
Pre-emptive scheduling: Once the CPU is allocated to a process, the CPU is forcefully removed from that
process due to occurrence of interrupt or completion of I/O request by the requesting process. In this
scheduling, a process changes its status from running state to ready state or waiting state to ready state.
Non-Preemptive scheduling: Once the CPU is allocated to a process, the process keeps the CPU until it
releases the CPU by terminating or by switching to the waiting state. Control of CPU is with the process to
which it is allocated.In this scheduling, a process changes its status from running to waiting or running to
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
terminate.
Q3 b Define deadlock. State the conditions necessary for deadlock 4
Answer
Deadlock: Deadlock is a situation when two or more processes get locked and cannot processed further
because of inter-dependability. In real world, deadlocks can arise when two persons wait for phone calls
from one another.
OR
Deadlock is defined as, "a situation where a set of processes are blocked because each process is holding
a resource and waiting for another resource acquired by some other process".
Winter- Unit 4- Q1 d Define CPU bound program and I/O bound program 2
2023 CPU Answer: Refer Q2 d of Winter 2019
Scheduling Q2 d Explain following terms w.r.t. Scheduling: a) CPU Utilization b) Throughput c) Turn around 4
and time d) Waiting time
Algorithms Answer: Refer Q2 d of Winer 2022
Q3 b What is deadlock? Discuss any one method of deadlock prevention 4
Answer: Refer Q3 b of Winter 2022
Q4 d Solve given problem bys using FCFS scheduling algorithm. Draw correct Gantt Chart and 4
calculate average waiting time and average turn around time
Process Arrival Time Burst Time (in ms)
P0 0 10
P1 1 29
P2 2 3
P3 3 7
P4 4 12
Answer:
Eliminate Hold and Wait: Allocate all required resources to the process before the start of its execution,
this way hold and wait condition is eliminated but it will lead to low device utilization. for example, if a
process requires printer at a later time and we have allocated printer before the start of its execution printer
will remain blocked till it has completed its execution. The process will make a new request for resources
after releasing the current set of resources. This solution may lead to starvation.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Eliminate No Preemption: One protocol is ‘If a process that is holding some resources requests another
resources and that resources cannot be allocated to it, then it must release all resources that are currently
allocated to it. Another protocol is "When a process requests some resources, if they are available, allocate
them. If a resource it requested is not available, then we check whether it is being used or it is allocated to
some other process waiting for other resources. If that resource is not being used, then the OS preempts it
from the waiting process and allocate it to the requesting process. If that resource is used, the requesting
process must wait." This protocol can be applied to resources whose states can easily be saved and
restored (registers, memory space). It cannot be applied to resources like printers.
Circular Wait: To avoid circular wait, resources may be ordered and we can ensure that each process can
request resources only in an increasing order of these numbers. The algorithm may itself increase
complexity and may also lead to poor resource utilization. For example, set priorities for rl = 1, r2 = 2, r3 =
3, and r4 = 4. With these priorities, if process P wants to use rl and r3, it should first request rl, then T3.
Another protocol is "Whenever a process requests a resource rj, it must have released all resources rk with
priority (rk) z priority (rj).
Q4 d: Solve given problem by using SJF and FCFS scheduling algorithm using Gantt chart. 4M
Calculate the average waiting time for each algorithm.
Process Burst time (in ms) For each
P1 9 scheduling
P2 7 Gantt chart
1M, Each
P3 3
average
P4 7
waiting time
Answer:
calculation
Gantt Chart SJF
1M
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Waiting Time= Turnaround time – Burst Time
P1==26-9= 17
P2=10-3= 3
P3=3-3= 0
P4=17-7 = 10
Average waiting time=Waiting time of all processes / Number of
processes
=(17+3+0+10) /4
=30/4
=7.5 milliseconds (ms)
P1=9-9=0
P2=16-7=9
P3=19-3=16
P4=26-7=19
Average waiting time=Waiting time of all processes / Number of processes
=(0+9+16+19) /4
=44/4
=11 milli seconds (ms)
Q6 a : Solve given problem by using (i) Pre-emptive SJF (ii) Round Robin (Time Slice = 3 ms) 6M
Calculate average waiting time using Gantt Chart.
Process A.T. B.T. (in ms)
P11 0 8
P12 1 4
P13 2 9
Each
P14 3 5
method 3M
- 1M for
Answer:
Gantt chart,
(i) Pre emptive SJF:
1M for
P11 P12 P12 P12 P14 P11 P13 Waiting
0 1 2 3 5 10 17 26 time
calculation,
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Waiting time = Turnaround time- burst time 1M for
P11= (17-0)-8=9 Average
P12= (5-1)-4=0 waiting
P13=(26-2)-9=15 time
P14=(10-3)-5=2
Average waiting time :- (9+0+15+2)/4= 26/4=6.5 ms
Waiting time and Response time is less. Waiting time and Response time is more.
The preemptive scheduling is prioritized. The highest When a process enters the state of running, the
priority process should always be the process that is state of that process is not deleted from the
currently utilized. scheduler until it finishes its service time.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
If a process with long burst time is running CPU,
If a high priority process frequently arrives in the
then another process with less CPU burst time may
ready queue, low priority process may starve.
starve.
Ex:- SRTF, Priority, Round Robin, etc. Ex:- FCFS, SJF, Priority, etc.
Q5 a Calculate average waiting time for following data using First Come First Served (FCFS) and 6M
Shortest Job First (SJF) algorithms.
Process Burst time Arrival time
P0 08 0
P1 04 1
P2 05 2
P3 03 3
P0 P1 P2 P3
Each
0 8 12 17 20 method 3M -
1M for Gantt
Waiting time= Turnaround time (Completion time- Arrival time)- Burst time chart, 1M for
P0=(8-0)-8=0 Waiting time
P1=(12-1)-4=7 calculation,
P2= (17-2)-5=10 1M for
P3=(20-3)-3= 14 Average
Avg WT=(0+7+10+14)/4=7.75 ms waiting time
Gantt Chart for SJF
P0 P1 P1 P3 P1 P2 P0
0 1 2 3 6 8 13 20
Waiting time= Turnaround time (Completion time- Arrival time)- Burst time
P0=(20-0)-8=12
P1=(8-1)-4=3
P2= (13-2)-5=6
P3=(6-3)-3= 0
Avg WT= (12+3+6+0)/4=5.25 ms
Winter- Unit 4 Q1 d Explain any four scheduling criteria. 4M
2019 Answer: Refer Q2d of Winter 2022 Any four
CPU scheduling
Scheduling criteria -1M
and each
Algorithms
Q2 d Describe I/o burst and CPU burst cycle with neat diagram. 4M
Answer: Explanation:
2 marks,
CPU-I/O Burst Cycle: The success of CPU scheduling depends on an observed property of processes:
Diagram:2
process execution consists of a cycle of CPU execution and I/0 wait.
marks
CPU Burst : It is the amount of time required by a process or can be said the amount of time required by
the process to finish. We cannot estimate the time taken by the process before running it. So most of the
problem is related to the burst time.
I/O burst cycle: It is a time when process is busy in working with I/O resources.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
T
Turnaround time=Completion time –Arrival time
P1=44-0=44
P2=21-0=21
P3=24-0=24
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Waiting time = TAT-Burst time
P1=44-30=14
P2=21-6=15
P3=24-8=16
Q5 b Explain bit map vector and linked list free space management techniques with its advantages 6
and disadvantages
1)Bitmap 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
2) Linked List: In this approach, the free disk blocks are linked together i.e. a free block contains a pointer
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
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 cache 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.
Advantages of linked list:
1. Files can be extended, no fragmentation problems.
2. Sequential Access is easy: just chase links.
3. No extra space for the free list.
4. Starting and ending of the file can be easily found
out by the linked list.
Disadvantages of linked list:
1. Cannot be effectively used for direct access
method.
2. Random access is virtually impossible. Lots of
seeking, even in sequential access.
3. Pointers which are required need additional memory
space.
4. It is not reliable as the blocks are scattered on the
disk anywhere.
Paging: Paging is a memory management scheme that eliminates the need for a contiguous allocation of
physical memory. The process of retrieving processes in the form of pages from the secondary storage into
the main memory is known as paging.
Q2 d Define Fragmentation? Explain internal and external fragmentation 4
Fragmentation: Fragmentation is an unwanted
problem in the operating system in which the
processes are loaded and unloaded from
memory, and free memory space is fragmented.
Processes can't be assigned to memory blocks
due to their small size, and the memory blocks
stay unused.
Internal Fragmentation: Whenever a memory
block gets allocated with a process, and in case
the process happens to be smaller than the
total amount of requested memory, a free space
is ultimately created in this memory block. And
due to this, the memory block’s free space is unused. This is what causes internal fragmentation.
Page Fault=15
Using LRU Page Replacement Algorithm
Page Faults= 12
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Winter- Unit 5 Q1 e Differentiate between paging and segmentation. 2M
2022 Answer:
Memory Parameters Paging Segmentation
Management
Individual In Paging, we break a process In the case of Segmentation, we break a
Memory address space into blocks known as process address space into blocks known
pages. as sections.
Memory Size The pages are blocks of fixed size. The sections are blocks of varying sizes.
Accountability The OS divides the available memory The compiler mainly calculates the size of Any two
into individual pages. individual segments, their actual address as relevant
well as virtual address. differences
– 1M each
Speed This technique is comparatively much This technique is comparatively much
faster in accessing memory. slower in accessing memory than Paging.
Size The available memory determines the The user determines the individual segment
individual page sizes. sizes.
Fragmentation The Paging technique may The Segmentation technique may not use
underutilize some of the pages- thus some of the memory blocks at all. Thus, it
leading to internal fragmentation. may lead to external fragmentation.
Logical A logical address divides into page A logical address divides into section offset
Address offset and page number in the case of and section number in the case of
Paging. Segmentation.
Data Storage In the case of Paging, the page table In the case of Segmentation, the
leads to the storage of the page data. segmentation table leads to the storage of
the segmentation data.
Q3 c Explain fixed size memory partitioning.
Answer:
• Fixed Size Memory Partitioning (Static)
• Memory is divided into number of fixed size partitions, which is called as fixed or static memory
partitioning.
• 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.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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.
Q4 e Describe free space management technique. (Any two). 4M
Answer:
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 disk. There are mainly four approaches by using which, the free blocks in the disk are Any 2
managed. techniques
1. Bit Vector Correct
2. Linked List Explanation
2M each
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
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
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q5 c Given a page reference string with three (03) page frames. Calculate the page faults with 6M
‘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
Answer: Calculation
of page fault
with relevant
diagram- 3M
each
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q6 b Consider the following memory map and assume a new process P4 comes with memory 6M
requirements of 6 KB. Locate (Draw) this process in memory using. (i) First fit (ii) Best Fit (iii)
Worst fit.
Answer:
Each fit
O.S. diagram 2M
P1
<FREE> 12 KB
P2
<FREE> 19 KB
P3
<FREE> 7KB
Memory
1M for
diagram and
Explanation
of Variable
partitioning
-3M
Advantages:
• This technique is relatively simple.
• This technique is very efficient to find the free space on the disk.
Disadvantages:
• This technique requires a special hardware support to find the first 1 in a word it is not 0.
• This technique is not useful for the larger disks.
For example: Consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 17, 18, 25,26, and 27 are free
and the rest of the blocks are allocated. The free-space bitmap would be:
001111001111110001100000011100000
Linked list: This is another technique for free space management. In this linked list of all the free block is
maintained. In this, there is a head pointer which points the first free block of the list which is kept in a
special location on the disk. This block contains the pointer to the next block and the next block contain the
pointer of another next and this process is repeated. By using this disk it is not easy to search the free list.
This technique is not sufficient to traverse the list because we have to read each disk block that requires
I/O time. So traversing in the free list is not a frequent action.
Advantages:
• Whenever a file is to be allocated a free block, the operating system can simply allocate the first
block in free space list and move the head pointer to the next free block in the list.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Disadvantages:
• Searching the free space list will be very time consuming; each block will have to be read from the
disk, which is read very slowly as compared to the main memory.
• Not Efficient for faster access.
In our earlier example, we see that keep block 2 is the first free block which points to another block which
contains the pointer of the 3 blocks and 3 blocks contain the pointer to the 4 blocks and this contains the
pointer to the 5 block then 5 block contains the pointer to the next block and this process is repeated at the
last .
Grouping: This is also the technique of free space management. In this, there is a modification of the free-
list approach which stores the address of the n free blocks. In this the first n-1 blocks are free but the last
block contains the address of the n blocks. When we use the standard linked list approach the addresses
of a large number of blocks can be found very quickly. In this approach, we cannot keep a list of n free disk
addresses but we keep the address of the first free block.
Q5 c Describe the concept of virtual memory with respect to paging. Also draw paging hardware 6M
diagram and describe its working with example.
Answer:
Virtual Memory:
• Virtual memory is a technique that allows the execution of process that are not completely present 2M for
in main memory. Virtual
• Virtual memory makes the users view of memory which is larger than actual size of main memory. Memory
• Virtual memory makes the task of programming much easier because the programmer no longer concept
2M for
needs to worry about the amount of physical memory available.
diagram and
• Virtual memory is commonly implemented by Demand Paging. 2M for
• Rather than bringing the entire process in the memory we use a lazy swapper. description
• A lazy swapper swaps in a page into main memory only when it is needed this is known as of paging
Demand Paging.
Paging:
• Paging is memory management technique
• It allows the allocation of a process to be non-contiguous.
• Physical memory is divided into fixed size blocks called as a frame.
• Logical memory is divided into fixed size block called pages
• Size of page is same as size of frame
• Each process is needs to maintain a page table
• The page table is used for mapping purpose
• When the execution of process begins its pages are loaded into memory frames
• The translation of logical address to physical address is done in paging.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
i)Page Number
ii)Offset
• The Page number id used to make an entry into the page table
• Page table contains the frame number in which the page is loaded.
• Page offset is added with the base address of the frame number to get the physical address.
Advantages:
• On the programmer level, paging is a transparent function and does not require intervention.
• Frames do not have to be contiguous.
• Easy to use memory management algorithm
• Swapping is easy between equal-sized pages and page frames.
Disadvantages:
• Paging causes internal fragmentation on older systems.
• Longer memory lookup times compared to segmentation
• It may cause internal fragmentation
• Complex memory management algorithm
• Page tables consume additional memory.
• Multi-level paging may lead to memory reference overhead.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q6 b Q6 b Consider the following page reference string arrival with three page frames:-5, 6, 7, 8, 9, 6M
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.
Answer:
Optimal-
5 6 7 8 9 7 8 5 9 7 8 7 9 6 5 6
5 5 5 5 9 9 9 6 6 Calculation
6 6 8 8 5 8 8 5 of page fault
7 7 7 7 7 7 7 with relevant
H H H H H H H diagram- 3M
Total Page fault=9 each
FIFO -
5 6 7 8 9 7 8 5 9 7 8 7 9 6 5 6
5 5 5 8 8 8 7 7 7 6 6
6 6 6 9 9 9 8 8 8 5
7 7 7 5 5 5 9 9 9
H H H H H
Total Page fault=11
Winter- Unit 5 Q1 e Define virtual memory. 2M
2019 Answer:
Memory Virtual memory is a memory management capability of an operating system (OS) that uses hardware and
Management software to allow a computer to compensate for physical memory shortages by temporarily transferring 2M for
data from random access memory (RAM) to disk storage. Correct
OR Definition
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.
Q3 c Explain partitioning and its types. 4M
Answer:
An important operation of memory management is to bring programs into main memory for execution by Explanation
the processor. Partitioning is a technique that divides a memory into multiple partitions. These partitions of fixed
can be of different size or same size. partitioning
Types of partitioning -2M,
• Fixed partitioning i.e. static partitioning Variable
• Variable partitioning i.e. dynamic partitioning partitioning-
2M
Fixed Partitioning: Main memory is divided into multiple partitions of fixed size at the time of system
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
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.
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.
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
Summer- Unit 6- Q1 f Write syntax of PWD command and explain its use with the help of suitable example. 2
2024 File Syntax: $ pwd PWD command is used to print (display) current working directory.
Management Example: $ pwd Above example displays absolute pathname. Output: /home/poly
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Q1 g List any four file operations. 2
• Creating a file
• Writing a file
• Reading a file
• 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 asprinter or display
Disadvantages
• Not suitable for a large number of files and more than one user.
• Because of single directory files, files require unique file names.
• Difficult to remember names of all the files as the number of files increases. MS-DOS OS allows
only 11 character file name where as UNIX allows 255 character
Two-level directory structure: -In the two-level structures, each user has its own user file directory (UFD).
The UFD lists only files of a single user. System contains a master file directory (MFD) which is indexed by
user name or account number. Each entry in MFD points to the UFD for that user. When a user refers to a
particular file, only his own UFD is searched. Different users can have files with the same name, as long as
all the file names within each UFD are unique. 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.
Advantages:
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• It solves isolation. i.e. data of one user is separated from other user.
• Searching is also efficient in this type of structure.
• Every user accesses his own directory and files.
• There is no problem of files with same names in different directories.
Disadvantages:
• Two users can not share data or communicate with each other.
• It is difficult to search the files with same names in different directories.
Correct
explanation
3M, 1M for
Diagram
Explanation
of structure
2M each,
• In the two-level structures, each user has its own user file directory (UFD). The UFD lists only files of Construction
a single user. of structure
• System contains a master file directory (MFD) which is indexed by user name or account number. 1M each
Each entry in MFD points to the UFD for that user.
• When a user refers to a particular file, only his own UFD is searched. Different users can have files
with the same name, as long as all the file names within each UFD are unique.
• 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.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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.
Summer- Unit 6 Q1 g :List any four operations performed on a file. 2M
2022 File Answer:
Management List any four file operations.
• Creating a file Any four
• Writing a file: 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
Q3 d : Explain linked file allocation method. 4M
Answer:
Linked Allocation:
Correct
explanation
2M, 1M for
Diagram
and 1M for
Advantages
Q5 a : Describe following directory structures in short with neat sketches: i) Single level ii) Two 4M
level iii) Tree structured
Answer:
1) Single level directory structure: For each
Correct
explanation
1M and1M
for Diagram
• It is the simplest form of directory structure, having one directory containing all the files, and
each file must have a unique name.
• Software design is simple. The advantages of this scheme are its simplicity and the ability to
locate files quickly.
• Since all files are in the same directory, they must have unique names. If there are two users
who call their data file "test", then the unique-name rule is violated.
• Even with a single-user, as the number of files increases, it becomes difficult to remember the
names of all the files in order to create files with unique name.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
2) Two-level directory: -
• In the two-level structures, each user has its own user file directory (UFD). The UFD lists
only files of a single user.
• System contains a master file directory (MFD) which is indexed by user name or account
number. Each entry in MFD points to the UFD for that user.
• When a user refers to a particular file, only his own UFD is searched. Different users can
have files with the same name, as long as all the file names within each UFD are unique.
• 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.
3) 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).
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
• 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.
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 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.
Q6 c : Enlist different file allocation methods? Explain contiguous allocation method in detail. 6M
Answer:
• From the user’s point of view, a file is an abstract data type. It can be created, opened, written, read, 1m- listing,
closed and deleted without any real concern for its implementation. The implementation of a file is a 2m for
problem for the operating system. diagram, 3m
• The main problem is how to allocate space to these files so that disk space is effectively utilized and for
explanation
files can be quickly accessed.
Examination Paper Analysis (Operating System-22516)
Exam Unit No and Question no as per MSBTE paper Marking
Year Name Scheme
Three major methods of allocating disk space are in wide use:
• Contiguous
• Linked
• Indexed
Contiguous Allocation