To compute the RAM size for the orders M, N, and O, we need to calculate the total memory required to store the chunks of A, B, and C.
Given:
Size of A = 2000
Size of B = 600
Size of C = 750, 2000
Size of each chunk:
Chunk size of A = 400
Chunk size of B = 150
Chunk size of C = 250
- RAM size for order M:
The order M sequentially scans chunks of A, so we need to calculate the total memory required to store all the chunks of A.
Total chunks of A = Size of A / Chunk size of A = 2000 / 400 = 5
RAM size for order M = Total chunks of A * Chunk size of A = 5 * 400 = 2000
Therefore, the RAM size for order M is 2000.
- RAM size for order N:
The order N scans chunks of A and B in a pattern. We need to find the maximum number of simultaneous chunks of A and B that can be stored in memory.
Total chunks of A = Size of A / Chunk size of A = 2000 / 400 = 5
Total chunks of B = Size of B / Chunk size of B = 600 / 150 = 4
Maximum simultaneous chunks of A and B = min(Total chunks of A, Total chunks of B) = min(5, 4) = 4
RAM size for order N = Maximum simultaneous chunks of A and B * (Chunk size of A + Chunk size of B) = 4 * (400 + 150) = 2000
Therefore, the RAM size for order N is 2000.
- RAM size for order O:
The order O interweaves the chunks of A, B, and C. We need to find the maximum number of simultaneous chunks of A, B, and C that can be stored in memory.
Total chunks of A = Size of A / Chunk size of A = 2000 / 400 = 5
Total chunks of B = Size of B / Chunk size of B = 600 / 150 = 4
Total chunks of C = Size of C / Chunk size of C = 750 / 250 = 3
Maximum simultaneous chunks of A, B, and C = min(Total chunks of A, Total chunks of B, Total chunks of C) = min(5, 4, 3) = 3
RAM size for order O = Maximum simultaneous chunks of A, B, and C * (Chunk size of A + Chunk size of B + Chunk size of C) = 3 * (400 + 150 + 250) = 3000
Therefore, the RAM size for order O is 3000.
To determine the best order among M, N, and O in order to scan chunks in cuboids computation, we should choose the order with the smallest RAM size requirement. In this case, both orders M and N have a RAM size of 2000, while order O has a RAM size of 3000. Therefore, the best order would be either M or N.