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
Help me with this two questions please
AnnyKZ [126]

Answer:

1 is def... don't know about the other one though sorry

6 0
2 years ago
Namespaces cannot have namespaces as members.<br><br> True<br><br> False
Anna71 [15]

Answer:

False

Explanation:

namespaces can be nested. That is we can have a hierarchy of namespaces.

For examples suppose we have a namespace top. Within this we have another namespace first. At the next level we have a namespace called second. Then we have a class MyClass as a member of this namespace second. Then the complete description of the class will be as follows:

top::first::second::MyClass

5 0
4 years ago
If you want to remove the autocorrect options button from the screen, you can press the ____ key.
Luden [163]

Answer:

ESC

Explanation:

It allows the user to abort, cancel, or close an operation.

3 0
2 years ago
Why when I send a message on iOS it says the person’s notification is silenced, and the message isn’t delivered?
Leto [7]

Answer:

This is because the other person has "Focus Mode" turned on. When this is turned on, all of your messages that you send to him/her will be silenced.

4 0
3 years ago
How to reply to text from unknown number?
Leto [7]
Safest way: DO NOT reply and BLOCK number.

If you are not sure if the guy is related to some stuff, it will be better to call him back, instead of texting.
5 0
3 years ago
Other questions:
  • What are three situations when recursion is the only option available to address problems?
    10·1 answer
  • Mrs. Johnson is here today to receive an intercostal nerve block to mitigate the debilitating pain of her malignancy. Her cancer
    13·1 answer
  • ANYONE WITH K12 OHVA HIGH SCHOOL LAPTOP! I successfully enter my schools homepage and can login. BUT once I am logged in, it say
    9·2 answers
  • What is the primary difference between the windows server 2012 r2 server manager and previous versions (before windows server 20
    11·1 answer
  • Anyone trying to play?
    5·2 answers
  • What is Digital Etiquette? Explain in your own words
    13·1 answer
  • You wrote a program to find the factorial of a number. In mathematics, the factorial operation is used for positive integers and
    14·2 answers
  • After Sally adds the Print Preview and Print command to the Quick Access Toolbar, which icon would she have added? the icon that
    6·2 answers
  • Consider the following method:
    9·1 answer
  • Put these numbers in order from smallest to largest:<br> 1. 00101112<br> 2. 011110<br> 3. 011110112
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!