Вы находитесь на странице: 1из 5

Homework 3

Annexure

Homework type/no: Online/Third Course code: CSE-316


Course instructor: Kavita Mam Course tutor:
Date of allotment: Date of submission: 28-10-2010
Student roll no: RC2801b48 Section no: C2801

Declaration:
I declare that this assignment is my individual work. I have not copied from any other student’s
work or from any other source except where due acknowledgment is made explicitly in the text,
nor has been written for me another person.
Student’s signature: Yogesh Gandhi
Evaluator’s comments:
Marks obtained _____________________ out of ______________________________
Content of home work should start from this page only:
Part A

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

Answer: -
Thrashing is caused by under allocation of the minimum number of pages required by a
process, forcing it to continuously page fault. The system can detect thrashing by evaluating
the level of CPU utilization as compared to the level of multiprogramming. It can be
eliminated by reducing the level of multiprogramming.
System does following things to eliminate this problem:-
1.) It can be eliminated by reducing the level of multiprogramming.
2.) Thrashing can also be removed by using local replacement algorithm.

Question2:- 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.

Answer:-
Page faults for LRU when:-

Frame size Page fault


One 20
Two 18
Three 15
Four 10
Five 8

Page faults for FIFO when:-

Frame size Page fault


One 20
Two 18
Three 16
Four 14
Five 10

Page faults for Optimal when:-

Frame size Page fault


One 20
Two 15
Three 11
Four 8
Five 7

Question3:- Some system provides file sharing by maintaining a single copy of a file; other
system maintains several copies one for each of the users sharing the file. Discuss relative’s
merits of each approach?

Answer:- With a single copy, several concurrent updates to a file may result in user
obtaining incorrect information,and the file being left in an incorrect state. With
multiple copies, there is storage waste and the various copies may not be
consistent with respect to each other.
File sharing is the practice of distributing or providing access to digitally stored information,
such as computer programs, multi-media (audio, video), documents, or electronic books. File
sharing is the practice of taking one copy of a file and making it available in multiple repository
locations. There is only one single database object reflecting the changes made to the shared file.
The system which provides file sharing between different users creating unique copies of the file
and synchronizing changes when they are made. These days all the systems use the concept of
sharing a single file with multiple users.

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?

Answer: -

To determine best strategy for a particular file, the two criteria’s are:-
1.) Storage efficiency :
Storage efficiency is the ability to store and manage data that consumes the least amount of space with little to
no impact on performance; resulting in a lower total operational cost. Efficiency addresses the real-world
demands of managing costs, reducing complexity and limiting risk.
2.) Data block access times:
This is the time needed to access the data block from database where it is stored. And this time
should be as less as possible.
So,
Storage efficiency should be more and access time should be less.

Different Access method can be:-


1) Random:- Indexed allocation method is example of this.
2) Sequential:- Linked allocation method is example of this.

In Contiguous allocation, the access method can be any.

Question5:- Segmentation and paging can be combined together into one scheme. What is
the reason for this combination?

Answer: - Segmentation and paging are often combined in order to improve upon each other.
Segmented paging is helpful when the page table becomes very large. A large contiguous section
of the page table that is unused can be collapsed into a single segment table entry with a page
table address of zero. Paged segmentation handles the case of having very long segments that
require a lot of time for allocation. By paging the segments, we reduce wasted memory due to
external fragmentation as well as simplify the allocation.Segmentation and paging are often
combined to reduce wasted memory due to external fragmentation as well as simplify the
allocation. Segments can be of different lengths, so it is harder to find a place for a segment
in memory than a page. With segmented virtual memory, we get the benefits
of virtual memory but we still have to do dynamic storage allocation of physical memory. In
order to avoid this, it is possible to combine segmentation and paging into a two-
level virtual memory system. Each segment descriptor points to page table for that segment. This
gives some of the advantages of paging (easy placement) with some of the advantages of
segments (logical division of the program).

Queation6:- Give an example of an application in which data in a file should be accessed in


the following order.

1. Sequentially
2. Randomly

Answer:-
Sequential access: Sequential access is a system by which stored data is accessed in a fixed order. One example
of this is an audio or video cassette. The most common use of the phrase sequential access is
if we want to
in computer memory, where it contrasts with the more widely used random access memory.
access the data which is present in the mid of back up device then to access the data memory has
to start from the first position.
Example of sequential access:
1.) Data stored in a tape is accessed using this concept.
2.) In data structure, this concept is used to access data in linked list.
.

Random access: In random access data is randomly accessed by the main memory means
if we want to access the data which is present in the mid of back up device then to access that
data main memory don’t have to start from the first position. It can directly access data from that
position.
Example of sequential access:
1.) Data stored in a compact disc is accessed using this concept.
2.) In data structure, this concept is used in arrays.