[P2] runs the loops in a way that access elements of A in r ow major order and [P2] accesses elements in column major order.
No of cache blocks = Cache Size/Block Size
= 32KB / 128 Byte = 256
No. of array elements in Each Block
= Block Size/Element Size
= 128 Byte / 8 Byte = 16
Total Misses for [P1] = ArraySize * (No. of array elements in Each Block) / (No of cache blocks) = 512 * 512 * 16/256
= 16384
No of cache blocks = Cache Size/Block Size
= 32KB / 128 Byte = 256
No. of array elements in Each Block
= Block Size/Element Size
= 128 Byte / 8 Byte = 16
Total Misses for [P1] = ArraySize * (No. of array elements in Each Block) / (No of cache blocks) = 512 * 512 * 16/256
= 16384

