<< Chapter < Page
  Operating systems     Page 2 / 4
Chapter >> Page >

 

What is thrashing and how can an operating system take steps to avoid it?

 

      Thrashing occurs when a system spends more time swapping than running a process. The operating system can avoid thrashing by reducing the number of processes that are in memory, i.e. by swapping some out.

 

What are the advantages of having a fixed or a variable resident set? for both of these methods of sizing the resident set, explain what it means to have a global or a local replacement policy.

 

      The advantage of having a fixed resident set means that no other process can take frames away from you. However, this has to take into account the maximum need of a process and so it may waste memory. The advantage of having a dynamic resident set means the number of frames dedicated to a process can grow or shrink over time, more closely matching its needs. Of course, there is more overhead involved with this approach.

 

      A fixed size resident set implies a local replacement policy. Any time a process needs a new page, one of its own pages must be replaced.

 

      Having a variable resident set allows the operating system to do either local or global replacement. Doing local replacement means that the process always replaces one of its own frames and the resident set size can be increased or decreased separately by the operating system. Doing global replacement means the process can automatically increase its resident set by choosing to replace someone else's page with its own. It may also have its resident set decreased when someone else chooses one of its pages.

What is the advantage of precleaning versus demand cleaning?

 

      Precleaning may decrease the page fault rate if the operating system is able to bring in pages in advance of them being used by a process. This may be particularly effective at the time the process is first loaded.

 

 

 

Problems

 

A dynamic partitioning scheme is being used, and the following is the memory configuration at a given point in time:

 

 

      The shaded areas are allocated blocks; the white areas are free blocks. The next three memory requests are for 40M, 20M, and 10M. Indicate the starting address for each of the three blocks using the indicated placement algorithms:

 

         1. First-fit

     * The 40 M block fits into the second hole, with a starting address of 80M.

                * The 20M block fits into the first hole, with a starting address of 20M.

                * The 10M block is placed at location 120M.

 

         2. Best-fit

 The three starting addresses are 230M, 20M, and 160M, for the 40M, 20M, and 10M blocks, respectively.

 

3. Next-fit. Assume the most recently added block is at the beginning of memory.

The three starting addresses are 80M, 120M, and 160M, for the 40M, 20M, and 10M blocks, respectively.

 

         4. Worst-fit

 The three starting addresses are 80M, 230M, and 360M, for the 40M, 20M, and 10M blocks, respectively.

 

A 1-mbyte block of memory is allocated using the buddy system.

a.       Show the results of the following sequence in a figure similar to Figure 7.6: Request 70; Request 35; Request 80; Return A; Request 60; Return B; Return D; Return C.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Operating systems. OpenStax CNX. Aug 13, 2009 Download for free at http://cnx.org/content/col10785/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Operating systems' conversation and receive update notifications?

Ask