Summer-24
Summer-24
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 1 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
ii. Fragmentation:
When processes are loaded and removed from memory, the free
memory space is broken into little pieces which is known as
fragmentation.
Page 2 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
f) Write syntax of PWD command and explain its use with the help 2M
of suitable example.
Ans. Syntax: $ pwd
PWD command is used to print (display) current working directory. Syntax 1M
Use &
Example: $ pwd example 1M
Above example displays absolute pathname.
Output: /home/poly
g) List any four file operations. 2M
Ans. Creating a file
Writing a file Any four
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) Explain Resource management of an operating system. 4M
Ans. Resource Management in Operating System is the process to
manage all the resources efficiently like CPU, memory, Any
relevant
input/output devices, and other hardware resources among the explanation
various programs and processes running in the computer. 4M
Computer's resources are limited and several users or programs
may need to utilize the same resources—such as memory and
CPU—at the same time.
Operating system has to manage and ensure that all processes get
the resources they need to execute, without any problems like
deadlocks.
Operating systems use various scheduling algorithms to ensure
that each process gets its fair share of CPU time.
Operating systems use virtual memory techniques to manage
memory efficiently.
Operating systems use file system management techniques to
manage disk space efficiently.
File system management allows the operating system to create,
Page 3 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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.
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:
Page 4 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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 5 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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) Describe message passing system of interprocess communication 4M
(IPC)
Ans. Message Passing: In this model, communication takes place by Relevant
explanation
exchanging messages between cooperating processes. It allows
3M
processes to communicate and synchronize their action without
sharing the same address space. It is particularly useful in a Correct
distributed environment when communication process may reside on diagram 1M
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 exists.
Page 6 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Any 4
blocks of
information
in PCB
2M
Page 7 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 8 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Hold and Wait: There must exist a process that is holding at least
one resource and is waiting to acquire additional resources that are
currently being held by another process. Process currently holding
resources granted earlier can request new resources.
Page 9 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Circular Wait: There exist a set (P0, P1, ----- Pn) of waiting
processes such that P0 is waiting for a resource which is held by P1,
P1 is waiting for a resource which is held by P2. Pn-1 is waiting for
resources which are held by Pn and Pn is waiting for a resource which
is held by P0. Thus there must be a circular chain of two or more
processes, each of which is waiting for a resource held by the next
member of the chain.
ii) Swapping
Swapping is mechanism in which a process can be swapped
temporarily out of main memory (or move) to secondary storage
(disk) and make that memory available to other processes. At some
later time, the system swaps back the process from the secondary
storage to main memory.
Page 10 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 11 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 12 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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.
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 many
of 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.
Page 13 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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
Communication related system calls:
a. Establish a connection.
b. Send, receive messages.
c. Terminate a connection
Page 14 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 15 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 16 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 17 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 18 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Disadvantages:
1. Kernel threads are generally slower to create and manage than the
user threads.
2. Transfer of control from one thread to another within same process
requires a mode switch to the Kernel.
Page 19 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
OR
Page 20 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
P1 P3 P2
0 8 9 13
Page 21 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
P1 P2 P3 P1 P2 P1 P1
0 2 4 5 7 9 11 13
P1 P2 P3 P1 P2 P1
0 3 6 7 10 11 13
Page 22 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Any 1
Disadvantag
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 e 1M
0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0
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 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.
Page 23 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 24 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Disadvantages
Not suitable for a large number of files and more than one
Any 1
user. disadvantag
Because of single directory files, files require unique file e 1M
names.
Difficult to remember names of all the files as the number of Two level
files increases. MS-DOS OS allows only 11 character file directory
structure
name where as UNIX allows 255 character. explanation
1M
Any 1
Advantage
1M
Any 1
disadvantag
e 1M
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.
Page 25 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Advantages:
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.
Page 26 / 26