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]
2 years 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]2 years 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
Which area would a Gaming Designer fall under? Research and explain why you think so. Make sure to site your source and where yo
pshichka [43]

Answer: Game Artist, Game Designer or Game Programmer.

Explanation:

All of which fall under a “Game Designer”

5 0
3 years ago
Which of the following need NOT be completed separately if a worksheet is prepared?
Anika [276]
C because you already have you sheet prepared
3 0
4 years ago
Imaging a computer is part of what phase of conversion?
grandymaker [24]
B. Because the computer can rearrange itself when it is in a phase of conversion
5 0
3 years ago
Which of the following describes the phishing method of information security crime?
Marianna [84]
<span>C. pretending to be someone else when asking for information</span>
3 0
3 years ago
Read 2 more answers
Should Manufacturers Include Extra Programs in Operating Systems for Computers and Mobile Devices?
Gennadij [26K]

Answer:

Well, it depends. Sometimes the extra programs can be useful or just plain fun, in which case the answer is yes. But extra programs can also sometimes be utterly useless and get in the way, in which case the answer is no.\

4 0
3 years ago
Other questions:
  • Which of the following Google tools support collaboration? Docs Sheets Slides All of the Above
    13·1 answer
  • What are some options available in the Spelling and Grammar Checker in word?
    6·1 answer
  • Individuals and businesses have concerns about data security while using Internet-based applications. Which security risk refers
    7·2 answers
  • This function causes a program to terminate, regardless of which function or control mechanism is executing.
    12·1 answer
  • What are three to five (3-5) key differences and features in Windows Server 2016 versus 2012?
    14·1 answer
  • Mark is looking for a position in the IT field that best matches his qualifications. He has an associate degree in the field and
    6·1 answer
  • What will happen if you delete system32?
    7·1 answer
  • Ba esti prost?<br> Ba esti nebun?<br> Ce ai?
    5·2 answers
  • Consider the following code snippet:
    10·1 answer
  • In python please.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!