Anda di halaman 1dari 5

Homework 3

Annexure

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


Course instructor: Mr. Rajul Anand Course tutor: Mr. Rajul Anand
Date of allotment: 8-11-2009 Date of submission: 18-11-2009
Student roll no: RD1703A23 Section no: D1703

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: Akshima Pawra
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: The high paging activity is called thrashing. A process is thrashing if it is spending
more time on paging than in executing. 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.

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:-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. The Surround SCM database is acting as a true share with only one copy of
the file in existence. 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
2.) Data-block access times.

Storage efficiency should be more and access time should be less.

Access method can be:-


1) Random
2) Sequential

In Contiguous allocation, the access method can be any.


For linked allocation access method is sequential.
Indexed allocation is more complex as compared to the above two.

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 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 shouldbe accessed in
the following order.

1. Sequentially
2. Randomly

Answer:-

Sequential access: In sequential access data is sequentially 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 the
data memory has to start from the first position.
Example of sequential access:
1.) In data structure, this concept is used to access data in linked list.
2.) Data stored in a tape is accessed using this concept.
.

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.) In data structure, this concept is used in arrays.
2.) Data stored in a compact disc is accessed using this concept.