logo

Crowdly

Consider the following two pieces of pseudocode: // CODE 1: const int N ...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Consider the following two pieces of pseudocode:

// CODE 1: 

const int N = ...;

int X

[ n ] , Y [ N ] ; // (sizeof(int) = 1 word)

for ( int i = 0 ; i < N ; i ++ )

    Y

[ i ] = X [ i ] + i ;

// CODE 2:

const int N = ...;

int X

[ N ] , Y [ N ] ; // (sizeof(int) = 1 word)

for ( int i = 0 ; i < N ; i ++ )

    Y

[ i ] = X [ 0 ] + i ;

 

  • Let us illustrate, in general, the concepts of spatial and temporal locality in the execution of programs.
  • Which of the two code fragments exhibits greater locality of each kind?
  • What happens if the processor wants to access a memory word already present in the cache? And what happens if it isn't present?
  • What parameters should be considered when evaluating the performance of cache memories?
  • In a cache-based architecture, which of the two code fragments results in a greater number of cache hits?

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на informatica.i-learn.unito.it?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome