Consider the following segment of C code #define SIZE 1000 int a[SIZE], b[SIZE]; int i, j;...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following segment of C code #define SIZE 1000 int a[SIZE], b[SIZE]; int i, j; for (i = 0; i < SIZE; i++) { j = SIZE - Ei; a[i] = b[j]; } for (i = 0; i < SIZE; i++) { (i + SIZE/2) % SIZE; a[i]= a[i] b[j]; j } Assume that an ints are 32 bits long. (a) References to which variable(s) exhibit temporal locality in this code? Remember that each element of an array is a variable. (b) References to which variable(s) exhibit spatial locality in this code? (c) The cache of the system executing this code consists of 256 blocks, and each block can hold 16 bytes. How many bytes can fit into this cache at one time? (d) Ignoring instructions, and assuming that a and b are stored adjacent to each other in memory, how large would the cache have to be to hold the entire contents of both arrays at the same time? Give your answer in bytes, KiB, or MiB, as appropriate. Consider the following segment of C code #define SIZE 1000 int a[SIZE], b[SIZE]; int i, j; for (i = 0; i < SIZE; i++) { j = SIZE - Ei; a[i] = b[j]; } for (i = 0; i < SIZE; i++) { (i + SIZE/2) % SIZE; a[i]= a[i] b[j]; j } Assume that an ints are 32 bits long. (a) References to which variable(s) exhibit temporal locality in this code? Remember that each element of an array is a variable. (b) References to which variable(s) exhibit spatial locality in this code? (c) The cache of the system executing this code consists of 256 blocks, and each block can hold 16 bytes. How many bytes can fit into this cache at one time? (d) Ignoring instructions, and assuming that a and b are stored adjacent to each other in memory, how large would the cache have to be to hold the entire contents of both arrays at the same time? Give your answer in bytes, KiB, or MiB, as appropriate.
Expert Answer:
Related Book For
Value at Risk The New Benchmark for Managing Financial Risk
ISBN: 978-0071464956
3rd edition
Authors: Philippe Jorion
Posted Date:
Students also viewed these programming questions
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
ttth Suppose that the sequence of bags {Bn | n N} is recursively enumerated by the computable function e(n, x) = fn(x), [7 marks] Hence prove that the set of all recursive bags cannot be recursively...
-
The contingency table shown relates happiness and gender for the 2012 GSS. a. Identify the response variable and the explanatory variable. b. Construct a table or graph showing the conditional...
-
Black-welder Factory produces two similar products - small lamps and desk lamps. The total plant overhead budget is $640,000 with 400,000 estimated direct labor hours. It is further estimated that...
-
FASTPACK Manufacturing produces filament packaging tape. In 2014, FASTPACK produced and sold 15,000,000 rolls of tape. The company has recently expanded its capacity, so it now can produce up to...
-
The Dude Map Go to $h t t p: / / q z . c o m / 316906 / t h e-$ dude-map-how-american-men-refer-to-their-bros/ to see "The dude map: How Americans refer to their bros,"89 a heat map of the United...
-
A production manager at a Contour Manufacturing plant has inspected the number of defective plastic molds in 5 random samples of 20 observations each. Following are the number of defective molds...
-
A firm sells to a single consumer using the optimal two-part tariff. Briefly explain why this firm has MR(Q) = P(Q). Provide an intuitive explanation.
-
Wayland Custom Woodworking is a firm that manufactures custom cabinets and woodwork for business and residential customers. Students will have the opportunity to establish payroll records and to...
-
1.What is the proper form of the equilibrium constant expression for the equation: N2(g)+O2(g)<=>2NO(g) 2.The of the reaction: NO2(g)+NO3(g)<=>N2O5(g) is K= 2.1x10^-20. What can be said...
-
An asset was purchased for $262000. It had an estimated salvage value of $52000 and an estimated useful life of 10 years. After 5 years of use, the estimated salvage value is revised to $40000 but...
-
A pair of meshing spur gears with pressure angles (0) of 20 and a module (m) of 2. The pinion has 20 teeth (72) and the gear has 40 teeth (T3). Determine center distance (C) of the two gears. When...
-
You have taken a management position in Ocean Cuisines plc that just went public last year. The company's restaurants specialize in seafood dishes. A concern you had was that the restaurant business...
-
A fruit company packages its fruit into two types of boxes: large and small. This morning, the company made two deliveries. The table below shows the number of boxes in each delivery and the total...
-
Current ratio = 2 . 2 times Credit sales = $ 8 7 6 m Average collection period = 5 0 days Inventory turnover = 1 . 2 0 times Total asset turnover = 0 . 6 0 times Debt ratio = 6 0 % Use the above...
-
Task: The below table shows socio-economic data of two fictitious countries. From the perspective of a business considering the possibility of undertaking business in these countries, analyse what...
-
What did Lennox gain by integrating their WMS, TMS, and labor management systems?
-
What is the advantage of using ISD (implied standard deviation) to predict volatility?
-
What are the advantages and disadvantages of making only some of the symbols defined inside a kernel accessible to a loadable kernel module?
-
Explain why the distribution of credit-risk gains and losses is similar to a short position in an option. Discuss loans and derivatives.
-
The sequence in Figure P2.3 represents a ball that is initially held above the ground. In the first frame the ball is released. In subsequent frames the ball falls, bounces on the ground, rises, and...
-
If an object's initial position is \(x_{\mathrm{i}}=+6.5 \mathrm{~m}\) and its final position is \(x_{\mathrm{f}}=+0.23 \mathrm{~m}\), what is the \(x\) component of its displacement?
-
You walk \(3.2 \mathrm{~km}\) to the supermarket and then back home. What is your distance traveled? What is your displacement?
Study smarter with the SolutionInn App