Can someone please help and explain the C code that I would need for this. I am new to C and would like some help. I also do not know how to check the storage for the cache on my microsoft surface 2 computer. Define Data Structures Large Arrays: Define a large array in memory. The size should be chosen based on the cache size of the target processor. Choose a size that is larger than the L3 cache of the processor. You will need to look up the sizes of the L1, L2, and L3 for the processor you are using. Access Area: Access areas within the L1, L2, L3, and larger than the L3 cache. You must read memory the same number of times for each, but simply access more memory for each. Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.For example if the L1 cache is 1K, then access the within the 1K 1000 times. If the L2 cache is 10K, then access within the 10K 100 times.. Both are accessing 1,000,000 bytes of memory, Access Pattern Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits. Measure Time High-Resolution Timer: Utilize processor-specific instructions to access a high-resolution timer. Record the start and end time for accessing each array.
Can someone please help and explain the C code that I would need for this. I am new to C and would like some help. I also do not know how to check the storage for the cache on my microsoft surface 2 computer. Define Data Structures Large Arrays: Define a large array in memory. The size should be chosen based on the cache size of the target processor. Choose a size that is larger than the L3 cache of the processor. You will need to look up the sizes of the L1, L2, and L3 for the processor you are using. Access Area: Access areas within the L1, L2, L3, and larger than the L3 cache. You must read memory the same number of times for each, but simply access more memory for each. Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.For example if the L1 cache is 1K, then access the within the 1K 1000 times. If the L2 cache is 10K, then access within the 10K 100 times.. Both are accessing 1,000,000 bytes of memory, Access Pattern Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster. Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits. Measure Time High-Resolution Timer: Utilize processor-specific instructions to access a high-resolution timer. Record the start and end time for accessing each array.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Can someone please help and explain the C code that I would need for this. I am new to C and would like some help. I also do not know how to check the storage for the cache on my microsoft surface 2 computer.
Define Data Structures
- Large Arrays: Define a large array in memory. The size should be chosen based on the cache size of the target processor. Choose a size that is larger than the L3 cache of the processor.
- You will need to look up the sizes of the L1, L2, and L3 for the processor you are using.
Access Area:
- Access areas within the L1, L2, L3, and larger than the L3 cache.
- You must read memory the same number of times for each, but simply access more memory for each.
-
- Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster.
- Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.For example if the L1 cache is 1K, then access the within the 1K 1000 times. If the L2 cache is 10K, then access within the 10K 100 times.. Both are accessing 1,000,000 bytes of memory,
Access Pattern
- Sequential Access: Access the elements of the first array sequentially. This pattern benefits from spatial locality, as once a cache line (containing a part of the array) is loaded into the cache, subsequent accesses to nearby elements will be faster.
- Random: Access the elements of the second array in a random or strided manner. This can be done by jumping over several elements each time, effectively skipping cache lines and reducing cache hits.
Measure Time
- High-Resolution Timer: Utilize processor-specific instructions to access a high-resolution timer. Record the start and end time for accessing each array.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education