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
A thick black line around the outside edge of a page is a _____.
Montano1993 [528]
B. Border. It borders the outer page.
7 0
3 years ago
Read 2 more answers
Help!! me!! plsssssssssssssssssssssssssssssssssss
Maslowich

Answer:

e,f,g, and h

Explanation:

5 0
2 years ago
What web 2.0 features allows users to subscribe to a data plan that charges for the amount of time spent on the internet?
galina1969 [7]

Answer:

The answer to this question is given in the explanation section. The correct option is long tail

Explanation:

a.Folksonomy

Folksonomy is a way of organizing data and digital content. With Web 2.0, users can collaboratively manage and tag photos, journals and other media. As more users do this, creates a system of classification for the media and information.  so this option is not correct

b. long tail (correct option)

Some sites are able to offer services as well in which users can subscribe monthly or pay a fee every so often. An example of this would be Netflix.

c.user participation

All users have the free will to contribute to the site which makes many Web 2.0 pages public. With sites such as Wikipedia, anyone is open to the editing of articles. Information is provided two-way instead of solely from the site owner.

d.application

Web 2.0 applications that allow anyone to create and share online information or material they have created. As you know that there are number of different types of web 2.0 applications including wikis, blogs, social networking, folksonomies, podcasting & content hosting services.

3 0
3 years ago
A template slide that controls the formatting of all other slides in the presentation is called a _________.
PtichkaEL [24]

Answer:

the answer is slide master

7 0
2 years ago
Given public class Fishing { byte b1 = 4; int i1 = 123456; long L1 = (long) i1; //Line A short s2 = (short) i1; //Line B byte b2
Aleksandr [31]

Answer:

Line E.

Explanation:

The  given program is as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = b1 + 7;     //Line E

   }

In the above code Line E will not compile and give following compilation error:

error: incompatible types: possible lossy conversion from int to byte

This error is coming because in Java b1 + 7 will be interpreted as int variable expression. Therefore in order to make code of Line E work the expression should be type casted as byte.  

The correct code will be as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = (byte)(b1 + 7);     //Line E

   }

5 0
3 years ago
Other questions:
  • What is unique about being an administrative professional in a government job?
    8·2 answers
  • Question 10 of 10
    6·1 answer
  • If anything is changed on an already-tested module, regression testing is done to be sure that this change hasn’t introduced a n
    13·1 answer
  • What is the different between ethical and legal issues?​
    6·1 answer
  • Write a program that will input the names, ages and weights of three siblings and display the lightest followed by the youngest
    13·1 answer
  • What is the other name of the horizontal column graph
    9·1 answer
  • The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
    13·1 answer
  • Write a program to prompt the user for hours worked to compute a gross pay for an employee, and he is paid 100/hour. If he worke
    7·1 answer
  • Write a program which will enter information relating to a speeding violation and then compute the amount of the speeding ticket
    12·1 answer
  • When proofreading, you should do all of the following except _____.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!