Question

In: Computer Science

In chapter 9, you learned about address binding during the execution of a program. In your...

  1. In chapter 9, you learned about address binding during the execution of a program. In your own words, explain the steps a user program goes through before being executed.
  2. Explain the difference between logical and physical address space.
  3. Explain virtual memory and describe the benefits of virtual memory for a programmer.

On the same paper, show the work to answer the following two questions.

  1. Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 115 KB, 500 KB, 358 KB, 200 KB, and 375 KB (in order)? Rank the algorithms in terms of how efficiently they use memory. Show your work.
  2. Consider the following page reference string:

7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4, 6, 2, 3, 0 , 1.

Assuming demand paging with three frames, how many page faults would occur for the following replacement algorithms? Work this assignment on a piece of paper and submit an image of your work. Show your work in detail as seen in the examples in the textbook.

  • FIFO replacement (see section 10.4.2)
  • Optimal replacement (see section 10.4.3)
  • LRU replacement (see section 10.4.4)

Solutions

Expert Solution

Difference Between Logical and Physical Address
Physical address is an actual location in memory unit and can be accessed physically, while the logical address is something generated by CPU, it does not exist physically.Physical Addresses are computed by the MMU(Memory Management Unit) whereas the logical addresses are generated while the program is running.

Virtual Memory
Virtual memory allows the system to compensate for memory shortage by using secondary memory which is addressed like part of main memory. Basically, storage spaces like hard drives or SSDs are considered part of RAM or main memory.
Advantages
Since there is more space now, larger programs can be written, there is reduced fragmentation and allocating the memory is easy. Since programs are stored on virtual memory, it occupies significantly less spac on main memory. Since I/O is less, there is more efficient swapping of processes

2) a) First-Fit

  • -115 in 300 partition, memory left : 185 KB, 600 KB, 350 KB, 200 KB, 750 KB, 125 KB
  • -500 in 600 partition, memory left :185 KB, 100 KB, 350 KB, 200 KB, 750 KB, 125 KB
  • -358 in 750 partition, memory left :185 KB, 100 KB, 350 KB, 200 KB, 392 KB, 125 KB
  • -200 in 350 partition, memory left :185 KB, 100 KB, 150 KB, 200 KB, 392 KB, 125 KB
  • -375 in 392 partition, memory left : 185 KB, 100 KB, 150 KB, 200 KB, 17 KB, 125 KB

2) b) Best-fit:

  • -115 in 125 KB partition, memory left: 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, 10 KB
  • -500 in 600 KB partition, memory left: 300 KB, 100 KB, 350 KB, 200 KB,750 KB, 10 KB
  • -358 in 750 KB partition, memory left: 300 KB, 100 KB, 350 KB, 200 KB,392 KB, 10 KB
  • -200 in 200 KB partition, memory left: 300 KB, 100 KB, 350 KB, 0 KB, 392KB, 10 KB
  • -375 KB in 392 KB partition, memory left: 300 KB, 100 KB, 350 KB, 0 KB, 17KB, 10 KB

2) c) Worst-fit:

  • -115 in 750 KB partition, memory left: 300 KB, 600 KB, 350 KB, 200 KB,635 KB, 125 KB
  • -500 in 635 KB partition, memory left: 300 KB, 600 KB, 350 KB, 200 KB,135 KB, 125 KB
  • -358 in 600 KB partition,memory left: 300 KB, 242 KB, 350 KB, 200 KB, 135 KB, 125 KB
  • -200 in 350 KB partition, memory left: 300 KB, 242 KB, 150 KB, 200 KB,135 KB, 125 KB
  • -375 KB should wait

First fit performs best followed by best fit and worst-fit at last because it doesn't allow a memory request to be satisfied.

Page replacement algorithms:

  • -FIFO: page fault=17
  • -LRU : page fault-18
  • -Optimal Page Replacement: page fault: 13

Please comment in case of doubts or queries.
Kindly upvote if you found it useful :)


Related Solutions

