ASSIGNMENT OF OPERATING SYSTEM cse 316

SUBMITTED BY:SUBMITTED TO:Name:- ROHIT SINGH Sharma Section:-C1801 Regd. No.:- 10810012 Roll no.:- RC1801A17 Miss Kanika

Ques 1.How does a system detect thrashing? Once it detect thrashing, what can the system do to eliminate this problem? Ans.Thrashing: The high paging activity is called thrashing. A process is thrashing if it is spending more time on paging than in executing Once started, thrashing is typically self-sustaining until something occurs to remove the original situation that led to the initial thrashing behavior.. 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.

Ques2:- 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.Page faults for LRU when:Frame size Page fault

One 20 Two 18 Three 15 Page faults for FIFO when:Frame size One Two Three Page fault 20 18 16

Page faults for Optimal when:Frame size One Two Three Page fault 20 15 11

Ques3:- 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? Ans.There is only one single database object reflecting the changes made to the shared file. It may be implemented through a variety of storage, transmission, and distribution models and common methods of file sharing incorporate manual sharing using removable media, centralized computer file server installations on computer networks, World Wide Web-based hyperlinked documents, and the use of distributed peer-to-peer networking The Surround SCM database is acting as a true share with only one copy of the file in existence. The system which provides file sharing between different users creating unique copies of the file and synchronizing changes when they are made 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. 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 For linked allocation access method is sequential. Indexed allocation is more complex as compared to the above two. Ques5:- Segmentation and paging can be combined together into one scheme. What is the reason for this combination? Ans.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 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. This gives some of the advantages of with some of the advantages of segments. Ques6:- Give an example of an application in which data in a file should be accessed in the following order. 1. Sequentially 2. Randomly Ans.Sequential access 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 1.)This concept is used to access data in linked list. 2.) Data stored in a tape is accessed using this concept. . Random access: 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 Example 1.) In data structure, this concept is used in arrays. 2.) Data stored in a CD is accessed using this concept.