Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code to be used: The following code written in STL Language, implements searching of an element (key) in an array using linear search technique. program
code to be used: The following code written in STL Language, implements searching of an element (key) in an array using linear search technique. program LinearSearch var a array(50) byte writeln("Array Elements: ") for n=0 to 11 a(n)=n writeln(a(n)) next key =9 writeln("Key to be searched: ",key) found =0 for n=0 to 11 temp =a(n) if temp = key then found =1 writeln("Key Found",temp) break end if next if found 1 then writeln("Key Not Found") end if end Teneral procedure to convert the given STL rogram into ALP: - Open CPU OS Simulator. Go to General procedure to convert the given STL program into ALP: - Open CPU OS Simulator. Go to advanced tab and press compiler button - Copy the above program in Program Source window - Open Compile tab and press compile button - In Assembly Code, enter start address and press Load in Memory button - Now the assembly language program is available in CPU simulator. - Set speed of execution to FAST. - Open I/O console - To run the program press RUN button. General Procedure to use Cache set up in CPU-OS simulator - After compiling and loading the assembly language code in CPU simulator, press "Cache-Pipeline" tab and select cache type as "both". Press "SHOW CACHE" button. - In the newly opened cache window, choose appropriate cache Type, cache size, set blocks, replacement algorithm and write back policy. Page break Part I: Direct Mapped Cache a) Execute the above program by setting block size to 2, 4, 8, 16 and 32 for cache size =8,16 and 32. Record the observation in the following table. b) Plot a single graph of Cache hit ratio Vs Block size with respect to cache size =8,16 and 32. Comment on the graph that is obtained. b) Plot a single graph of Cache hit ratio Vs Block size with respect to cache size =8,16 and 32. Comment on the graph that is obtained. c) Fill the below table and write a small note on your observation from the data cache. - Block Size =4 - Cache Size =8 - Cache Type = Direct Mapped Part II: Associative Mapped Cache a) Execute the above program by setting block size to 2, 4, 8, 16 and 32 for cache size =8,16 and 32. Record the observation in the following table. Mapped Cache a) Execute the above program by setting block size to 2, 4, 8, 16 and 32 for cache size =8,16 and 32. Record the observation in the following table. b) Plot a single graph of Cache hit ratio Vs Block size with respect to cache size =8, 16 and 32. Comment on the graph that is c) Fill up the following table for three different replacement algorithms and state which replacement algorithm is better and why? Replacement Algorithn d) Plot the graph of Cache Hit Ratio Vs Cache size with respect to different replacement algorithms. Comment on the graph that is obtained. Part 11: Set Associative Mapped Cache Execute the above program by setting the following Parameters: - Number of sets (Set Blocks): 2 way - Cache Type: Set Associative - Replacement: LRU/FIFO/Random a) Fill up the following table for three different replacement algorithms and state which replacement algorithm is better and why? b) Plot the graph of Cache Hit Ratio Vs Cache size with respect to different replacement algorithms. Comment on the graph that is obtained. c) Fill in the following table and analyse the behaviour of Set Associate Cache. Which one is better and why
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started