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
Marta is creating a program that will guide the user through a series of physical exercises. She wants the program to coach the
san4es73 [151]
She should use a condition-controlled loop. Because it uses a True/False and it will not continue until the task is done
7 0
2 years ago
Read 2 more answers
How do i protect my computer from electrical spikes
Setler [38]
I believe the answer is bloody purple poop that is the size of an extra large grilled cheese 
5 0
3 years ago
Read 2 more answers
Pls due soon
Natasha_Volkova [10]

Answer:

Software for personal computers is typically developed and distributed independently from the hardware or operating system manufacturers. Many personal computer users no longer need to write their own programs to make any use of a personal computer, although end-user programming is still feasible. This contrasts with mobile systems, where software is often only available through a manufacturer-supported channel. And end-user program development may be discouraged by lack of support by the manufacturer.

Explanation:

5 0
3 years ago
You are to design class called Employee whose members are as given below:
frozen [14]

Answer:

//The Employee Class

public class Employee {

   char name;

   long  ID;

//The constructor  

public Employee(char name, long ID) {

       this.name = name;

       this.ID = ID;

   }

//Method Get Person

   public void getPerson (char newName, long newId){

       this.ID = newName;

       this.ID = newId;

   }

//Method Print

   public void print(){

       System.out.println("The class attributes are: EmpName "+name+" EmpId "+ID);

   }

}

The working of the class is shown below in another class EmployeeTest

Explanation:

public class EmployeeTest {

   public static void main(String[] args) {

       Employee employee1 = new Employee('a', 121);

       Employee employee2 = new Employee('b', 122);

       Employee employee3 = new Employee('c', 123);

       employee1.print();

       employee2.print();

       employee3.print();

   }

}

In the EmployeeTest class, Three objects of the Employee class are created.

The method print() is then called on each instance of the class.

6 0
3 years ago
50 points for each person brainless goes to the best answer
kifflom [539]

Technical writing is writing that is done for the purpose of educating, informing or directing someone on how to do something. Technical writing is significantly different than other types of writing such as narrative, because technical writing is intended to impart to the reader some specific skill or ability. Technical writing isn't for everyone. It is often very detail-oriented and usually involves writing within fields where some advanced knowledge is required. When given a technical writing assignment, it also must be approached in a certain way in order for you to be successful. but i would have to go with c- e commerce

7 0
2 years ago
Read 2 more answers
Other questions:
  • Bob received a message from Alice which she signed using a digital signature. Which key does Bob use to verify the signature?Gro
    13·1 answer
  • Which is a correctly formatted Python tuple?
    9·1 answer
  • Whitch action should a user take to ensure that formatting is applied to a row? A. use the ctrl+a keys. B. highlight the whole t
    11·1 answer
  • How can a student manage time and stress for better results in school? Check all that apply. by taking breaks while studying by
    8·2 answers
  • What does NCR stand for
    12·2 answers
  • Lamp is an acronym for a complete solution of open source software that goes together to build a general purpose web server. whi
    13·1 answer
  • A local cinema allows customer to make a movie ticket reservation. A customer can be
    6·1 answer
  • When installing the latest version of Internet Explorer, a dialogue box pops up with a box checked telling you that Bing will be
    15·1 answer
  • E-What is the important of Recycle bin?<br>Ans:​
    12·1 answer
  • Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!