Professional Documents
Culture Documents
17512-2019-Winter-Model-Answer-Paper (Msbte Study Resources)
17512-2019-Winter-Model-Answer-Paper (Msbte Study Resources)
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 1 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
(iii) Enlist the different states of process and draw diagram of process 4M
state transitions.
Ans. 1 New: The process is being created.
2 Ready: The process is waiting to be assigned to a processor. Ready
processes are waiting to have the processor allocated to them by the
Page 2 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
2M
Diagram
2M
Page 3 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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
Page 4 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
queue.
Device queue: The list of processes waiting for a particular I/O
device is called a device queue.
Diagram
2M
0 2 3 5 7 8 10 12 13
Page 5 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
A B A D C
0 1 2 4 8 13
SJF=3m
Waiting Time
A=2-1=1
B=0
C=8-2=6
D=4-3=1
AWT=1+0+6+1=8/4=2 ms
OR
Non-Preemptive SJF
A B D C
0 3 4 8 13
Waiting Time
A=0
B=3-1=2
C=8-2=6
D=4-3=1
AWT=0+2+6+1=9/4=2.25 ms
Page 6 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 7 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
directives to control those commands are entered into files, and those
files are executed . Most commonly, a graphical user interface (GUI)
is used.
2. Program execution: The operating system loads the contents (or
sections) of a file into memory and begins its execution. A user-level
program could not be trusted to properly allocate CPU time.
3. I/O operations: Disks, tapes, serial lines, and other devices must
be communicated with at a very low level. The user need to only
specify the device and the operation to perform on it, while the
system converts that request into device- or controller-specific
commands.
4. File-system manipulation: There are many details in file creation,
deletion, allocation, and naming that users should not have to per-
form. Blocks of disk space are used by files and must be tracked.
Deleting a file requires removing the name file information and
freeing the allocated blocks. Protections must also be checked to
assure proper file access.
5. Communications: Message passing between systems requires
messages to be turned into packets of information, sent to the net-
work controller, transmitted across a communications medium, and
reassembled by the destination system. Packet ordering and data
correction must take place.
6. Error detection: Error detection occurs at both the hardware and
software levels. At the hardware level, all data transfers must be
inspected to ensure that data have not been corrupted in transit. All
data on media must be checked to be sure they have not changed
since they were written to the media. At the software level, media
must be checked for data consistency; for instance, whether the
number of allocated and unallocated blocks of storage matches the
total number on the device.
7. Accounting: We may want to keep track at which users use how
much and what kind of computer resources. What was the login time
for a particular user; is he working on the system right now, what is
the process -1 D for the user, all such in formations we can manage
using accounting service provided by many multiuser systems.
8. Resource allocation: When there are multiple users or multiple
jobs running at the same time. Resources must be allocated to each of
them. Many different types of resources are managed by the
operating system. Some (Such as CPU cycles, main memory, and file
storage) may have special allocation code, whereas others (such as
Page 8 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
I/O devices) may have much more general request and release code.
9. Protection and security: The owners of information stored in
multiuser or networked computer system may want to control use of
the information .When several separate processes execute
concurrently, it should not be possible for one process to interfere
with the others or with the operating system itself, and Protection
involves ensuring that all access to system resources is controlled.
Security of the system from outsiders is also important. Such security
starts with requiring each user to authenticate himself or herself to the
system, usually by means of a password, to gain access to system
resources.
Page 9 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Example
2M
Two processes cannot execute their critical sections at the same time.
The critical section problem is to design a protocol that the processes
can use to cooperate i.e. allowing entry to only one process at a time
inside the critical section. Before entering into the critical section
each process must request for permission to entry inside critical
section.
d) Describe the algorithm for finding out whether or not a system is 4M
in a safe. State (Safety Algorithm)
Ans. 1) Let Work and Finish be vectors of length „m‟ and „n‟ respectively.
Initialize: Work = Available
Finish[i] = false; for i=1, 2, 3, 4….n
2) Find an i such that both Correct
a) Finish[i] = false algorith
b) Needi <= Work m 4M
if no such i exists goto step (4)
3) Work = Work + Allocation[i]
Finish[i] = true
goto step (2)
4) if Finish [i] = true for all i then the system is in a safe state
e) Give difference between contiguous file allocation and linked file 4M
Page 10 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 11 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
2M
The primary functions of the real time operating system are to:
1. Manage the processor and other system resources to meet the
requirements of an application.
2. Synchronize with and respond to the system events.
3. Move the data efficiently among processes and to perform
coordination among these processes.
Page 12 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Advantages:-
Page 13 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
Page 14 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
Page 15 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
Paging hardware:
Diagram
2M
Page 16 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 17 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
2M
Page 18 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
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.
create file, delete file
open close
read, write, reposition
get file attributes, set device attributes
logically attach or detach devices
Device Management:-
When a process is in running state, it requires several resources to
execute. These resources include main memory, disk drives, files and
Page 19 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Information Maintenance:-
Transferring information between the user program and the operating
system requires system call. System information includes displaying
current date and time, the number of current user, the version number
of the operating system, the amount of free memory or disk space and
so on. Operating system keeps information about all its processes that
can be accessed with system calls such as get process attributes and
set process attributes.
get time or date, set time or date
get system data, set system data
get process, file, or devices attributes
set process, file, or devices attributes
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.
create, delete communication connection
send, receive messages
transfer status information
attach or detach remote devices.
(iii) Give difference between short term scheduler and long term 4M
scheduler (four points)
Ans.
Page 20 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
1M
2
Page 21 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Advantages:- advanta
It solves the problem of name-collision. ges 1/2M
It provides security to each user's data. each`
Diagram
2M
The modules of the operating system are divided into several layers
stacked one above the other, thus forming a hierarchical structure.
The lowest layer (Layer 0) interacts with the underlying hardware and
the topmost layer (Layer N) provides an interface to the application
programs/ users. Only adjacent layers can communicate with each Descript
other. A layer N can request for services only from a layer ion 2M
immediately below it (layer N-1). A layer N can provide services
only to the layer immediately above it (layer N + 1). A Layer only
needs to know what services are offered by the layer below it. In this
structure any request that requires access to hardware has to go
through all layers. Bypassing of layers is not allowed.
Advantage: - Two
This approach makes it easy to build, maintain and enhance the advanta
operating system. ge 1/2M
Locating an error is easy as system can start debugging from 0th each
Page 22 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Disadvantage: - Two
Overall performance speed is slow as requests pass through disadvan
multiple layers of software before they reach the hardware. tages
1/2
It is difficult to exactly assign functionalities to the correct and M
appropriate layer. each
(ii) Write steps involved in Banker's algorithm. Also give one 6M
example for it.
Ans. Banker's algorithm calculates resources allocated, required and
available before allocating resources to any process to avoid
deadlock. It contains two matrices on a dynamic basis. Matrix A
contains resources allocated to different processes at a given time.
Matrix B maintains the resources which are still required by different
processes at the same time.
F: Free resources
Algorithm :
Step 1: When a process requests for a resource, the OS allocates it on
a trial basis.
Step 2: After trial allocation, the OS updates all the matrices and
vectors. This updating can be done by the OS in a separate work area
in the memory.
Step 3: It compares F vector with each row of matrix B on a vector to
vector basis. Steps of
Step 4: If F is smaller than each of the row in Matrix B i.e. even if all algorith
free resources are allocated to any process in Matrix B and not a m 3M
single process can completes its task then OS concludes that the
system is in unstable state.
Step 5: If F is greater than any row for a process in Matrix B the OS
allocates all required resources for that process on a trial basis. It
assumes that after completion of process, it will release all the
recourses allocated to it. These resources can be added to the free
vector.
Step 6: After execution of a process, it removes the row indicating
executed process from both matrices.
Step 7: This algorithm will repeat the procedure step 3 for each
process from the matrices and finds that all processes can complete
execution without entering unsafe state. For each request for any
Page 23 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Example:
3 processes P0 through P2;
3 resource types:
A (10 instances), B (5instances), and C (7 instances)
Snapshot at time T0:
A B Available Example
ABC ABC ABC 3M
P0 0 1 0 7 4 3 545
P1 200 122
P2 302 600
Page 24 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
1M
Diagram
1M
Page 26 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 28 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Variable Partitioning –
It is a part of Contiguous allocation technique. It is used to alleviate
the problem faced by Fixed Partitioning. In contrast with fixed
partitioning, partitions are not made before the execution or during Explanat
system configure. Various features associated with variable ion of
Partitioning- Variable
memory
1. Initially RAM is empty and partitions are made during the run- partition
time according to process‟s need instead of partitioning during with
system configure. example
2. The size of partition will be equal to incoming process. 4M
3. The partition size varies according to the need of the process so
that the internal fragmentation can be avoided to ensure efficient
utilisation of RAM.
4. Number of partitions in RAM is not fixed and depends on the
number of incoming process and Main Memory’s size.
Page 29 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 30 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page 31 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
2M
System call
System calls related to process control: End, Abort Load, Execute
Create process, Terminate process Ready process, Dispatch process
Suspend, Resume Get Process attribute, set attribute Wait for time
Wait event, signal event
System calls Related to File management: Create file, delete file
Open file , Close file Create directory Read, write, Reposition, Get
file attribute , set file attribute Create a link Change the working
directory
System calls Related to Device Management: Request a device,
Release a device Read, Write, Reposition Get device attribute, set
device attribute
System calls Related to Information Maintenance: Get Time or Date,
Set Time or Date Get System data, Set system data Get process, file
or device attributes Set process, file or Device attributes.
c) Describe context switch with suitable diagram. 4M
Ans. Context switch
Context Switching involves storing the context or state of a process
so that it can be reloaded when required and execution can be
resumed from the same point as earlier. This is a feature of a
multitasking operating system and allows a single CPU to be shared Explana
by multiple processes. tion 2M
Switch the CPU to another process requires saving the state of old
process and loading the saved state for new process. This task is
known as a context switch.
The context switch represented with PCB.
Page 32 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Saves context of old process in its PCB and loads context of new
process schedule to run.
Diagram
(exampl
e) 2M
Page 33 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
times, particularly if the first process to get there takes a long time.
For example, consider the following three processes:
P2 3
P3 3
Example
FCFS can also block the system in a busy dynamic system in another
2M
way, known as the convoy effect. When one CPU intensive process
blocks the CPU, a number of I/O intensive processes can get backed
up behind it, leaving the I/O devices idle. When the CPU hog finally
relinquishes the CPU, then the I/O processes pass through the CPU
quickly, leaving the CPU idle while everyone queues up for I/O, and
then the cycle repeats itself when the CPU intensive process gets
back to the ready queue.
Page 34 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
The shell:
The shell acts as an interface between the user and the kernel. When a
user logs in, the login program checks the username and password,
and then starts another program called the shell. The shell is a
command line interpreter (CLI). It interprets the commands the user
types in and arranges for them to be carried out.
The shell keeps a list of the commands you have typed in. If you need
to repeat a command, use the cursor keys to scroll up and down the
list or type history for a list of previous commands.
You can use any one of these shells if they are available on your
system. And you can switch between the different shells once you
have found out if they are available.
Bourne shell (sh)
C shell (csh)
Page 35 / 36
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Diagram
2M
Page 36 / 36