SMPCache GettingStarted
SMPCache GettingStarted
1/24
Getting Started with SMPCache 2.0
1. Introduction
SMPCache is a trace-driven simulator for cache memory systems on symmetric
multiprocessors (SMPs) which use bus-based shared memory. This simulator operates on PC
systems with Windows, and it offers a Windows typical graphic interface.
Some of the parameters you can study with the simulator are: program locality;
influence of the number of processors, cache coherence protocols, schemes for bus arbitration,
mapping, replacement policies, cache size (blocks in cache), number of cache sets (for set
associative caches), number of words by block (block size), ...
Because of its easy and user-friendly interface, the simulator is recommended for
teaching purposes; since it allows to observe, in a clear and graphic way, how the
multiprocessor evolves as the execution of the programs goes forward (the memory traces are
read).
1.1. Prerequisites
To make sense of the rest of Getting Started with SMPCache, you should be familiar
with some theoretical considerations concerning cache memory systems, and particularly
regarding their use in multiprocessor environments. These concepts are widely discussed in
many computer architecture texts (like the William Stallings’ Computer Organization and
Architecture), and we will not mention them here. All operations and algorithms we use are
similar to those found in these computer architecture texts. As a consequence, the results
obtained with the simulator are very close to the real world.
1.2. Suggestions?
If you have comments about this guide to SMPCache or about the simulator, please
contact Miguel A. Vega at [email protected] (Fax: +34-927-257202) or at the following
address:
Miguel A. Vega-Rodríguez
Dept. de Informática, Univ. de Extremadura, Escuela Politécnica
Campus Universitario s/n. 10071. Cáceres. España (Spain)
2. Installation
In order to begin the installation you must execute the Setup.exe program included in
your copy of SMPCache. Then, follow the directions below and on the screen during the
installation process:
1. Exit all Windows applications prior to continuing with the installation.
2. When the “Welcome” screen appears, read it. Click Next to continue.
2/24
Getting Started with SMPCache 2.0
Once installation is complete, a SMPCache group, which includes the application icon,
is created. You can then create a shortcut to SMPCache on your desktop.
)Remember: If for any reason you wish to stop the installation, click Cancel and the
installation of SMPCache will be terminated.
3. Configuration Files
The simulator allows you to select the different choices for configuring a given
architecture (see Table 1). The different choices selected may be stored on an ASCII data file
3/24
Getting Started with SMPCache 2.0
(configuration file, which has the extension “.cfg”) for future loading, so the need to make
many selections for configuring the same architectural model is avoided.
Processors in SMP 1, 2, 3, 4, 5, 6, 7 or 8
Cache coherence protocols MSI, MESI or DRAGON
Schemes for bus arbitration Random, LRU or LFU
Word wide (bits) 8, 16, 32 or 64
Words by block 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 or 1024
Blocks in main memory 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
4096, 8192, 16384, 32768, 65536, 131072, 262144,
524288, 1048576, 2097152 or 4194304
Blocks in cache 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 or 2048
Mapping Direct, Set-Associative or Fully-Associative
Cache sets (for set associative caches) 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 or 2048
Replacement policies Random, LRU, FIFO or LFU
Writing strategies Write-Back (for cache coherence protocols)
Cache levels in the memory hierarchy 1
References To memory words
Maximum block size 8 KB
Maximum main memory size 32 GB
Maximum cache size (excluded labels, 16 MB
block state bits, counts, etc.)
Table 1: Architectural characteristics supported by SMPCache.
The configuration files have the format presented in Figure 1. As we can see, the
“comments” (indicating what is configured) appear in the even lines, and the choices in the
odd ones.
Processors in SMP:
3
Cache coherence protocol:
2
Scheme for bus arbitration:
1
Word wide (bits):
64
Words by block:
128
Blocks in main memory:
1024
Blocks in cache:
64
Mapping:
3
Number of cache sets:
0
Replacement policy:
2
Cache levels:
1
Writing strategy:
2
Figure 1: Configuration file.
4/24
Getting Started with SMPCache 2.0
In the case of numerical configurations as the number of processors, the word wide, the
words by block,... the numerical configuration itself is written in the file. For the rest of
configurations, a numerical code is assigned to each one of the possible options. Table 2
shows the configuration options and their associated numerical codes.
Although the cache levels and the writing strategy are not configurable, they must also
appear in the configuration files, for facilitating possible future extensions.
4. Trace Files
For working with the simulator, it is necessary to use data files with the “calls” and
memory addresses demanded by the processors during the execution of a program: the named
memory traces. The trace files will allow you to emulate the programs to process for the
different processors in your SMP. These ASCII data files (trace files, which have the
extension “.prg”) consist of lines, each one has two numbers, separated by only one white
space:
Label Value
Where:
• Label is a decimal number that identifies the memory access operation type
demanded by the processor (CPU), in a given time, according to the instruction
program: to capture an instruction (0), to read a memory data (2) or to write a data
in memory (3).
• Value is an hexadecimal number that indicates the effective address of the
memory word to be accessed by the processor (CPU). This address will be
5/24
Getting Started with SMPCache 2.0
translated by the simulator for locating the word in the memory system block
structure.
5. Interface Overview
Once installation is complete (see section 2), you can load SMPCache by clicking on its
icon. The first screen you will see is shown in Figure 3, which contains a menu bar, a tool
button bar, a configuration panel, and a status bar. We will explain all these components in the
following sections.
Menu Bar Tool Bar Configuration Panel
6/24
Getting Started with SMPCache 2.0
6. Menu Bar
The menu bar is located just above the tool button bar. It contains drop-down menus
that list various commands. Commands followed by ellipses (...) indicate that a dialog box
opens upon selecting the command. As we can see in Figure 4, the menu bar contains the
following menus: File, Configure, View, Simulate, and Help (?).
7/24
Getting Started with SMPCache 2.0
To list the files of the type you need, make sure that the required Disk and Path are
current, and then select the appropriate File type (*.cfg). Then, set the File name to select a
configuration file, and click on the OK button.
If you do not remember the name of the configuration file exactly, the Data (word wide,
block size, cache size, etc.) shown on the right part of the dialog box can help you.
)Remember: You can also press F3 to select this command, and open a
configuration file.
Indicate the Disk and Path in which to save the current configuration, and then select the
appropriate File type (*.cfg). You can double click a folder in the list box to see what is inside
of it. Finally, type the File name in which to save the current configuration, and click on the
OK button.
)Remember: You can also press F2 to select this command, and save in a file the
current configuration.
8/24
Getting Started with SMPCache 2.0
To list the files of the type you need, make sure that the required Disk and Path are
current, and then select the appropriate File type (*.prg). Then, set the File name to select a
trace file, and indicate in what active processors it will be loaded (Load in processors).
Finally, click on the OK button.
If you do not remember the exact name of the trace file, the Data (number of
instructions, and memory accesses) shown on the right part of the dialog box can help you.
)Remember: You can also press Alt+F2 to select this command, and load memory
traces in the active processors.
6.1.4. Exit
This command allows you to exit SMPCache. You will be prompted to confirm that you
really want to quit the simulator.
)Remember: You can also press Alt+F4 to select this command, and quit
SMPCache.
9/24
Getting Started with SMPCache 2.0
6.2.1. Multiprocessor
This command allows you to configure general aspects of your multiprocessor. Figure
10 displays the dialog box opened upon selecting this command.
In order to update the current configuration you must select the appropriate
configuration for the shown parameters (Number of processors, Coherence protocol, and Bus
arbitration), and then click on the OK button. The Default button sets the default values in
these configuration parameters. Table 3 presents the configuration parameters, their possible
values and their default values.
)Remember: You can also press Ctrl+P to select this command, and configure the
general aspects of the multiprocessor.
10/24
Getting Started with SMPCache 2.0
In order to update the current configuration you must select the appropriate
configuration for the shown parameters (Word wide, Words by block, and Blocks in main
memory), and then click on the OK button. The Default button sets the default values in these
configuration parameters. The “Block size” and “Main memory size” parameters are
computed automatically. Table 4 presents the configuration parameters, their possible values
and their default values.
In conclusion, the maximum block size is 8 KB, and the maximum main memory size is
32 GB. By default, the block size is 1 KB, and the main memory size is 1 MB.
)Remember: You can also press Ctrl+M to select this command, and configure the
main memory of the multiprocessor.
11/24
Getting Started with SMPCache 2.0
6.2.3. Caches
This command allows you to configure the caches associated to each processor in the
SMP. All the caches will have the same configuration. Figure 12 presents the dialog box
opened upon selecting this command.
In order to update the current configuration you must select the appropriate
configuration for the shown parameters (Blocks in cache, Mapping, Number of cache sets,
and Replacement policy), and then click on the OK button. The Default button sets the default
values in these configuration parameters. The “Cache size” parameter is computed
automatically, using the Blocks in cache and the Block size (section 6.2.2). The “Cache
levels” (1) and “Writing strategy” (Write-Back) parameters are not configurable, but they also
appear for facilitating possible future extensions.
All the configuration parameters are related among themselves according to the
theoretical models. If you make a choice that contradicts other parameters, the simulator
warns you, and blocks the choice. Table 5 shows the configuration parameters, their possible
values and their default values.
In conclusion, the maximum cache size is 16 MB (because the maximum block size is 8
KB, see section 6.2.2). By default, the cache size is 64 KB (excluded labels, block state bits,
counts, etc.).
12/24
Getting Started with SMPCache 2.0
)Remember: You can also press Ctrl+C to select this command, and configure the
caches associated to each processor in the multiprocessor.
)Remember: You can also press Ctrl+I to select this command, and save the current
configuration of the system as preset configuration.
)Remember: You can also press F7 to select this command, and perform a step-by-
step simulation.
13/24
Getting Started with SMPCache 2.0
)Remember: You can also press F5 to select this command, and perform a
simulation with breakpoints.
)Remember: You can also press F9 to select this command, and perform a complete
simulation.
14/24
Getting Started with SMPCache 2.0
considered as PrRd requests. The read or write could be to a memory block that exists in the
cache or to one that does not. We represent the cache hits with a red asterisk (*).
The block transfers will be labelled with the “Block XXX” text. Where XXX will be the
block address in main memory. In Figure 15, after the BusRdX transaction, the main memory
supplies the memory block 273.
If you use MESI or DRAGON coherence protocol the value for the shared signal is also
shown. This signal will be “YES” whether there are any other processors caching the memory
block referenced in a bus transaction.
The simulator also shows, in this window, interesting statistical data like:
• Number of bus transactions.
• Number of block transfers on the bus.
• Number of state transitions (it depends on cache coherence protocol).
• Number of state transitions from a particular state to other.
• Global number of memory accesses, and for types: instruction captures, data
readings and data writings.
• Number of cache hits and misses, as well as the hit and miss rate.
In order to start the simulation click on the Execute button. You can abort the
simulation at any time (for example, in order to correct any architectural detail) clicking on
15/24
Getting Started with SMPCache 2.0
the Exit button. The numerical edit box allows you to put a breakpoint (the memory access in
which the simulation must stop automatically). This edit box can be only used in a simulation
with breakpoint. Finally, the Stop button allows you to stop (pause) immediately a simulation
with breakpoint or a complete simulation. In order to continue that simulation or a step-by-
step simulation click on the Continue button.
)Remember: You can also press Ctrl+E to select this command, and observe a
global vision of the multiprocessor evolution.
You can select the cache to study (it must be a cache whose processor has an associated
trace file) and the format in which the data will be shown (text or graphic format), then click
on the OK button.
If you choose text format, the window presented in Figure 17 will be opened. In this
window, the state of the cache under study is always displayed. This state includes the
number of cache (processor), the number of blocks in cache, the state of every memory block
within this cache, etc. The main data of the current access to this cache are also presented:
access number within the associated trace file, access type, effective address of the memory
word to be accessed by the processor, ...
The simulator also displays, in this window, interesting statistical data regarding this
specific cache like:
• Number of bus transactions generated by this cache.
• Number of block transfers on the bus.
• Number of state transitions in this cache (it depends on cache coherence protocol).
16/24
Getting Started with SMPCache 2.0
In order to start the simulation click on the Execute button. You can abort the
simulation at any time (for example, in order to correct any architectural detail) clicking on
the Exit button. The numerical edit box allows you to put a breakpoint (the memory access in
which the simulation must stop automatically). This edit box can be only used in a simulation
with breakpoint. Finally, the Stop button allows you to stop (pause) immediately a simulation
with breakpoint or a complete simulation. In order to continue that simulation or a step-by-
step simulation click on the Continue button. Figure 18 presents the dialog box opened upon
clicking on the Trace button.
In this dialog box, you can obtain detailed information about the memory trace
associated with that cache (processor): name of the trace file, memory accesses within the
trace, etc. In order to get the main data (access number within the trace file, access type, ...) of
any memory access within the trace click on the desired access.
17/24
Getting Started with SMPCache 2.0
If you choose graphic format in the dialog box of Figure 16, the window presented in
Figure 19 will be opened.
In this window, the simulator shows, using several graphics, interesting measurements
regarding that specific cache like:
18/24
Getting Started with SMPCache 2.0
All these graphs indicate in their X axis the memory access for which that value in their
Y axis is obtained.
The buttons in this window have the same use as for the case of text format (Figure 17).
)Remember: You can also press Ctrl+H to select this command, and observe the
evolution of a particular cache in text or graphic format.
You can select the main memory block to study and the desired vision level: inside the
multiprocessor or inside a specific cache (it must be a cache whose processor has an
associated trace file). Then click on the OK button.
If you choose the multiprocessor vision, the window presented in Figure 21 will be
opened. This window is very similar to the one shown when the “Multiprocessor evolution”
command was explained (section 6.4.1). The great difference is that, in this case, the shown
data are not the totals of the complete system, but the totals of the memory block under
evaluation (in Figure 21, the main memory block 17). Only the data related with that block
are shown. In conclusion, you can see the state of that block inside every cache in the
multiprocessor, the memory accesses to that block, and for types (instruction captures, data
readings and data writings), and so on. For a more detailed explanation see section 6.4.1.
19/24
Getting Started with SMPCache 2.0
If you choose the cache vision in the dialog box of Figure 20, the window presented in
Figure 22 will be opened.
20/24
Getting Started with SMPCache 2.0
In this window, the evolution of the memory block under study inside a particular cache
is always displayed. This evolution is represented using the state transition diagram for that
block (it depends on cache coherence protocol). The state-transition diagram takes as inputs
the current block state and the processor request or observed bus transaction, and produces as
output the next state for the cache block. In this diagram, the notation A/B means if you
observe from processor-side or bus-side event A, then in addition to state change, generate
bus transaction or action B. For example, in Figure 22 for the MESI cache coherence
protocol, on a processor write (PrWr) a BusRdX transaction is generated, and upon
completion of this transaction the block transitions up to the “M” state.
This window also indicates the main memory block and cache (processor) under study,
and the main data of the last access to that block inside that processor (cache): access number
within the associated trace file, access type, effective address of the memory word to be
accessed by the processor, ...
The rest of data shown in this window have the same explanation as for the
multiprocessor vision case (Figure 21). The main difference is that, in this case, the shown
data are regarding that memory block and that specific cache.
In order to start the simulation click on the Execute button. You can abort the
simulation at any time (for example, in order to correct any architectural detail) clicking on
the Exit button. The numerical edit box allows you to put a breakpoint (the memory access in
which the simulation must stop automatically). This edit box can be only used in a simulation
with breakpoint. Finally, the Stop button allows you to stop (pause) immediately a simulation
with breakpoint or a complete simulation. In order to continue that simulation or a step-by-
step simulation click on the Continue button.
)Remember: You can also press Ctrl+B to select this command, and observe the
evolution of a specific memory block.
21/24
Getting Started with SMPCache 2.0
)Remember: You can also press F1 to select this command, and obtain help about
the use of the simulator (menus, commands, ...).
)Remember: You can also press Alt+F1 to select this command, and obtain help
with the main theoretical concepts about caches in SMPs.
6.5.3. About
This command allows you to obtain general information about SMPCache (authors,
version number, etc.).
)Remember: You can also press Ctrl+F1 to select this command, and obtain general
information about the simulator.
7. Tool Bar
The tool button bar is located underneath the menu bar (described in the previous
sections). The tool bar allows you to quickly access the most common commands in
SMPCache (Figure 24).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
22/24
Getting Started with SMPCache 2.0
8. Configuration Panel
The configuration panel is located on the right of the application window (Figure 25).
This panel allows you to select the different choices for configuring a given architecture.
Therefore, it has a similar use to the Configure menu (section 6.2).
23/24
Getting Started with SMPCache 2.0
The Configuration panel has four tabs: Information, Multiprocessor, Main memory, and
Caches. The Information tab shows general information about the current configuration. The
rest of tabs are very similar to the commands in the Configure menu.
)Remember: In the Configuration panel, the OK, Cancel and Default buttons are
represented by icons at the bottom of the panel.
9. Status Bar
The status bar is located at the bottom of the application window. It displays different
information messages. For example, when you place the cursor over a tool button or a menu
command, the status bar displays a short description of the functionality of that tool button or
menu command.
Furthermore, the status bar always displays the date and time of the system.
24/24