10.16

6 views
Skip to first unread message

Matt Miller

unread,
Dec 3, 2009, 12:21:16 AM12/3/09
to utexas-cs352-fall2009
I got the same answer for all four boxes on 10.16, which just seems way too suspicious to be correct.

For the first line, for example, I think that the allocated block would require 12 bytes (4 byte headers and footer, 4 byte payload to maintain alignment) and the free block would need 16 bytes (header, footer, 2 pointers).  So, 16 would be the answer.

Can someone tell me where the (probable) flaw in my logic is?

mdm...@cs.utexas.edu

unread,
Dec 3, 2009, 1:22:01 AM12/3/09
to Michael Massaro, utexas-cs3...@googlegroups.com
That would make sense, but the diagram of doubly-linked free list blocks in Figure 10.50 (p. 752) doesn't show the allocated block as having the pred and succ pointers, so I didn't think that was necessary, and I can't think of a reason why there would need to be pointers in allocated blocks.

The only other thought that I had was that the question specifies a "non-zero payload", so if you applied that rule to a free block then I guess maybe you have to have a non-zero space for a payload even in the free blocks, but that doesn't make a lot of sense either.

----- Original Message -----
From: "Michael Massaro" <mikestud...@hotmail.com>
To: mdm...@cs.utexas.edu, utexas-cs3...@googlegroups.com
Sent: Wednesday, December 2, 2009 11:42:54 PM GMT -06:00 US/Canada Central
Subject: RE: 10.16
From what the question states, "four-byte pred and succ pointers in each free block" even though it said for each free block, I assumed it would be used in an allocated block as well being that it would need to also have pred and succ pointers. If you assume this then you get 20 bytes ( 4 header, 4 footer, 4 payload, 4 pred, 4 succ). I did this a while ago, but I think that's how I figured it.


Date: Wed, 2 Dec 2009 23:21:16 -0600
From: mdm...@cs.utexas.edu
To: utexas-cs3...@googlegroups.com
Subject: 10.16


I got the same answer for all four boxes on 10.16, which just seems way too suspicious to be correct.

For the first line, for example, I think that the allocated block would require 12 bytes (4 byte headers and footer, 4 byte payload to maintain alignment) and the free block would need 16 bytes (header, footer, 2 pointers).  So, 16 would be the answer.

Can someone tell me where the (probable) flaw in my logic is?


Chat with Messenger straight from your Hotmail inbox. Check it out

David L. Rager

unread,
Dec 3, 2009, 1:24:39 AM12/3/09
to mdm...@cs.utexas.edu, Michael Massaro, utexas-cs3...@googlegroups.com
When I answer this question, I make the assumption that the non-zero
payload only applies to allocated blocks. You should be fine making a
similar assumption.
Reply all
Reply to author
Forward
0 new messages