assign3 - vertical line. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 361S Intro to Systems Software Assignment #3 Due: Thursday, Nov. 12, 2009. 1. B&O p. 577: problem 7.8. 2. B&O p. 578: problem 7.9. 3. B&O p. 578: problem 7.10. 4. B&O p. 579: problem 7.12. For the address, what is being asked for is its address in the .text segment. 5. Consider the following datatype definition on a 32-bit x86 machine: typedef struct { char c; double *p; int i; double d; short s; } struct1; a. Using the template below (allowing a maximum of 32 bytes), indicate the allocation of data for a structure of type struct1 . Mark off and label the areas for each individual element (there are 5 of them). Cross hatch the parts that are allocated, but not used (to satisfy alignment). Assume the following alignment rule: data types of size x must be aligned on x -byte boundaries. Clearly indicated the right hand boundary of the data structure with a
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: vertical line. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ b. How many bytes are allocated for an object of type struct1 ? c. What alignment is required for an object of type struct1 ? Consider the implications of a declaration of the form struct1 foo[4]; d. If we define the fields of struct1 in a different order, we can reduce the number of bytes wasted by each variable of type struct1 . What is the number of unused, allocated bytes in the best case?...
View Full Document

Ask a homework question - tutors are online