Sie sind auf Seite 1von 5

ASSIGNMENT

OF

OPERATING SYSTEM
(CSE316)

SUBMITTED TO:- SUBMITTED BY:-


MISS SHIVANI GUPTA PRINCE JINDAL
LECT. IN CSE/IT DEPPT. B.TECH(IT)
ROLL NO. 50
REGD.NO.-1070070044
SEC. C2701
Part A

Q1 How does a system detect thrashing? Once it detect thrashing, what can the
system do to eliminate this problem?

Ans: if the number of frames allocated to a low priority process is lower than the
minimum number required by the computer architecture then in this case we must
suspend the execution of this low priority process. After this we should page out all of its
remaining pages and freeing all of its allocated frames. This provision introduces a swap
in, swap-out level of intermediate CPU scheduling. Let take an example of a process that
does not have enough number of frames. If the process does not have the number of
frames it needs to support pages in active use, it will quickly page fault. The only option
remains here for process is to replace some active pages with the page that requires a
frame. However, since all of its pages are in active use, it must replace a page that will be
needed again right away. Consequently, it quickly faults again and again that mean
replacing pages that it must bring back in immediately. This high paging activity is called
Thrashing. Or we can say that a process is thrashing if it is spending more time in paging
then executing.

Q2 consider the following page reference string:


1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6
How many page fault would occur for the following replacements algorithms,
assuming one ,two ,three, four, five frames .remember all frames are initially empty,
so your first unique pages will all cost one page fault each.

1 LRU Replacement
2. FIFO Replacements.
3.Optimal algorithm.

Ans: LRU replacement:

3 frame
1 4 , 5 , 1 , 7

3 1, 6, 3
Total page fault=10

4 frame
1 6

2
3 5 , 3

4 6 , 7 , 1
Total page fault=10

5 frame

3 6

4 3

5 7
Total page fault=8

Q3 Some system provide file sharing by maintaining a single copy of a file; other
system maintain several copies one for each of the users sharing the file. discuss
relatives merits of each approach?

Ans: MERITS OF FILE SHARING BY MAINTAING SEVERAL COPIES OF A FILE:

File sharing in Surround SCM allows a single copy of a file to exist in multiple repository
locations. Since the file is shared, if it is ever updated all locations will reflect those
updates simultaneously. There are several best practice suggestions and caveats
associated with file sharing. It is important to understand how the Surround SCM
architecture facilitates file sharing so that best practice strategies can be devised early on
to help you get the most out of file sharing with the least amount of effort.
when a user performs a Get to their local file system a file shared to multiple repositories
with multiple working directories will exist as separate copies. This means that while a
file shared in Surround will always be identical across all the repositories it is shared to,
that same file might exist as different copies in your local working directory.

Part B

Q4 Consider the system that supports the strategies of contiguous ,linked and
indexed allocation. What criteria should be used in deciding which strategy is best
utilized for a particular file?

Ans: starting with lets discuss about each strategy and the criteria for their appropriate
use:

Contiguous File Allocation

Each file occupies a set of contiguous blocks on the disk.


Allocation using first fit / best fit.
A Need for compaction
Only starting block and length of file in blocks are needed to work with the file.
Allow random access.
Problems with files that grow

Indexed file Allocation

Indexed allocation is bringing all the pointers together.

Much more effective for direct access.

Inefficient for small files .

Linked File Allocation

Each file is a linked list of blocks.

No external fragmentation.

Effective for sequential access.

Problematic for direct access.

Q5. Segmentation and paging can be combined together into one scheme. What is
the reason for this combination?
Ans: lets discuss about segmentation and paging :

Paging – Computer memory is divided into small partitions that are all the same size and
referred to as, page frames. Then when a process is loaded it gets divided into pages
which are the same size as those previous frames. The process pages are then loaded into
the frames.

Segmentation – Computer memory is allocated in various sizes (segments) depending on


the need for address space by the process. These segments may be individually protected
or shared between processes. Commonly you will see what are called “Segmentation
Faults” in programs, this is because the data that’s is about to be read or written is outside
the permitted address space of that process.

Reason for the combination of both schemes:

1.for Increasing the flexibility of sharing.


2. Share at two levels: Page or segment (entire page table).

3. it Supports sparse address spaces. If segment is not used, no need for page table.
Decreases memory required for page tables.

4. for Eliminating external fragmentation.

.
Q6 Give an example of an application in witch data in a file shouldbe accessed in the
following order.

1. Sequentially
2. Randomaly

Ans: Example of Sequentially accessing a file:

When we are retrieving data from a magnetic tape we are accesing it in sequential mode.
As for a more perfect example take that of listening songs in a tape recorder or the audio
cassette player.in that we can’t go to to the desired song directly we will have to pass
through every single coming before it.so when we are unable to access the desired file
directly than by such a process of going through different files is called as sequential
access of file.

Example of random accesing of a file:


now the best example we can consider is that of optical disk .in this we can access the
desired file directly .we don’t need to go through the files. Best example is listening
songs in cd player.in this we can move to the desired track directly without having the
tension of going through other tracks.so its outcome is easy and fast accessibility.

Das könnte Ihnen auch gefallen