The question to address is: “What have you learned about statistics?” In developing your responses, consider—at...
The question to address is: “What have you learned about statistics?” In developing your responses, consider—at a minimum—and discuss the application of each of the course elements in analyzing and making decisions about data (counts and/or measurements). Descriptive statistics Inferential statistics
In Chapter 3 you learned about COSO's internal control framework. In this chapter, we took a...
In Chapter 3 you learned about COSO's internal control framework. In this chapter, we took a look at COSO's enterprise risk management framework. COSO went to great lengths to explain why the ERM framework was needed and how it relates to the internal control framework. Read their explanation at the COSO web site. Open your browser and type the address as www.coso.org There is a thought paper on the home page you may find helpful. Are both frameworks needed? Do...
In chapter 17, you learned about health care issues from an economist’s perspective. Share your own...
In chapter 17, you learned about health care issues from an economist’s perspective. Share your own personal story of visiting a hospital and discuss how your experience explains the topics of moral hazard or adverse selection. Explain whether or not moral hazard or adverse selection can be justified from a biblical perspective.
In chapter 17, you learned about health care issues from an economist’s perspective. Share your own...
In chapter 17, you learned about health care issues from an economist’s perspective. Share your own personal story of visiting a hospital and discuss how your experience explains the topics of moral hazard or adverse selection. Explain whether or not moral hazard or adverse selection can be justified from a biblical perspective.
4 Run-time error, program crashed during execution. Not sure why you are using an array[] to...
4 Run-time error, program crashed during execution. Not sure why you are using an array[] to get input, not necessary and it seems to imply a comma separated file. The input file I provided has each data element on its own line. But it is the array[] , splittedLine, that is causing your run-time error. code import java.util.Scanner; public class SalaryCalcModularized{ public static void compute(double hrlyPayRate,double hrs,String name,String shift){ // Calculate regular and overtimepay double regularPay = Math.min(40, hrs) *...
The following sentences and paragraphs highlight some of the problems you learned about in this chapter....
The following sentences and paragraphs highlight some of the problems you learned about in this chapter. Use what you have learned to rewrite + examples to make them clear and readable. 1. From a one-page notice informing employees which machines they can use in a training facility: Employees should be well advised that they should use only the first row of machines the HP PCs. All other machines are used only for classes for training new users. If an employee...
While talking to your friend about your week, you mentioned that you had just learned about...
While talking to your friend about your week, you mentioned that you had just learned about standard costing which plays a vital role in variance analysis. This topic interested your friend, who runs a bakery and wants to learn what he or she would need to do to set up a standard costing system for the bakery. This gives you an opportunity to share your new knowledge with your friend. What would you tell your friend about standard costing?
In Chapter 11 you learned about Brand Equity and Brand Essence. Select one product that is...
In Chapter 11 you learned about Brand Equity and Brand Essence. Select one product that is your personal favorite and do the following: 1st.Describe the product you selected. 2nd Describe why & how you believe that brand has developed Brand Equity . 3rd.Then using the Laddering Process explain that Brands Essence.
In Chapter 11 you learned about Brand Equity and Brand Essence. Select one product that is...
In Chapter 11 you learned about Brand Equity and Brand Essence. Select one product that is your personal favorite and do the following: 1st.Describe the product you selected. 2nd Describe why & how you believe that the brand has developed Brand Equity. 3rd.Then using the Laddering Process explain that Brands Essence.
In Chapter 6 you learned about revenue recognition as well as evaluating receivable balances and establishing...
In Chapter 6 you learned about revenue recognition as well as evaluating receivable balances and establishing an allowance for bad debts. Access Starbucks 10-K and answer the following (hint: you will need to explore the first footnote): 10-K link: https://www.sec.gov/Archives/edgar/data/829224/000082922414000041/sbux-9282014x10k.htm#s6571E5A222BF69F5F8068EA40E001FDA Starbucks has provided detail for 3 categories of net revenue shown on the income statement. List each category and provide a brief summary of each category, including information such as (but not limited to): the amount of revenue in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT