#+title: Cache coherency protocol and eviction policy simulation #+subtitle: MESIF-LRU #+date: 2024H1 * Task :PROPERTIES: :CUSTOM_ID: task :END: #+begin_note This is a machine translation.[fn:1] #+end_note What needs to be done? Implement a model that demonstrates the operation of the memory subsystem in a symmetric multiprocessor system. As a reference, you can use the following demonstrator: https://www.scss.tcd.ie/Jeremy.Jones/vivio/caches/MESIHelp.htm -- this shows the operation of the MESI protocol with a direct‑mapped cache and without replacement policies. The conditions of your work are more complex: 1) the cache coherence protocol and replacement policy are determined 2) the number of processors in the system is 4; 3) the amount of main memory is 16 addressable cells of 1 byte each; 4) the size of the memory and cache line is 1 byte; 5) the number of cache lines is 4; 6) the cache associativity is 2. You determine all the necessary attributes for fixing and updating the time of the last access to a row or the frequency of access to it yourself. In all cases, the time unit is the clock cycle. The model must display: 1) the contents and address of each main memory cell; 2) tag, data, and state of each cache line (possible states determined by the protocol from your option); 3) Replacement policy metric counter for each cache line; 4) requests via the address, data, and status buses and responses to them (schematically, as in the reference model, without commenting on each request and response); 5) a common machine time clock counter from the moment of startup or reset. Control commands received from the user: for each processor, read and write operations on memory at the specified (selected) address, a general reset of the model’s state, the ability to “advance” manually through the clock cycles. Please note that the reference model implements the ability to perform operations on multiple processors simultaneously -- your model should also implement this. The initial state of the caches is that all lines are empty; the initial state of the memory is that all cells contain the value "0". By analogy with the reference model, the write operation increments the value by "1". Programming languages, frameworks, visualization tools -- any, as long as I can run your application on my work PC. If this requires any additional software, it would be better to package everything in the form of a virtual machine image or container. Beautiful animation, coloring, and other decorations are not required and will not be taken into account when evaluating the work. The work must be accompanied by a report. In addition to the substantive part, the report must indicate how the tasks are distributed among the members of the working group (this can be done in the conclusion or in the appendix). * Documentation :PROPERTIES: :CUSTOM_ID: documentation :END: The report has been lost to time, but I'm sure there was nothing interesting in it. * Showcase :PROPERTIES: :CUSTOM_ID: showcase :END: The CPU blocks allow you to issue commands: read, increment (read+write) or write (random byte), to a specific address. The whole timeline is being saved and you can scrub through it, go back in time and change the future. Bus access is animated through interpolation. #+caption: Initial state #+attr_html: :width 100% [[https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/init.png][https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/init.png]] #+caption: Increment (read+write) and read at the same time #+attr_html: :width 100% [[https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/ir.png][https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/ir.png]] #+caption: Write random byte #+attr_html: :width 100% [[https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/w.png][https://git.michalec.dev/uni/term-04/supercomp-arch/coursework/w.png]] * Unlicense :PROPERTIES: :CUSTOM_ID: unlicense :END: #+include: UNLICENSE verse * Footnotes :PROPERTIES: :CUSTOM_ID: footnotes :END: [fn:1] Original text: #+HTML: #+begin_quote Что нужно сделать? Реализовать модель, демонстрирующую работу подсистемы памяти в симметричной многопроцессорной системе. В качестве эталона можно использовать такой демонстратор: https://www.scss.tcd.ie/Jeremy.Jones/vivio/caches/MESIHelp.htm -- здесь показана работа протокола MESI с кэшем прямого отображения и без политик замещения. Условия вашей работы более сложные: 1) протокол кэш-когерентности и политика замещения определяются выбранным вариантом; 2) число процессоров в системе -- 4; 3) объем основной памяти -- 16 адресуемых ячеек по 1 байт; 4) размер строки памяти и кэша -- 1 байт; 5) число строк кэша -- 4; 6) ассоциативность кэша -- 2. Все необходимые атрибуты для фиксации и обновления времени последнего обращения к строке или частоты обращения к ней вы определяете самостоятельно, единицей времени во всех случаях является такт машинного времени. Модель обязательно должна отображать: 1) содержимое и адрес каждой ячейки основной памяти; 2) тэг, данные и состояние каждой строки кэша (возможные состояния определяются протоколом из вашего варианта); 3) счётчик метрики политики замещения для каждой строки кэша; 4) запросы по шинам адреса, данных, состояний и ответы на них (схематично, как в эталонной модели, без комментирования каждого запроса и ответа); 5) общий счётчик тактов машинного времени с момента запуска или сброса. Команды управления, принимаемые от пользователя: для каждого процессора операции чтения и записи памяти по указанному (выбранному) адресу, общий сброс состояния модели, возможность «продвижения» по тактам вручную. Обратите внимание, что в эталонной модели реализована возможность выполнять операции на нескольких процессорах одновременно -- в вашей модели это тоже должно быть реализовано. Начальное состояние кэшей -- все строки пусты, начальное состояние памяти -- все ячейки содержат значение «0». По аналогии с эталонной моделью операция записи выполняет инкремент значения на «1». Языки программирования, фрэймворки, средства визуализации -- любые, лишь бы я мог запустить ваше приложение на своём рабочем ПК. Если для этого потребуется какое-то дополнительно ПО -- лучше будет собрать всё в виде образа виртуальной машины или контейнера. Красивая анимация, раскрашивание и другие декорации не требуются и не принимаются в расчёт при оценивании работы. Работа должна сопровождаться отчётом. В отчёте, помимо содержательной части, должно быть указано распределение задач по участникам рабочей группы (это можно сделать в заключении или в приложении). #+end_quote #+HTML: