Ilovepdf Merged
Ilovepdf Merged
(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
lOMoARcPSD|38558715
Page 1 / 27
Page 2 / 27
Ans.
Correct
diagram
2M
Page 3 / 27
Page 4 / 27
MEMORY PERIPHERALS
OR
Page 5 / 27
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
Page 6 / 27
Page 7 / 27
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
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.
Page 9 / 27
0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0
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.
Page 10 / 27
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.
Page 11 / 27
Ans. Any 4
COMMAND LINE GRAPHIC USER points 1M
INTERFACE (CLI) INTERFACE (GUI) each
Page 12 / 27
Page 13 / 27
Page 14 / 27
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
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
- 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
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
Page 18 / 27
Page 19 / 27
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.
Page 20 / 27
Ans. i) LRU:
Considering frame size is 3: LRU
3M
ii) Optimal:
Considering Frame size is 3:
Optimal
3M
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
Page 22 / 27
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
Page 24 / 27
Page 25 / 27
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.
Page 26 / 27
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.
Page 27 / 27