Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

Problem

Make a simple buddy buffer manager with 4 functions for an operating system. Using C/C++ programming language

It will give out buffers from a fixed size area. The available memory for the buffer manager will be initially set to 10 of the maximum buffer sizes (511 words)

It will have a function which gives out buffers in sizes (which are powers of 2 less 1) from 7 words to 511 words. The other word in the buffer will be a control word for use by the buffer manager. The requester will provide a block size and the routine will return an address of a buffer (probably for most of you a relative address from the start of an array holding the buffers) or -1 (cannot provide a buffer of that size because of lack of space). Note that the routine may need to split a buffer into two buddies to get a proper sized buffer. This splitting may need to cascade. For example if there are only 511 word blocks available, to get a 7 word block, a 511 word block will have to be split into two 255 word buddy blocks. Then one of the 255 word buddy blocks will have to split into two 127 word buddy blocks, etc. down to two 7 word buddy blocks, one of which will be given to the requester. The returned address will be the word after the control word. The first call to request a buffer will be required to call your initialization routine to set up the linked lists defined below. Another thing to check is a request for illegal block sizes - if you get a request for 700 words you need to return an error status (a -2 for illegal request). If, for example, you get a request for a 5 word block, you have an option (but you must be consistent), you can either return a pointer (or index) to a 7 word block or return an error status (a -2 for illegal request).

It will have another function which the user uses to returns the buffers. The only input will be an address. No status will be returned. This routine must recombine buffers that are less than the maximum size if it can. Note that this recombining may cascade, that is two 7 word buffers may combine into a 15 word buffer which intern could combine with another 15 word buffer into a 31 word buffer, which may or may not combine with another 31 word buffer. This combining could go all the way up to a 511 word buffer, but 511 word buffers are never combined.

The routine must set a flag when the buffer pool's memory is tight (less than 2 maximum sized buffers exist). It must clear this flag if the buffer pool is no longer tight.

Part of the control word is to contain a size of the buffer. Another part of the control word contains the address of the next buffer of that size in the buffer pool (or 0/null in there are none). You will need pointers to the first one of these. Initially the only buffers will be the maximum sized ones. As stated above, larger buffers may need to be split to provide smaller ones. After the first splitting happens, there will be chains of various sized buffers which will grow and contract as requests for buffers are made and other buffers are returned.

A third function will return a tight / OK status of the buffer pool.

A 4th function will be a debug function that will return the number of buffers in each buffer chain.

You will also need a driver that tests out all of the functions and prints results as it goes. The first thing this test program should do is call the status and debug status functions and then print out the expected values (not tight and ten 511 word buffers) and the actual values. Then request a 700 word block and verify that you get an illegal request status back (-2). The next thing it should do is request a 7 word buffer, verify it got it and then call the status functions again. It should then print out the expected (not tight, nine 511 word buffers, and one of each of the other sizes) and the actual status. Then return the buffer and print out the expected (not tight, ten 511 word buffers, and no other buffers) and actual status. Next in a loop request ten 511 word buffers and check out output statuses. Then request another buffer of any size (should get a -1 status). Return the buffers and output expected and actual status. Next make up some other tests to verify the proper functioning of your program. Make sure you check that no improper combining of non-buddy buffers occurs and that proper combining does.

Need to make sure you test all of the code by using up buffers and make sure recombine works etc. by outputting the results from the status and debug functions as described above. Writing a good test routine may be just as difficult as any of the other functions.

Note that languages with no pointers like Java will not work too well to do this assignment. For that reason if you are using Java or if you just don't like using pointers, you can return an offset from your requestor (an offset from the start of your buffer pool).

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M92823835

Have any Question?


Related Questions in Business Management

Business plan evaluation access the internet and locate a

Business Plan Evaluation Access the Internet and locate a business plan for an enterprise that is similar to one that you are interested in developing. Write a two-page analysis report that addresses the issues below and ...

One of the most important contributions of hofstedes

One of the most important contributions of Hofstede's studies regarding working in diverse teams is the idea of "diversity distance". How would this idea be useful in creating trust in a virtual global team?

How often should we engage in strategic planning and the

How often should we engage in strategic planning and the strategic planning process?

What is the relevance of motive under section 8a1 what is

What is the relevance of motive under Section 8(a)(1)? What is the relevance of motive under Section 8(a)(3)? Explain. That was the question,nothing else

How do you think diversity communication and organisational

How do you think diversity, communication and organisational structure could potentially constitute strong aspects of organisational culture? Why is it important for the manager to consider this relationship?

Describe the strengths and weaknesses of knowledge

Describe the strengths and weaknesses of knowledge management systems.

The degree to which a product is capable of being used on a

The degree to which a product is capable of being used on a limited basis for free or at a very low risk to consumers illustrates which characteristic that influences diffusion? Compatibility  Temporary usability Trialab ...

When applying industry analysis and organizational

When applying industry analysis and organizational structure determine when past industry performance is a good indicator of future profitability and when is it not a good indicator? and why, please explain the logic so ...

An investor decides to purchase a business he hires a

An investor decides to purchase a business. He hires a consultant to help him find a good one. The consultant advises to find a business that faces no competition because such a business can earn rates of return in exces ...

During this stage of selecting the optimal supplier a buyer

During this stage of selecting the optimal supplier, a buyer will compile a list of all possible suppliers or at least a reasonable number of potential suppliers.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As