Reference no: EM131209859
[M] Write an IA-32 program to solve Problem 2.24 in Chapter 2.
Problem 2.24
[D] Another useful data structure that is similar to the stack is called a queue. Data are stored in and retrieved from a queue on a first-in-first-out (FIFO) basis. Thus, if we assume that the queue grows in the direction of increasing addresses in the memory, which is a common practice, new data are added at the back (high-address end) and retrieved from the front (low-address end) of the queue. There are two important differences between how a stack and a queue are implemented. One end of the stack is fixed (the bottom), while the other end rises and falls as data are pushed and popped. A single pointer is needed to point to the top of the stack at any given time. On the other hand, both ends of a queue move to higher addresses as data are added at the back and removed from the front. So two pointers are needed to keep track of the two ends of the queue. A FIFO queue of bytes is to be implemented in the memory, occupying a fixed region of k bytes. The necessary pointers are an IN pointer and an OUT pointer. The IN pointer keeps track of the location where the next byte is to be appended to the back of the queue, and the OUT pointer keeps track of the location containing the next byte to be removed from the front of the queue.
(a) As data items are added to the queue, they are added at successively higher addresses until the end of the memory region is reached. What happens next, when a new item is to be added to the queue?
(b) Choose a suitable definition for the IN and OUT pointers, indicating what they point to in the data structure. Use a simple diagram to illustrate your answer.
(c) Show that if the state of the queue is described only by the two pointers, the situations when the queue is completely full and completely empty are indistinguishable.
(d) What condition would you add to solve the problem in part (c)?
(e) Propose a procedure for manipulating the two pointers IN and OUT to append and remove items from the queue.
Provide examples of how research can assist policy-makers
: Describe the relationship between research and policy development. Provide examples of how research can assist policy-makers to inform their policy decisions.
|
Online mainstream news sources
: Articles must include either international trade or international finance issues, but the U.S. does not have to be a part of the focus of the article. You will need to collect news articles from online mainstream news sources. You will submit a U..
|
Describe to mr. steele his trial options
: Identify all major steps you will take to prepare a defense for Mr. Steele , including investigation of evidence and witnesses, should Mr. Steele be arrested for a felony such as armed robbery. Explain to Mr. Steele the pre-trial process and any m..
|
Does frere bros have any remedy
: During the first year of the agreement, Joe entered into a contract to star in a film being made by Pretty Pictures. Does Frère Bros have any remedy?
|
Propose a procedure for manipulating the two pointers
: As data items are added to the queue, they are added at successively higher addresses until the end of the memory region is reached. What happens next, when a new item is to be added to the queue?
|
Eating half of the steak
: Suppose you are on a date at Mastro's Steakhouse and order the 16oz New York Strip. After eating half of the steak, you feel full. Your date tells you that you should finish the steak since you have to pay for it regardless and should eat it while..
|
Describe the law and how you would address the issue
: Using a minimum of three scholarly sources, compare and contrast the pros and cons of required professional qualifications for all medical examiners, regardless of where they work. Should a person who conducts an autopsy be required to be medicall..
|
Write a program to solve a problem of stack
: [M] Write an IA-32 program to solve Problem 2.22 in Chapter 2. Assume that the element to be pushed/popped is located in register EAX, and that register EBX serves as the stack pointer for the user stack.
|
What is risk all business organisations strive
: What is risk All business organisations strive to achieve specific goals, within the process businesses all take risks to determine outcomes - Legal and regulatory risk In the production of hospitality businesses we experience legal and regulatory..
|