2022 Winter Model Answer Papermsbte Study Resources
2022 Winter Model Answer Papermsbte Study Resources
2022 Winter Model Answer Papermsbte Study Resources
22516-2022-Winter-model-answer-paper[Msbte study
resources]
bachelor's in dental surgeon (Pandit Bhagwat Dayal Sharma University of Health
Sciences)
Page 1 / 21
Page 2 / 21
Page 3 / 21
ii) sleep
Syntax: sleep NUMBER[SUFFIX]…
sleep OPTION
g) List any four file operations. 2M
Ans. Creating a file
Writing a file: Any four
operations
Reading a file: ½ M each
Repositioning within a file
Deleting a file
Appending new information to the end of the file
Renaming an existing file.
Creating copy of a file, copy file to another I/O device such as
printer or display
2. Attempt any THREE of the following: 12
a) Explain Time sharing O.S. 4M
Ans. In time sharing system, the CPU executes multiple jobs by switching
among them. The switches occur so frequently that the users can
interact with each program while it is running. It includes an
Page 4 / 21
In above figure, the user 5 is active but user 1, user 2, user 3, and user
4 are in waiting state whereas user 6 is in ready status.
b) Describe any two components of O.S. 4M
Ans. List of System Components:
1. Process management Description
2. Main memory management of any two
components
3. File management of OS
4. I/O system management 2M each
5. Secondary storage management
1.Process Management:
A program is a set of instructions. When CPU is allocated to a
program, it can start its execution. A program in execution is a
process. A word processing program run by a user on a PC is a
process. A process needs various system resources including CPU
time, memory, files and I/O devices to complete the job execution.
These resources can be given to the process when it is created or
allocated to it while it is running.
Page 5 / 21
Page 6 / 21
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.
Page 7 / 21
Shared memory
Page 8 / 21
New: When a process enters into the system, it is in new state. In this
state a process is created. In new state the process is in job pool.
Ready: When the process is loaded into the main memory, it is ready
for execution. In this state the process is waiting for processor
allocation.
Page 9 / 21
Terminated State:
When the process completes its execution, it goes into the terminated
state. In this state the memory occupied by the process is released.
b) Describe conditions for deadlock prevention. 4M
Ans. By ensuring that at least one of below conditions cannot hold, we can
prevent the occurrence of a deadlock. Any four
conditions
1M each
1.Mutual Exclusion:
The mutual-exclusion condition must hold for non-sharable
resources. Sharable resources do not require mutually exclusive
access, thus cannot be involved in a deadlock.
3.No Preemption:
If a process that is holding some resources requests another resource
that cannot be immediately allocated to it, then all resources currently
being held are preempted. That is these resources are implicitly
Page 10 / 21
4.Circular Wait
Circular-wait condition never holds is to impose a total ordering of all
resource types, and to require that each process requests resources in
an increasing order of enumeration.
Let R = {R1, R2, ..., Rn} be the set of resource types. We assign to
each resource type a unique integer number, which allows us to
compare two resources and to determine whether one precedes
another in our ordering. Formally, define a one-to-one function F: R
_ N, where N is the set of natural numbers.
Page 11 / 21
The directory contains a pointer to the first and the last blocks of
Diagram
the file. Optional
To create a new file, simply create a new entry in the directory.
The following figure shows the linked allocation.
Page 12 / 21
Page 13 / 21
Page 14 / 21
Waiting Time
P1=0
P2=9
P3=16
P4=19
Average waiting time=Waiting time of all processes / Number of
processes
=(0+9+16+19) /4
=44/4
=11 milli seconds (ms)
Page 15 / 21
1 )Bit Vector:
The free-space list is implemented as a bit map or bit vector.
Each block is represented by 1 bit. If the block is free, the bit is 1; if
the block is allocated, the bit is 0.
For example, consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12,
13 are free and the rest of the blocks are allocated.
The free-space bit map would be : 0011110011111100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0
1=Free block
0= Allocated block
The main advantage of this approach is its relative simplicity and its
efficiency in finding the first free block or n consecutive free blocks
on the disk.
2) Linked List
In this approach, the free disk blocks are linked together i.e. a free
block contains a pointer to the next free block. The block number of
the very first disk block is stored at a separate location on disk and is
also cached in memory. In this approach, link all the disk blocks
together, keeping a pointer to the first free block. This block contains
a pointer to the next free disk block, and so on.
Page 16 / 21
Page 17 / 21
ii) LRU
Ref 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
F1 7 7 7 2 2 2 2 4 4 4 0 0 0 1 1 1 1 1 1 1
F2 0
0 0 0 0 0 0 0 3 3 3 3 3 3 0 0 0 0 0
F3 1 1 1 3 3 3 2 2 2 2 2 2 2 2 2 7 7 7
Fault F F F F F F F F F F F F
Total page faults-12
Page 18 / 21
Page 19 / 21
Ans. First Fit: Allocate Best Fit: Allocate Worst fit: Allocate
the first free block the smallest free the largest free
to the new process block that is big block to the new
P4. enough to process P4.
accommodate new
process P4.
O. S. O. S. O. S.
P1 P1 P1
P4 6KB <FREE> 12 KB <FREE> 12 KB
<FREE> 6KB P2 P2
P2 <FREE> 19 KB P4 6 KB
<FREE> 19 KB P3 <FREE> 13 KB
P3 P4 6 KB P3
<FREE> 7 KB <FREE> 1 KB <FREE> 7 KB
Page 20 / 21
When we create a file for a user, operating system searches only that
user’s UFD to find whether same name file already present in the
directory. For deleting a file again operating system checks the file
name in the user’ UFD only.
2. Tree structure:-
In this directory structure user can create their own sub-directories
and organize their files. The tree has a root directory and every file
has a unique path name. A directory contains a set of files or
subdirectories. All directories have the same internal format. One bit
in each directory entry defines the entry as a file (0) or as a
subdirectory (1). Each process has a current directory. Current
directory contains files that are currently required by the process.
When reference is made to a file, the current directory is searched. If
a file needed that is not in the current directory, then the user usually
must either specify a path name or change the current directory.
Page 21 / 21