1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleonysh [2.5K]
1 year ago
6

suppose a malloc implementation returns 8-byte aligned addresses and uses an explicit free list where the next and previous poin

ters are each 32-bits. blocks have a 32-bit header and 32-bit footer, where the low-order bit of the header and footer are used to indicate whether the block is allocated (1) or free (0). furthermore, the block size (which includes the header, payload, footer, and any necessary padding) is rounded up to the nearest multiple of 8, and this size (in bytes) is stored in the header and footer. assume any padding must be between the payload and the footer. if we call malloc(1), what block size will be allocated, in bytes?
Computers and Technology
1 answer:
Naya [18.7K]1 year ago
8 0

4 bytes because even if you call malloc and free a little more frequently, that might still occur. malloc frequently uses the extra space for managing (a linked list of all memory blocks and their sizes) when it takes a few bytes more than what is requested.

There is a good chance that you will tamper with the internal management structures and cause the subsequent malloc of free will to crash if you write some bytes either before or after your allocated block.

4004 because malloc internally always allocates at least four bytes. Your program would be 4000 if you added four bytes, making it 4004. may crash only when you access byte n+1. Additionally, the operating system typically only protects pages of memory.

Your process may be able to read-write the remainder of the page and will only crash when accessing the next memory page if your malloc-ed byte is in the middle of a page with a size of 512 bytes. But keep in mind: Even if this works, the behavior is not clear.

To learn more about internal management here

brainly.com/question/13398903

#SPJ1

Full Question = Suppose a malloc implementation returns 8-byte aligned addresses and uses an explicit free list where the next and previous pointers are each 32-bits. Blocks have a 32-bit header and 32-bit footer, where the low-order bit of the header and footer are used to indicate whether the block is allocated (1) or free (0). Furthermore, the block size (which includes the header, payload, footer, and any necessary padding) is rounded up to the nearest multiple of 8, and this size (in bytes) is stored in the header and footer. Assume any padding must be between the payload and the footer.

a) If we call malloc(1), what block size will be allocated, in bytes?

b) With the same conditions, and assuming we've already called malloc(1), if the heap used by malloc starts at address 0x4000 (16384 in decimal), what address would be returned if we then called malloc(32)?

You might be interested in
Rr lyrae stars pulsate, but with shorter periods and lower luminosities than cepheids. true false
KIM [24]

True, RR Lyrae stars pulsate, but with shorter periods and lower luminosities than Cepheids.

The pulsation periods of the fundamental-mode RR Lyrae stars range from about 0.3 to 1.0 days (Population II pulsators with longer periods are categorized as type II Cepheids), but the vast majority of them have generations longer than 0.45 days.

<h3>Why do RR Lyrae stars pulsate?</h3>

RR Lyrae stars pulse like Cepheid variables, but the nature and histories of these stars is thought to be rather different. Like all variables on the Cepheid fluctuation strip, pulsations are caused by the κ-mechanism, when the ambiguity of ionised helium varies with its temperature.

To learn more about RR Lyrae, refer

brainly.com/question/13946889

#SPJ4

8 0
2 years ago
Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes
Elan Coil [88]

Answer:

See Explaination

Explanation:

package testscores;

import java.util.ArrayList;

import java.util.List;

public class TestScores {

public List<Integer> scorearray=new ArrayList<>();

public TestScores(List<Integer> scores) throws InvalidTestScore{

this.scorearray=scores;

for(int i=0;i<scorearray.size();i++){

if(scorearray.get(i)>100 || scorearray.get(i)<0){

throw new InvalidTestScore(this.scorearray.get(i));

}

}

}

public double average(){

int tot=0;

for(int i=0;i<this.scorearray.size();i++){

tot=tot+this.scorearray.get(i);

}

return tot*(1.0)/(this.scorearray.size());

}

class InvalidTestScore extends Exception

{

private double amount;

public InvalidTestScore(int Score)

{

System.out.println("Invalid Score "+Score);

}

}

}

8 0
3 years ago
Question 1
blondinia [14]

Answer:

888 + 88 + 8 + 8 + 8 = 1000

Explanation:

Required

Add up to 1000 using only digit 8

There is no straight way to answer this question; so, we make use of trial by error method to arrive at our solution.

After several trials, I found out that:

888 + 88 + 8 + 8 + 8 = 1000

6 0
3 years ago
Viết chương trình hoàn chỉnh các yêu cầu sau:
Blababa [14]

Explanation:

the perimeter of an aluminium sheet is 120 CM if its length is reduced by 10% and its breadth is increased by 20% the perimeter does not change find the measure of the length and the breadth of the sheet

4 0
3 years ago
Which symbol would be used in a flowchart to represent a connection to another part of the flowchart on the same page
AlekseyPX

Answer:

The answer is "Connectors".

Explanation:

Please find the Connectors image in the attached file.

In this question, the connectors symbol is usually small throughout the flowcharts. It is used as a connection to display and changes throughout the flux. It was usually marked by major letters that indicate jump points. This diagram visually shows the sequence of events in a system and who is accountable.

7 0
3 years ago
Other questions:
  • The quality of a language that allows a programmer to express a computation clearly, correctly, concisely, and quickly is called
    7·1 answer
  • Which code fragment constructs an arrray list named players that is initialized to contain the strings "player 1" and "player 2"
    15·1 answer
  • what is it called when someone uses software to run multiple operating systems on one computer at the same time? A.functional vi
    9·1 answer
  • A forensic investigator at a crime lab is performing a forensic analysis of a hard drive that was brought in by state troopers.
    10·1 answer
  • "Consideration of being digitally" literate Means to produce digital technology Participate in digital activities none of the ch
    11·1 answer
  • Why is an ISA unlikely to change between successive generations of microarchitectures
    11·1 answer
  • Communications technology and the Internet can be used to reduce the time and costs involved in disseminating financial statemen
    14·1 answer
  • Which logic correctly describes an algorithm to find the smallest of the three numbers a, b, and c and store the smallest number
    15·1 answer
  • Some people recommend deleting social media accounts because of the troubling legal and ethical implications of social media. Do
    9·1 answer
  • You are a teaching assistant for an introductory computer concepts course at your local community college. The instructor asks y
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!