Initial commit -- w4 status report

This commit is contained in:
Zhengyi Chen 2023-10-09 00:25:28 +01:00
commit e02b750ff0
15 changed files with 1650 additions and 0 deletions

301
tex/.gitignore vendored Normal file
View file

@ -0,0 +1,301 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

28
tex/README.md Normal file
View file

@ -0,0 +1,28 @@
# Template for Informatics UG final-year projects
Please base your project report on `skeleton.tex`, reading the instructions in
that example file carefully.
To compile the `skeleton.pdf` report, with all cross-references resolved:
```
pdflatex skeleton.tex
bibtex skeleton.aux
pdflatex skeleton.tex
pdflatex skeleton.tex
```
Many TeX distributions have (or can install) a `latexmk` command that will
automatically compile everything that is needed:
```
latexmk -pdf skeleton.tex
```
If the logo causes compilation problems (errors related to `eushield`), it isn't
necessary, you may remove the `logo` option from the first line of code.
Although check first that you are using `pdflatex` or the `-pdf` option above.
As directed in `skeleton.tex` do not change other template or layout options.
Occassionally latex gets really confused by errors, and intermediate files need
to be deleted before the report will compile again. We strongly recommend that
you keep your files in version control so that you can unpick any problems.
Remember also to keep off-site backups.

BIN
tex/eushield-normal.pdf Normal file

Binary file not shown.

54
tex/eushield.sty Normal file
View file

@ -0,0 +1,54 @@
%% eushield.sty -- commands to manipulate the inclusion of the EU shield
%% graphic.
%%
%% Version 1.0 [2000/11/23] -- initial version
%% Version 1.1 [2006/08/28] -- fixed PDF detection for teTeX 3
%%
%% Mary Ellen Foster <M.E.Foster@ed.ac.uk>
\def\filedate{2006/08/28}
\def\fileversion{1.1}
\ProvidesPackage{eushield}[\filedate\ v\fileversion\
Commands for including the EU shield graphic]
\RequirePackage{graphics}
\RequirePackage{ifpdf}
%% Possible values for shieldtype:
%% 0: regular monochrome
%% 1: monochrome with no background lines
%% 2: reverse monochrome
%% 3: two colours: navy and red
%% 4: full colour
\newcommand{\eushield}{}
\newcommand{\@endspecial}{}
\newcommand{\shieldtype}[1]{%
\def\@shieldtype{#1}
\ifpdf
\ifnum\@shieldtype=0
\renewcommand{\eushield}{eushield-normal}
\else\ifnum\@shieldtype=1
\renewcommand{\eushield}{eushield-noback}
\else\ifnum\@shieldtype=2
\renewcommand{\eushield}{eushield-reversed}
\else\ifnum\@shieldtype=3
\renewcommand{\eushield}{eushield-twocolour}
\else\ifnum\@shieldtype=4
\renewcommand{\eushield}{eushield-fullcolour}
\fi\fi\fi\fi\fi
\else
\renewcommand{\eushield}{eushield}
\renewcommand{\@endspecial}{%
\special{!/crestversion #1 def}}
\fi
}
\shieldtype{0}
\newcommand{\includeshield}{%
\includegraphics{\eushield}}
\ifpdf
\else
\AtBeginDocument{\@endspecial}
\fi

698
tex/infthesis.cls Normal file
View file

@ -0,0 +1,698 @@
%%
%% File : infthesis.cls (LaTeX2e class file)
%% Author : Version 3.8 by Sharon Goldwater <sgwater@inf.ed.ac.uk>
%% Version 3.7 updated by Jennifer Oxley <joxley@inf.ed.ac.uk>
%% Version 3.6 by Charles Sutton <csutton@inf.ed.ac.uk>
%% Version 3.5 by Vasilis Vasaitis <v.vasaitis@sms.ed.ac.uk>
%% Version 3.4.1 updated by Tiejun Ma (t.j.ma@ed.ac.uk)
%% Version 3.0 by Mary Ellen Foster <mef@cogsci.ed.ac.uk>
%% Original version by Martin Reddy (mxr@dcs.ed.ac.uk)
%% Version : 3.8
%% Updates : 1.0 [9/11/95] - initial release.
%% 1.1 [24/4/96] - fixed bibliography bug caused by new report.cls
%% 1.2 [13/5/96] - \dedication & \thesiscaption[]
%% 1.3 [28/5/96] - abbrevs, parskip, minitoc fix, \headfootstyle
%% 1.4 [12/7/96] - appendices okay now, \cleardoublepage's added
%% 1.45 [6/8/96] - added space between chapter & numb on toc
%% 1.5 [13/8/96] - tailmargin was too small by 0.7cm!!
%% 2.0 [20/9/96] - \SetPrinter for margin settings (default=hp24)
%% no header, more abbreviations
%% 3.0 [16/10/2000] - Changed name and some formatting to become
%% "infthesis" instead
%% 3.1 [20/10/2000] - Added sans-serif running heads
%% Added pslatex by default (unless "cmfonts")
%% Added back in the code to create empty pages
%% on cleardoublepage (from titlesec.sty)
%% 3.2 [13/11/2000] - Changed name of font-setting commands
%% - Changed name of shield input file
%% 3.3 [23/11/2000] - Use the new and improved shield graphic
%% 3.4 [23/11/2000] - Political changes... also fixed a problem
%% with the margins on two-sided documents.
%% 3.4.1[09/03/2006] -add [a4paper] parameter for geometry package
%% 3.5 [02/02/2011] - fix double-sided margins with modern
%% versions of the geometry package
%% 3.6 [15/03/2012] - addition to support the MInf degree
%% 3.7 [07/02/2013] - fix MInf definition
%% 3.8 [06/06/2019] - added support for MSc degrees:
%% adi, datasci, di, cyber
%% This file contains a class definition, infthesis, for the LaTeX2e
%% system which defines the layout of theses which are submitted in
%% the School of Informatics at the University of Edinburgh.
%%
%% For information on this class, please refer to "texdoc infthesis"
%%
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesClass{infthesis}[2013/02/07 v3.7 School of Informatics Thesis Class]
%%
%% --- Initial Code ---
%%
%% Required packages:
%% - ifthen for conditionals
%% - geometry for margin-setting
%% - graphics for including the (scaled) logo on the front page
%% - xspace if abbreviations are used
\usepackage[paper=a4paper]{geometry}
\RequirePackage{ifthen,%
graphics,%
xspace,
eushield}
%%%% The following packages are also used but are included further on rather
%%%% than here, either because their options depend on the class options or
%%%% because they only need to be loaded in certain cases.
%% - parskip for alternate formatting of paragraphs
%% - tocbibind to put LOF and LOT into table of contents
%% - sectsty to change format of section headers
%% - caption to change format of captions
%% - pslatex to set default fonts (if they don't specify notimes)
%% Default values for various fields
\newcommand{\@degreetext}{}
\newcommand{\@infschool}{School of Informatics}
\newcommand{\@university}{University of Edinburgh}
\newcommand{\@chapteralignment}{\centering}
\newcommand{\@chapterfont}{}
\newcommand{\@thesisside}{}
\newcommand{\@thesisopen}{}
\newcommand{\@thesispoints}{}
\newcommand{\@draftmessage}{}
%% Lots of boolean things to keep track of options
\newboolean{draftthesis}
\newboolean{usequotemarks}
\newboolean{usesinglespacing}
\newboolean{usedoublespacing}
\newboolean{usefullspacing}
\newboolean{usedeptreport}
\newboolean{useabbrevs}
\newboolean{sansheadings}
\newboolean{ltoc}
\newboolean{romanpre}
\newboolean{logo}
\newboolean{frontabs}
\newboolean{strict}
\newboolean{timesfonts}
%% Choose the monochrome crest for the front page (if crests used)
\shieldtype{0}
%%
%% --- Options ---
%%
%% Current options: phd, mphil, msc, mscres, bsc
%% deptreport
%% draft
%% usequotes
%% singlespacing, doublespacing, fullspacing
%% cent{er,re}chapter, leftchapter, rightchapter,
%% + all report.cls options
%%
%% Commands to set course and project (for 4th year -- too many possibilities
%% to use options).
\let\@course\@empty
\newcommand{\course}[1]{\gdef\@course{#1}}
\newcommand{\@project}{Fourth Year Project Report}
\newcommand{\project}[1]{\gdef\@project{#1}}
%% Options to specify school and/or degree
% MSc degree: default is none specified
\let\@mscdegree\@empty
\DeclareOption{adi}{\gdef\@mscdegree{Advanced Design Informatics}}
\DeclareOption{ai}{\gdef\@mscdegree{Artificial Intelligence}}
\DeclareOption{cogsci}{\gdef\@mscdegree{Cognitive Science}}
\DeclareOption{cs}{\gdef\@mscdegree{Computer Science}}
\DeclareOption{cyber}{\gdef\@mscdegree{Cyber Security, Privacy and Trust}}
\DeclareOption{datasci}{\gdef\@mscdegree{Data Science}}
\DeclareOption{di}{\gdef\@mscdegree{Design Informatics}}
\DeclareOption{dsti}{\gdef\@mscdegree{Data Science, Technology, and Innovation}}
\DeclareOption{inf}{\gdef\@mscdegree{Informatics}}
% Institute
\let\@institute\@empty
\DeclareOption{aiai}{\gdef\@institute{Artificial Intelligence
Applications Institute}}
\DeclareOption{cisa}{\gdef\@institute{Centre for Intelligent Systems
and their Applications}}
\DeclareOption{icsa}{\gdef\@institute{Institute of Computing Systems
Architecture}}
\DeclareOption{ianc}{\gdef\@institute{Institute for Adaptive and
Neural Computation}}
\DeclareOption{ilcc}{\gdef\@institute{Institute for Language, Cognition and
Computation}}
\DeclareOption{ipab}{\gdef\@institute{Institute of Perception, Action
and Behaviour}}
\DeclareOption{lfcs}{\gdef\@institute{Laboratory for Foundations of
Computer Science}}
% Degree
\def\@researchdegree#1{%
\renewcommand{\@degreetext}{#1 \\
\ifx\@empty\@institute
\PackageWarning{infthesis}{No institute specified for research
degree}
\else
\@institute \\
\fi
\@infschool \\ \@university}
\setboolean{strict}{true}}
\DeclareOption{phdproposal}{\@researchdegree{PhD Proposal}}
\DeclareOption{phd}{\@researchdegree{Doctor of Philosophy}}
\DeclareOption{mphil}{\@researchdegree{Master of Philosophy}}
\DeclareOption{mscres}{\@researchdegree{Master of Science by Research}}
\def\@taughtdegree#1#2{%
\renewcommand{\@degreetext}{#1 \\
\ifx\@empty#2
% \PackageWarning{infthesis}{No course/school specified for taught
% degree}
\else
#2 \\
\fi
\@infschool \\ \@university}%
\setboolean{strict}{false}}
\DeclareOption{msc}{\@taughtdegree{Master of Science}{\@mscdegree}}
\DeclareOption{minf}{\@taughtdegree{Master of Informatics}{~}}
\DeclareOption{bsc}{\@taughtdegree{\@project}{\@course}}
%% Chapter header alignment, font of headings
\DeclareOption{centerchapter,centrechapter}
{\renewcommand{\@chapteralignment}{\centering}}
\DeclareOption{leftchapter}
{\renewcommand{\@chapteralignment}{\raggedright}}
\DeclareOption{rightchapter}
{\renewcommand{\@chapteralignment}{\raggedleft}}
\DeclareOption{sansheadings}{%
\setboolean{sansheadings}{true}}
\DeclareOption{normalheadings}{%
\setboolean{sansheadings}{false}}
%% Sidedness, openright-ness, and font size (so that the draft option can
%% override them as needed.
\DeclareOption{twoside}{\renewcommand{\@thesisside}{twoside}}
\DeclareOption{oneside}{\renewcommand{\@thesisside}{oneside}}
\DeclareOption{openany}{\renewcommand{\@thesisopen}{openany}}
\DeclareOption{openright}{\renewcommand{\@thesisopen}{openright}}
\DeclareOption{10pt}{\renewcommand{\@thesispoints}{10pt}}
\DeclareOption{11pt}{\renewcommand{\@thesispoints}{11pt}}
\DeclareOption{12pt}{\renewcommand{\@thesispoints}{12pt}}
%% Font options.
\DeclareOption{notimes}{\setboolean{timesfonts}{false}}
\DeclareOption{timesfonts}{\setboolean{timesfonts}{true}}
%% Whether it's a draft (if so, single space and wider margins to fit more)
\DeclareOption{draft}{
\setboolean{draftthesis}{true}
\ExecuteOptions{10pt,openany,twoside}
\renewcommand{\@draftmessage}{(Draft Copy)}}
%% Use quotation marks in quotation environment?
\DeclareOption{usequotes}{\setboolean{usequotemarks}{true}}
%% Use useful abbrevations?
\DeclareOption{abbrevs}{\setboolean{useabbrevs}{true}}
%% Select spacing (default: fullspacing)
\DeclareOption{singlespacing}{\setboolean{usesinglespacing}{true}}
\DeclareOption{doublespacing}{\setboolean{usedoublespacing}{true}}
\DeclareOption{fullspacing}{\setboolean{usefullspacing}{true}}
%% Options to control the format of the cover page
\DeclareOption{deptreport}{\setboolean{usedeptreport}{true}}
\DeclareOption{logo}{%
\setboolean{logo}{true}}
\DeclareOption{frontabs}{%
\setboolean{frontabs}{true}}
%% Use parskip formatting of paragraphs
\DeclareOption{parskip}{\AtEndOfClass{\RequirePackage{parskip}}}
%% Whether to put list of figures and tables into TOC (default: no)
\DeclareOption{listsintoc}{%
\setboolean{ltoc}{true}}
%% Pre pages can be numbered separately or with the rest of the thesis.
\DeclareOption{romanprepages}{\setboolean{romanpre}{true}}
\DeclareOption{plainprepages}{\setboolean{romanpre}{false}}
%% Pass all other options directly to report class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
%% Set default options and process the ones we were given.
\ExecuteOptions{phd,centerchapter,romanprepages,%
sansheadings,openright,oneside,12pt,timesfonts}
\ProcessOptions
%%
%% --- Class Loading (built ontop of report.cls) ---
%%
\LoadClass[a4paper,\@thesispoints,\@thesisside,\@thesisopen]{report}
\ifthenelse{\boolean{draftthesis}}
{}
{\ifthenelse{\boolean{strict}}
{\if@twoside
\if@openright
\else
\PackageWarning{infthesis}{A two-sided PhD or MPhil thesis must
not use the "openany" option}
\fi
\fi}
{}}
%%
%% --- Main Code ---
%%
\newboolean{isspecialchapter}
\setboolean{isspecialchapter}{false}
%%
%% First we will sort out the page layout. The following is a brief
%% summary of the university typesetting regulations:
%% Printed on A4 paper, entirely on rectos (single-sided) or on both sides
%% but with chapters starting on even pages
%% 4cm binding margin
%% 2cm head margin
%% 2.5cm fore-edge margin
%% 4cm tail margin
%% spacing: not less then 1.5 spacing (18pt leading)
%% quotations & footnotes in single spacing
%% bibliography may be in single spacing
%% character size: not exceed 12pt for body text (at least 10pt)
%% style: a serif font should be used, with a sans-serif for headings
%% hyphenation should be avoided if possible
%% Try to set up the margins according to the specifications in the thesis
%% regulations. I have removed all of the old code (ca. 1996) that attempted
%% to compensate for particular printers in the Department of Computer
%% Science.
\ifthenelse{\boolean{draftthesis}}
{\geometry{a4paper,margin=2cm,twoside}}
{\if@twoside
\geometry{a4paper,left=4cm,top=2cm,right=2.5cm,bottom=4cm,twoside}
\else
\geometry{a4paper,left=4cm,top=2cm,right=2.5cm,bottom=4cm}
\fi}
%% We should make pages created by "cleardoublepage" be
%% really empty. Taken from titlesec.sty
\def\cleardoublepage{%
\clearpage{\ps@empty\if@twoside\ifodd\c@page\else
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}}
%%
%% Hack to make minitoc work with csthesis. We declare a new chapter
%% variable called starchapter to be used by \addcontentsline when we
%% add contents lines for List of Figures/Tables. If we don't, then
%% minitoc treats the LOF/LOT sections as chapters of the thesis.
%%
\@ifundefined{chapter}{}{\let\l@starchapter\l@chapter}
%%
%% This bit will set up the header format for the thesis.
%% This currently uses a "headings" style showing the pagenumber
%% and chapter number/title. (in slanted text) If the document is two-sided,
%% the right-hand page will show the section number and title instead.
%%
\newcommand{\headfootstyle}{\normalsize} % font size of headers and footers
% This will have \sffamily added to it if "sansheadings" is specified.
%% Set up different headers for right and left-hand pages. Those \defs are a
%% bit magic, but they seem to do the trick... :-)
%% Adapted from Francois Pitt's ut-thesis class from the University of
%% Toronto.
\if@twoside % if two-sided printing
\renewcommand{\ps@headings}{
\let\@mkboth\markboth
\def\@oddfoot{}
\let\@evenfoot\@oddfoot
\def\@oddhead{{\headfootstyle\itshape \rightmark}\hfil \headfootstyle\thepage}%
\def\@evenhead{\headfootstyle\thepage\hfil
{\headfootstyle\itshape\leftmark}}%
\def\chaptermark##1{\markboth
{\ifnum\c@secnumdepth >\m@ne
\@chapapp\ \thechapter. \ \fi ##1}{}}%
\def\sectionmark##1{\markright
{\ifnum\c@secnumdepth >\z@
\thesection. \ \fi ##1}}%
}%ps@headings
\else % if one-sided printing
\renewcommand{\ps@headings}{
\let\@mkboth\markboth
\def\@oddfoot{}
\def\@oddhead{{\headfootstyle\itshape\rightmark}\hfil
\headfootstyle\thepage}%
\def\chaptermark##1{\markright
{\ifnum\c@secnumdepth >\m@ne
\@chapapp\ \thechapter. \ \fi ##1}}%
}%ps@headings
\fi%@twoside
\renewcommand{\ps@plain}{
\renewcommand{\@oddfoot}{\hfil\headfootstyle\thepage\hfil}
\renewcommand{\@evenfoot}{\hfil\headfootstyle\thepage\hfil}
\renewcommand{\@evenhead}{}
\renewcommand{\@oddhead}{}
}
%%
%% And now setup that headings style as default
%%
\newcommand{\@textpagenumbering}{arabic}
\newcommand{\@preamblepagenumbering}{roman}
\newcommand{\@textpagestyle}{headings}
\newcommand{\@preamblepagestyle}{plain}
\pagestyle{\@textpagestyle}
\setcounter{secnumdepth}{6}
%%
%% Set up the default names for the various chapter headings
%%
\renewcommand{\contentsname}{Table of Contents}
\renewcommand{\listfigurename}{List of Figures}
\renewcommand{\listtablename}{List of Tables}
\renewcommand{\bibname}{Bibliography}
\renewcommand{\indexname}{Index}
\renewcommand{\abstractname}{Abstract}
%%
%% Some sundry commands which are generally useful...
%%
\ifthenelse{\boolean{useabbrevs}}
{\newcommand{\NB}{N.B.\@\xspace}
\newcommand{\eg}{e.g.\@\xspace}
\newcommand{\Eg}{E.g.\@\xspace}
\newcommand{\ie}{i.e.\@\xspace}
\newcommand{\Ie}{I.e.\@\xspace}
\newcommand{\etc}{etc.\@\xspace}
\newcommand{\etal}{{\em et al}.\@\xspace}
\newcommand{\etseq}{{\em et seq}.\@\xspace}
\newcommand{\precis}{pr\'ecis\xspace}
\newcommand{\Precis}{Pr\'ecis\xspace}
\newcommand{\role}{r\^ole\xspace}
\newcommand{\Role}{R\^ole\xspace}
\newcommand{\naive}{na\"\i ve\xspace}
\newcommand{\Naive}{Na\"\i ve\xspace}
\newcommand{\tm}{\raisebox{1ex}{\tiny TM}\xspace}
\newcommand{\cpright}{\raisebox{1ex}{\tiny\copyright}\xspace}
\newcommand{\degrees}{\raisebox{1.2ex}{\tiny\ensuremath{\circ}}\xspace}}
{}
%%
%% Set up the double spacing and provide commands to alter the
%% spacing for the subsequent text. By default, 1.5 spacing will be
%% used. This can be modified through the singlespacing, doublespacing
%% or draft class options.
%%
\newcommand{\doublespace}{%
\renewcommand{\baselinestretch}{1.66}\normalsize}
\newcommand{\oneandahalfspace}{%
\renewcommand{\baselinestretch}{1.33}\normalsize}
\newcommand{\singlespace}{%
\renewcommand{\baselinestretch}{1}\normalsize}
\ifthenelse{\boolean{draftthesis}}
{\AtBeginDocument{\singlespace}}% \SetPrinterDraft}
{\ifthenelse{\boolean{usesinglespacing}}
{\AtBeginDocument{\singlespace}%
\ifthenelse{\boolean{strict}}
{\PackageWarning{infthesis}{Single spacing is not permitted in the
regulations for PhD and MPhil theses}}
{}}
{\ifthenelse{\boolean{usedoublespacing}}
{\AtBeginDocument{\doublespace}}
{\AtBeginDocument{\oneandahalfspace}}
}
}
%%
%% We must ensure that the thesis ends on a lef-hand page. We
%% do the latter by issuing a \cleardoublepage at the end of document.
%% MEF: deleted this, there's no point -- it'll print the other side of that
%% page anyway!
%%
% \AtEndDocument{\cleardoublepage}
%%
%% A couple of commands for figures/captions
%%
\newcommand{\thesiscaption}[3][]{
\ifthenelse{\equal{#1}{}}
{\parbox{5in}{\caption{{\em #2\/}}\label{#3}}}
{\parbox{5in}{\caption[#1]{{\em #2\/}}\label{#3}}}
}
%%
%% Quotations are supposed to be in single-space, so we will
%% explicitly redefine the quotation env. to support this.
%% And introduce a quotetext env. which can add an attribution.
%%
\let\old@quote\quote
\let\old@endquote\endquote
\renewcommand{\quote}{\old@quote\singlespace\ifthenelse{\boolean{usequotemarks}}{``}{}}
\renewcommand{\endquote}{\ifthenelse{\boolean{usequotemarks}}{''}{}\old@endquote}
\let\old@quotation\quotation
\let\old@endquotation\endquotation
\renewcommand{\quotation}{\old@quotation\singlespace}
\renewcommand{\endquotation}{\old@endquotation}
% \renewenvironment{quote}
% {\old@quote\singlespace
% \ifthenelse{\boolean{usequotemarks}}{``}{}}
% {\ifthenelse{\boolean{usequotemarks}}{''}{}\end{quote}}
\newenvironment{iquote}
{\begin{quote}\it}
{\rm\end{quote}}
\newcommand{\quotationname}{}
\newenvironment{quotetext}[1]
{\renewcommand{\quotationname}{#1}\begin{iquote}\singlespace
\ifthenelse{\boolean{usequotemarks}}{``}{}\it}
{\ifthenelse{\boolean{usequotemarks}}{\rm''}{}
\hspace*{\fill}\nolinebreak[1]\hspace*{\fill}
\rm (\quotationname)\end{iquote}}
%%
%% Footnotes should also be single-spaced.
%%
\let\tmp@footnotetext=\@footnotetext
\renewcommand{\@footnotetext}[1]%
{{\singlespace\tmp@footnotetext{#1}}}
%% "preliminary" environment to control numbering of pages between title and
%% first chapter. This will only kick in if romanprepages is specificed (the
%% default).
%% Based on Francois Pitt's ut-thesis.cls from University of Toronto.
\newenvironment{preliminary}
{\ifthenelse{\boolean{romanpre}}%
{\pagestyle{plain}\pagenumbering{roman}}
{\pagestyle{empty}}}%
{\cleardoublepage%
\ifthenelse{\boolean{romanpre}}%
{\pagenumbering{arabic}}%
{}}
%%
%% Let's have a dedication page so I can thank my mummy.
%%
\newcommand{\dedication}[1]
{\vspace*{\fill}
\begin{center}#1\end{center}
\vspace*{\fill}}
%% A generic "frontmatter" environment, for use with abstract, dedication etc.
%% You specify the title of the environment and the font size to use (so that
%% both normal abstracts and those on the front page can be accommodated.)
\newenvironment{frontenv}[2]
{\vspace{1cm}
\begin{center}
\@chapterfont\bfseries \LARGE#1
\end{center}}
{\par\vfil}
%% You specify the abstract with the \abs command; it gets automatically
%% inserted into the document where appropriate (title page or first main
%% page.
\def\@abs{}
\renewcommand{\abstract}[1]{\gdef\@abs{#1}}
\newenvironment{mainabs}
{\begin{frontenv}{\abstractname}{\LARGE}}
{\end{frontenv}\newpage}
\newenvironment{frontabs}
{\begin{frontenv}{\abstractname}{\large}
\begin{quotation}\rm}
{\end{quotation}\end{frontenv}}
%%
%% Based upon the above abstract env., provide wrappers for
%% an acknowledgements and declation env.
%%
\newenvironment{acknowledgements}
{\renewcommand{\abstractname}{Acknowledgements}\begin{mainabs}}
{\end{mainabs}\renewcommand{\abstractname}{Abstract}}
\newenvironment{declaration}
{\renewcommand{\abstractname}{Declaration}\begin{mainabs}}
{\end{mainabs}\renewcommand{\abstractname}{Abstract}}
\newcommand{\standarddeclaration}{
\begin{declaration}
I declare that this thesis was composed by myself,
that the work contained herein is my own
except where explicitly stated otherwise in the text,
and that this work has not been submitted for any other degree or
professional qualification except as specified.\par
\vspace{1in}\raggedleft({\em \@author\/})
\end{declaration}
}
%%
%% Now let's look at the format for the title page of the
%% thesis. This is done by redefining \maketitle, and allowing
%% some extra input options: \submityear and \graduationdate
%%
\def\submityear#1{\gdef\@submityear{#1}}
\gdef\@submityear{\the\year}
\def\graduationdate#1{\gdef\@graduationdate{#1}}
\gdef\@graduationdate{}
%% If usedeptreport is specified, then none of the other funky options kick
%% in. If not, then if frontabs is specified then it is used; otherwise,
%% the logo is inserted if required. If the abstract is not put on the front
%% page, then \maketitle will also create the abstract page as the first page
%% of the actual document.
\ifthenelse{\boolean{usedeptreport}}{
\renewcommand{\maketitle}{
\begin{titlepage}
\addtolength{\oddsidemargin}{-0.75cm}
\begin{center}
\null\vskip 6.1cm
\begin{minipage}[t][7.6cm]{10.5cm}
\begin{center}
{\LARGE\bfseries \@chapterfont \@title \par
\ifthenelse{\boolean{draftthesis}}{\large \@draftmessage}{}
}\vfil
{\Large\itshape \@author \par}
\end{center}
\end{minipage}\\
{\large \@degreetext \par \@submityear \par}
\ifthenelse{\equal{\@graduationdate}{}}{}
{\vskip 1cm {\large \ttfamily (Graduation date: \@graduationdate)}}
\end{center}
\end{titlepage}\cleardoublepage
\begin{mainabs}\@abs\end{mainabs}
}}{\ifthenelse{\boolean{frontabs}}{
\ifthenelse{\boolean{strict}}
{\PackageWarning{infthesis}{The regulations for PhD and MPhil theses
do not permit the abstract on the front page}}
{}
\renewcommand{\maketitle}{
\begin{titlepage}\begin{center}
{\LARGE\bfseries \@chapterfont \@title \par
\ifthenelse{\boolean{draftthesis}}{\large (Draft Copy)}{}
}\vspace{3cm}
{\Large\itshape \@author \par}\vspace{3cm}
{\large \@degreetext \par \@submityear \par}
\vskip 1cm
\ifthenelse{\equal{\@graduationdate}{}}{}
{{\large \ttfamily (Graduation date: \@graduationdate)}}
\end{center}
\begin{frontabs}\@abs\end{frontabs}
\end{titlepage}
}}{
\renewcommand{\maketitle}{
\begin{titlepage}\begin{center}
\null\vfil\vskip 60\p@
{\LARGE\bfseries \@chapterfont \@title \par
\ifthenelse{\boolean{draftthesis}}{\large (Draft Copy)}{}
}\vfill
{\Large\itshape \@author \par}\vskip 1cm\vfill
\ifthenelse{\boolean{logo}}%
{\resizebox{30mm}{!}{\includeshield}\\\vfill}
{}
{\large \@degreetext \par \@submityear \par}
\vskip 1cm
\ifthenelse{\equal{\@graduationdate}{}}{}
{{\large \ttfamily (Graduation date: \@graduationdate)}}
\end{center}
\end{titlepage}\cleardoublepage
\begin{mainabs}\@abs\end{mainabs}
}}}
%% If requested, put the list of figures and list of tables into the table of
%% contents.
\ifthenelse{\boolean{ltoc}}
{\RequirePackage[nottoc,notbib]{tocbibind}}
{}
%% Use the "pslatex" fonts unless they told us not to
\ifthenelse{\boolean{timesfonts}}
{\RequirePackage{pslatex}}
{}
%% ALWAYS put the bibliography into the TOC.
%% Thanks to Peter Wilson <peter.r.wilson@boeing.com> for pointing me in the
%% right direction, and to Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>
%% and Michael J Downes <epsmjd@ams,org> for together coming up with this
%% solution.
%%
%% However the bibliography is defined, this will append the \addcontentsline
%% statement to it. Also, it will put the bibname into the page headers.
\AtBeginDocument{%
\expandafter\def\expandafter\thebibliography\expandafter
#\expandafter1\expandafter{\thebibliography{#1}%
{\addcontentsline{toc}{chapter}{\bibname}}
\markboth{\bibname}{\bibname}}}
%% Do what is requested with headings and captions... can't include these
%% packages above because sectsty won't work except from within report.cls
%% itself. Must save \@chapterfont because the front environments (abstract
%% etc) also need to use it.
\RequirePackage{sectsty,caption}
\ifthenelse{\boolean{sansheadings}}
{\allsectionsfont{\sffamily}
\renewcommand{\@chapterfont}{\sffamily}
\renewcommand{\captionfont}{\sffamily}
\renewcommand{\headfootstyle}{\normalsize\sffamily}}
{}
%% To make sure we get chapters aligned correctly, we set it here instead.
\chapterfont{\@chapterfont\@chapteralignment}
%%
%% EOF: infthesis.cls
%%

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

131
tex/misc/w4_slides.bib Normal file
View file

@ -0,0 +1,131 @@
@article{JTSE.2010.RRIP,
author = {Jaleel, Aamer and Theobald, Kevin B. and Steely, Simon C. and Emer, Joel},
title = {High Performance Cache Replacement Using Re-Reference Interval Prediction (RRIP)},
year = {2010},
issue_date = {June 2010},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {38},
number = {3},
issn = {0163-5964},
url = {https://doi.org/10.1145/1816038.1815971},
doi = {10.1145/1816038.1815971},
abstract = {Practical cache replacement policies attempt to emulate optimal replacement by predicting the re-reference interval of a cache block. The commonly used LRU replacement policy always predicts a near-immediate re-reference interval on cache hits and misses. Applications that exhibit a distant re-reference interval perform badly under LRU. Such applications usually have a working-set larger than the cache or have frequent bursts of references to non-temporal data (called scans). To improve the performance of such workloads, this paper proposes cache replacement using Re-reference Interval Prediction (RRIP). We propose Static RRIP (SRRIP) that is scan-resistant and Dynamic RRIP (DRRIP) that is both scan-resistant and thrash-resistant. Both RRIP policies require only 2-bits per cache block and easily integrate into existing LRU approximations found in modern processors. Our evaluations using PC games, multimedia, server and SPEC CPU2006 workloads on a single-core processor with a 2MB last-level cache (LLC) show that both SRRIP and DRRIP outperform LRU replacement on the throughput metric by an average of 4\% and 10\% respectively. Our evaluations with over 1000 multi-programmed workloads on a 4-core CMP with an 8MB shared LLC show that SRRIP and DRRIP outperform LRU replacement on the throughput metric by an average of 7\% and 9\% respectively. We also show that RRIP outperforms LFU, the state-of the art scan-resistant replacement algorithm to-date. For the cache configurations under study, RRIP requires 2X less hardware than LRU and 2.5X less hardware than LFU.},
journal = {SIGARCH Comput. Archit. News},
month = {jun},
pages = {6071},
numpages = {12},
keywords = {thrashing, shared cache, replacement, scan resistance}
}
@INPROCEEDINGS{SYS.2021.RLR,
author={Sethumurugan, Subhash and Yin, Jieming and Sartori, John},
booktitle={2021 IEEE International Symposium on High-Performance Computer Architecture (HPCA)},
title={Designing a Cost-Effective Cache Replacement Policy using Machine Learning},
year={2021},
volume={},
number={},
pages={291-303},
doi={10.1109/HPCA51647.2021.00033}
}
@ARTICLE{MM.2004.ARC,
author={Megiddo, N. and Modha, D.S.},
journal={Computer},
title={Outperforming LRU with an adaptive replacement cache algorithm},
year={2004},
volume={37},
number={4},
pages={58-65},
doi={10.1109/MC.2004.1297303}
}
@article{QJPSE.2007.DIP,
author = {Qureshi, Moinuddin K. and Jaleel, Aamer and Patt, Yale N. and Steely, Simon C. and Emer, Joel},
title = {Adaptive Insertion Policies for High Performance Caching},
year = {2007},
issue_date = {May 2007},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {35},
number = {2},
issn = {0163-5964},
url = {https://doi.org/10.1145/1273440.1250709},
doi = {10.1145/1273440.1250709},
abstract = {The commonly used LRU replacement policy is susceptible to thrashing for memory-intensive workloads that have a working set greater than the available cache size. For such applications, the majority of lines traverse from the MRU position to the LRU position without receiving any cache hits, resulting in inefficient use of cache space. Cache performance can be improved if some fraction of the working set is retained in the cache so that at least that fraction of the working set can contribute to cache hits.We show that simple changes to the insertion policy can significantly reduce cache misses for memory-intensive workloads. We propose the LRU Insertion Policy (LIP) which places the incoming line in the LRU position instead of the MRU position. LIP protects the cache from thrashing and results in close to optimal hitrate for applications that have a cyclic reference pattern. We also propose the Bimodal Insertion Policy (BIP) as an enhancement of LIP that adapts to changes in the working set while maintaining the thrashing protection of LIP. We finally propose a Dynamic Insertion Policy (DIP) to choose between BIP and the traditional LRU policy depending on which policy incurs fewer misses. The proposed insertion policies do not require any change to the existing cache structure, are trivial to implement, and have a storage requirement of less than two bytes. We show that DIP reduces the average MPKI of the baseline 1MB 16-way L2 cache by 21\%, bridging two-thirds of the gap between LRU and OPT.},
journal = {SIGARCH Comput. Archit. News},
month = {jun},
pages = {381391},
numpages = {11},
keywords = {thrashing, set sampling, set dueling, replacement}
}
@INPROCEEDINGS{GWHSZ.2014.CacheReplAsMDP-QLearning,
author={Gu, Jingxiong and Wang, Wei and Huang, Aiping and Shan, Hangguan and Zhang, Zhaoyang},
booktitle={2014 IEEE International Conference on Communications (ICC)},
title={Distributed cache replacement for caching-enable base stations in cellular networks},
year={2014},
volume={},
number={},
pages={2648-2653},
doi={10.1109/ICC.2014.6883723}
}
@inproceedings {EHOFK.2020.IBM-LRUvsFIFO,
author = {Ohad Eytan and Danny Harnik and Effi Ofer and Roy Friedman and Ronen Kat},
title = {It{\textquoteright}s Time to Revisit {LRU} vs. {FIFO}},
booktitle = {12th USENIX Workshop on Hot Topics in Storage and File Systems (HotStorage 20)},
year = {2020},
url = {https://www.usenix.org/conference/hotstorage20/presentation/eytan},
publisher = {USENIX Association},
month = jul
}
@inproceedings{YQZYR.2023.FIFOwithTwist,
author = {Yang, Juncheng and Qiu, Ziyue and Zhang, Yazhuo and Yue, Yao and Rashmi, K. V.},
title = {FIFO Can Be Better than LRU: The Power of Lazy Promotion and Quick Demotion},
year = {2023},
isbn = {9798400701955},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3593856.3595887},
doi = {10.1145/3593856.3595887},
abstract = {LRU has been the basis of cache eviction algorithms for decades, with a plethora of innovations on improving LRU's miss ratio and throughput. While it is well-known that FIFO-based eviction algorithms provide significantly better throughput and scalability, they lag behind LRU on miss ratio, thus, cache efficiency.We performed a large-scale simulation study using 5307 block and web cache workloads collected in the past two decades. We find that contrary to what common wisdom suggests, some FIFO-based algorithms, such as FIFO-Reinsertion (or CLOCK), are, in fact, more efficient (have a lower miss ratio) than LRU. Moreover, we find that qick demotion --- evicting most new objects very quickly --- is critical for cache efficiency. We show that when enhanced by qick demotion, not only can state-of-the-art algorithms be more efficient, a simple FIFO-based algorithm can outperform five complex state-of-the-art in terms of miss ratio.},
booktitle = {Proceedings of the 19th Workshop on Hot Topics in Operating Systems},
pages = {7079},
numpages = {10},
location = {Providence, RI, USA},
series = {HOTOS '23}
}
@inproceedings{CDKP.1994.TreadMarks,
title = {TreadMarks: Distributed Shared Memory on Standard Workstations and Operating Systems},
author = {Cox, A.L. and Dwarkadas, S. and Keleher, P. and Zwaenepoel, Willy},
year = {1994},
abstract = {TreadMarks is a distributed shared memory (DSM) system for standard Unix systems such as SunOS and Ultrix. This paper presents a performance evaluation of TreadMarks running on Ultrix using DECstation-5000/240's that are connected by a 100-Mbps switch-based ATM LAN and a 10-Mbps Ethernet. Our objective is to determine the efficiency of a user-level DSM implementation on commercially available workstations and operating systems. We achieved good speedups on the 8-processor ATM network for Jacobi (7.4), TSP (7.2), Quicksort (6.3), and ILINK (5.7). For a slightly modified version ofWater from the SPLASH benchmark suite, we achieved only moderate speedups (4.0) due to the high communication and synchronization rate. Speedups decline on the 10-Mbps Ethernet (5.5 for Jacobi, 6.5 for TSP, 4.2 for Quicksort, 5.1 for ILINK, and 2.1 for Water), reecting the bandwidth limitations of the Ethernet. These results support the contention that, with suitable networking technology, DSM is a viable technique for parallel computation on clusters of workstations. To achieve these speedups, TreadMarks goes to great lengths to reduce the amount of communication performed to maintain memory consistency. It uses a lazy implementation of release consistency, and it allows multiple concurrent writers to modify a page, reducing the impact of false sharing. Great care was taken to minimize communication overhead. In particular, on the ATM network, we used a standard low-level protocol, AAL3/4, bypassing the TCP/IP protocol stack. Unix communication overhead, however, remains the main obstacle in the way of better performance for programs like Water. Compared to the Unix communication overhead, memory management cost (both kernel and user level) is small and wire time is negligible.},
url = {http://infoscience.epfl.ch/record/55805},
}
@article{ISS.1998.Millipede,
title = {Thread migration and its applications in distributed shared memory systems1Technion CS/LPCR Technical Report #9603, July 1996.1},
journal = {Journal of Systems and Software},
volume = {42},
number = {1},
pages = {71-87},
year = {1998},
issn = {0164-1212},
doi = {https://doi.org/10.1016/S0164-1212(98)00008-9},
url = {https://www.sciencedirect.com/science/article/pii/S0164121298000089},
author = {Ayal Itzkovitz and Assaf Schuster and Lea Shalev},
keywords = {Tread migration, Distributed shared memory, Load sharing, Virtual parallel machine},
abstract = {In this paper we describe the way thread migration can be carried in distributed shared memory (DSM) systems. We discuss the advantages of multi-threading in DSM systems and the importance of preempted dynamic thread migration. The proposed solution is implemented in MILLIPEDE: an environment for parallel programming over a network of (personal) computers. MILLIPEDE implements transparent computation migration mechanism: a mobile computation thread in a MILLIPEDE application can be suspended almost at every point during its lifetime and be resumed on another host. This mechanism can be used to better utilize system resources and improve performance by balancing the load and solving ping-pong situations of memory objects, and to provide user ownership on his workstation. We describe how some of these are implemented in the MILLIPEDE system. MILLIPEDE, including its thread migration module, is fully implemented in user-mode (currently on Windows-NT) using the standard operating system APIs.}
}
@inproceedings{de2000effect,
title={The effect of contention on the scalability of page-based software shared memory systems},
author={de Lara, Eyal and Lu, Honghui and Charlie, Y and Cox, Alan L and Zwaenepoel, Willy},
booktitle={Languages, Compilers, and Run-Time Systems for Scalable Computers: 5th International Workshop, LCR 2000 Rochester, NY, USA, May 25--27, 2000 Selected Papers 5},
pages={155--169},
year={2000},
organization={Springer}
}

BIN
tex/misc/w4_slides.pdf Normal file

Binary file not shown.

159
tex/misc/w4_slides.tex Normal file
View file

@ -0,0 +1,159 @@
\documentclass{beamer}
\usepackage[style=authortitle-comp]{biblatex}
\usepackage[export]{adjustbox}
\title{Progress Report: Cache Replacement, Application Performance, and Relations to DSM}
\author{Zhengyi Chen} % Amir?
\date{\today}
\addbibresource{w4_slides.bib}
\begin{document}
% Title page
\frame{\titlepage}
% Page 1
\begin{frame}
\frametitle{(Cache) Replacement Strategies}
\begin{itemize}
\item There have been significant development in (CPU) cache replacement strategies in the last decades.
\item e.g., RRIP(++)\footcite{JTSE.2010.RRIP} and more recently (various) ML-\textit{derived} heuristics.
\item Also popular is studying adequate cache replacement strategies for distributed systems (though more stagnant).
% There is a lack of translation between advancements in hardware and their efficacy in software.
% That said, this might be because they are (able to afford) machine learning techniques in dynamic replacement strategies at edge nodes...
\item There are many variables within each cached system (whether CPU or distributed FS, etc.) that affect which strategy is more \textit{efficient} in operation.
% A cached/distributed FS or CDN, for example, primarily captures frequency than recency.
% An operating system might juggle between both depending on the type of access -- Linux's LRU_GEN attempts to capture this difference between file descriptor
% accesses and just plain stack/heap/text section accesses.
% The replacement problem for our kernel DSM is similar -- we want to capture the working set of all in-scope processes for each node in system. The existence of
% swap space only complicates the matter:
% - Swap locally to swap file?
% - Swap remotely to other node's memory which our DSM might be able to do?
% - Swap remotely to other node's swap file?
% As Amir mentioned there is also the question of speed -- the replacement algorithm needs to be fast enough for the system to not stall, though the problem
% of selecting a replacement algorithm may not (need to) be as time-sensitive?
\item Moreover, different applications (e.g., threads) exhibit different access patterns which may be better served by one strategy than another.\footcite{SYS.2021.RLR}
\end{itemize}
\end{frame}
% Page 2
\begin{frame}
\frametitle{Notable (i.e., Encountered) Strategies}
\begin{itemize}
\item LRU family
\item FIFO family
\item Adaptive Replacement Cache
\item CPU-LLC Intended: Dynamic Insertion Policy, Re-Reference Interval Prediction, Signature-based Hit Predictor, \dots
% RRIP is basically an M-bit LFU.
\item ML-derived: Reinforcement Learned Replacement, LeCaR, Cache Replacement Problem as Markov Decision Process\footcite{GWHSZ.2014.CacheReplAsMDP-QLearning},
\dots
\end{itemize}
\end{frame}
% Page 3
\begin{frame}
\frametitle{Notable (i.e., Encountered) Strategies}
\begin{itemize}
\item The performance of replacement strategies correlate strongly to the context of their operation.
\item For example, LRU is theoretically better-performing than FIFO \textit{in their most textbook implementations} but recent studies
\footcites{EHOFK.2020.IBM-LRUvsFIFO}{YQZYR.2023.FIFOwithTwist} have shown that FIFO can outperform LRU in practice (CDNs, for example, where even cache
bookkeeping structures can be costly).
% Now it's probable that these papers are unfairly competing a more state-of-the-art FIFO-esque algorithm with a less so LRU-esque algorithm...
% In general:
\item To summarize, \textbf{The (dynamic) choice of replacement algorithm in any system is of practical concern!}
\end{itemize}
\end{frame}
% Page 4
\begin{frame}
\frametitle{LRU \& FIFO family -- Patches and Applications}
\begin{itemize}
\item The state-of-the-art implementations of LRU or FIFO is far-cry from their textbook implementations.
% Also there are a LOT of them -- I can't find enough time to gather all of them RN.
\item This is so that they can capture both \emph{recency} and \emph{frequency}:
we desire to use both to predict/assume the \emph{re-reference interval} of a given entry.
\item e.g., Linux uses \texttt{LRU\_GEN} which is a multi-queue LRU strategy wherein each queue(generation) represents a "similar" level of access recency and is evicted in batch.
\item The kernel developers wanted a \emph{fast and reasonably good} replacer as opposed to an optimal one.
% optimality and performance should both be considered when selecting replacement strategies.
\item Likewise, Yang, et.al.\footcite{YQZYR.2023.FIFOwithTwist} shows that FIFO with \textit{lazy promotion} and \textit{quick demotion} outperforms textbook LRU.
% recall that FIFO can exploit spatial locality better than LRU particularly in systems with slow data access!
% i.e., algorithm performance can be constrained by system topology.
\end{itemize}
% The documentation of LRU_GEN really shows that the developers wanted the strategy itself to decide fast (as opposed to merely deciding well): the strategy itself "[tries] to profit from spatial
% locality"
\end{frame}
% Page 5
\begin{frame}
\frametitle{\texttt{LRU\_GEN} and Access Patterns}
The \texttt{LRU\_GEN} algorithm specifically makes stronger protection of pages for memory accesses through PT than through FD: \
\begin{itemize}
\item Heap/Stack/Text access misses have higher cost -- executables perform blocking I/O at memory access, less likely for file access.
\item They are also more likely to miss, as their in-kernel dirty bits are approximated.
\item Finally, they can be reasonably assumed to more likely exhibit temporal locality.
\end{itemize}
Nevertheless, the algorithm is capable to dynamic adjustment on re-faults -- \textbf{the data model of programs can be file-based or object-based}.
% Though as we know files (i.e., blocks in which file data reside) are loaded into (kernel) memory and heap allocation can always be swapped out,
% so I guess object-based storage wins with less intermediate steps (e.g., filesystem calls), sans data protection.
The same algorithm can deviate in fault rates on different programs on the same node.
% i.e., any good algorithm must be able to dynamically adapt to fault rate feedbacks.
% However, we don't want to run them through any complex learner...
\end{frame}
% Page 6
\begin{frame}
\frametitle{Machine Learning as Analytic Tool: RLR, etc.}
\begin{itemize}
\item Large distributed systems (e.g., CDNs) can afford to perform machine learning for cache replacement tasks
\footcite{GWHSZ.2014.CacheReplAsMDP-QLearning}: run-time is much faster than I/O so some cycles could be afforded.
\item For page replacement in kernel, we can't really afford to run anything costly (Amir).
\item ML analysis\footcite{SYS.2021.RLR} shows how different (computation-intensive) programs exhibit distinct
access patterns.
\end{itemize}
\end{frame}
% Page 7
\begin{frame}
\frametitle{Machine Learning as Analytic Tool: RLR, etc.}
\includegraphics[height=0.6\textheight, center]{w4_slices_resources/RLR.Fig3.png}
\footcite{SYS.2021.RLR}
P.S. \textit{preuse}: set access since last access to address/line.
\end{frame}
% Page 8
\begin{frame}
\frametitle{DSM, Applications, and Memory (Contention)}
The speedup of applications on DSM systems is negatively correlated to shared memory contention.
Take TreadMarks\footcite{CDKP.1994.TreadMarks} for example:
\begin{itemize}
\item \textit{Jacobi} is a solver for linear system of equations via the \textit{successive over-relaxation} method.
The memory access pattern should be map-reduce-like: the problem is parallelized w/ partial matrices for each node with immutable storage of the relevant matrices?
TreadMarks achieves $\sim7x$-speedup on a 8-node system over one single-core node.
\item \textit{Water} is a parallel $N$-body molecular dynamics simulator that requires at least $O(\frac{N}{2})$ communications per processor.
TreadMarks only achieves $\sim4x$-speedup with around $47\%$ time used for blocking communications.
\end{itemize}
\end{frame}
% Page 9
\begin{frame}
\frametitle{DSM, Applications, and Memory (Contention)}
\begin{itemize}
\item It's kinda difficult to compare statistics from different DSM systems.
\item Even with the same programs being run, different parameters makes for different program behaviors wrt. contention, etc.
\item Logically speaking, the more contention on the same address, the less speedup is possible for the system\footcite{de2000effect}.
\item Should cache replacement strategies be aware of how contended a page may be to prevent it from e.g., being swapped out?
\end{itemize}
\end{frame}
% Page 10
\begin{frame}
\frametitle{Hardware-based Dynamic Strategy Selection: DIP}
Hardware-based replacement strategies can provide low-cost inspirations for software replacement strategies.
\includegraphics[height=0.6\textheight, center]{w4_slices_resources/DIP.Fig10.png}\footcite{QJPSE.2007.DIP}
Problem: How can this be scaled for multiple strategies?
\end{frame}
\end{document}

17
tex/mybibfile.bib Normal file
View file

@ -0,0 +1,17 @@
@Book{P2,
author = "Chen-Chung Chang and H. Jerome Keisler",
title = "Model Theory",
publisher = "North-Holland",
edition = {Third},
year = 1990,
}
@inproceedings{P1,
author = {Hiroki Arimura},
title = {Learning Acyclic First-Order Horn Sentences from Entailment},
booktitle = {Proc. of the 8th Intl. Conf. on Algorithmic Learning Theory, ALT '97},
year = {1997},
pages = {432-445},
ee = {http://dx.doi.org/10.1007/3-540-63577-7_59},
bibsource = {DBLP, http://dblp.uni-trier.de}
}

BIN
tex/skeleton.pdf Normal file

Binary file not shown.

201
tex/skeleton.tex Normal file
View file

@ -0,0 +1,201 @@
% UG project example file, February 2022
% Do not change the first two lines of code, except you may delete "logo," if causing problems.
% Understand any problems and seek approval before assuming it's ok to remove ugcheck.
\documentclass[logo,bsc,singlespacing,parskip]{infthesis}
\usepackage{ugcheck}
% Include any packages you need below, but don't include any that change the page
% layout or style of the dissertation. By including the ugcheck package above,
% you should catch most accidental changes of page layout though.
\usepackage{microtype} % recommended, but you can remove if it causes problems
\begin{document}
\begin{preliminary}
\title{Unnamed Honours Thesis}
\author{Zhengyi Chen}
% CHOOSE YOUR DEGREE a):
% please leave just one of the following un-commented
%\course{Artificial Intelligence}
%\course{Artificial Intelligence and Computer Science}
%\course{Artificial Intelligence and Mathematics}
%\course{Artificial Intelligence and Software Engineering}
%\course{Cognitive Science}
\course{Computer Science}
%\course{Computer Science and Management Science}
%\course{Computer Science and Mathematics}
%\course{Computer Science and Physics}
%\course{Software Engineering}
%\course{Master of Informatics} % MInf students
% CHOOSE YOUR DEGREE b):
% please leave just one of the following un-commented
%\project{MInf Project (Part 1) Report} % 4th year MInf students
%\project{MInf Project (Part 2) Report} % 5th year MInf students
\project{4th Year Project Report} % all other UG4 students
\date{\today}
\abstract{
This skeleton demonstrates how to use the \texttt{infthesis} style for
undergraduate dissertations in the School of Informatics. It also emphasises the
page limit, and that you must not deviate from the required style.
The file \texttt{skeleton.tex} generates this document and should be used as a
starting point for your thesis. Replace this abstract text with a concise
summary of your report.
}
\maketitle
\newenvironment{ethics}
{\begin{frontenv}{Research Ethics Approval}{\LARGE}}
{\end{frontenv}\newpage}
\begin{ethics}
\textbf{Instructions:} \emph{Agree with your supervisor which
statement you need to include. Then delete the statement that you are not using,
and the instructions in italics.\\
\textbf{Either complete and include this statement:}}\\ % DELETE THESE INSTRUCTIONS
%
% IF ETHICS APPROVAL WAS REQUIRED:
This project obtained approval from the Informatics Research Ethics committee.\\
Ethics application number: ???\\
Date when approval was obtained: YYYY-MM-DD\\
%
\emph{[If the project required human participants, edit as appropriate, otherwise delete:]}\\ % DELETE THIS LINE
The participants' information sheet and a consent form are included in the appendix.\\
%
% IF ETHICS APPROVAL WAS NOT REQUIRED:
\textbf{\emph{Or include this statement:}}\\ % DELETE THIS LINE
This project was planned in accordance with the Informatics Research
Ethics policy. It did not involve any aspects that required approval
from the Informatics Research Ethics committee.
\standarddeclaration
\end{ethics}
\begin{acknowledgements}
Any acknowledgements go here.
\end{acknowledgements}
\tableofcontents
\end{preliminary}
\chapter{Introduction}
The preliminary material of your report should contain:
\begin{itemize}
\item
The title page.
\item
An abstract page.
\item
Declaration of ethics and own work.
\item
Optionally an acknowledgements page.
\item
The table of contents.
\end{itemize}
As in this example \texttt{skeleton.tex}, the above material should be
included between:
\begin{verbatim}
\begin{preliminary}
...
\end{preliminary}
\end{verbatim}
This style file uses roman numeral page numbers for the preliminary material.
The main content of the dissertation, starting with the first chapter,
starts with page~1. \emph{\textbf{The main content must not go beyond page~40.}}
The report then contains a bibliography and any appendices, which may go beyond
page~40. The appendices are only for any supporting material that's important to
go on record. However, you cannot assume markers of dissertations will read them.
You may not change the dissertation format (e.g., reduce the font size, change
the margins, or reduce the line spacing from the default single spacing). Be
careful if you copy-paste packages into your document preamble from elsewhere.
Some \LaTeX{} packages, such as \texttt{fullpage} or \texttt{savetrees}, change
the margins of your document. Do not include them!
Over-length or incorrectly-formatted dissertations will not be accepted and you
would have to modify your dissertation and resubmit. You cannot assume we will
check your submission before the final deadline and if it requires resubmission
after the deadline to conform to the page and style requirements you will be
subject to the usual late penalties based on your final submission time.
\section{Using Sections}
Divide your chapters into sub-parts as appropriate.
\section{Citations}
Citations (such as \cite{P1} or \cite{P2}) can be generated using
\texttt{BibTeX}. For more advanced usage, we recommend using the \texttt{natbib}
package or the newer \texttt{biblatex} system.
These examples use a numerical citation style. You may use any consistent
reference style that you prefer, including ``(Author, Year)'' citations.
\chapter{Your next chapter}
A dissertation usually contains several chapters.
\chapter{Conclusions}
\section{Final Reminder}
The body of your dissertation, before the references and any appendices,
\emph{must} finish by page~40. The introduction, after preliminary material,
should have started on page~1.
You may not change the dissertation format (e.g., reduce the font size, change
the margins, or reduce the line spacing from the default single spacing). Be
careful if you copy-paste packages into your document preamble from elsewhere.
Some \LaTeX{} packages, such as \texttt{fullpage} or \texttt{savetrees}, change
the margins of your document. Do not include them!
Over-length or incorrectly-formatted dissertations will not be accepted and you
would have to modify your dissertation and resubmit. You cannot assume we will
check your submission before the final deadline and if it requires resubmission
after the deadline to conform to the page and style requirements you will be
subject to the usual late penalties based on your final submission time.
\bibliographystyle{plain}
\bibliography{mybibfile}
% You may delete everything from \appendix up to \end{document} if you don't need it.
\appendix
\chapter{First appendix}
\section{First section}
Any appendices, including any required ethics information, should be included
after the references.
Markers do not have to consider appendices. Make sure that your contributions
are made clear in the main body of the dissertation (within the page limit).
\chapter{Participants' information sheet}
If you had human participants, include key information that they were given in
an appendix, and point to it from the ethics declaration.
\chapter{Participants' consent form}
If you had human participants, include information about how consent was
gathered in an appendix, and point to it from the ethics declaration.
This information is often a copy of a consent form.
\end{document}

61
tex/ugcheck.sty Normal file
View file

@ -0,0 +1,61 @@
% Historically a small number of students change the page layout,
% often accidentally by including a package like geometry or fullpage.
% Here we check if the basic page setup is correct. It does not
% check all aspects of the style guide, or any page limits.
%
% Changing the style in a way that fools these simple checks is still not ok!
%
\RequirePackage{printlen}
\AtBeginDocument{%
% To get the numbers below, include printlen package above and see lengths like this:
%\printlength\oddsidemargin\\
%\printlength\headheight\\
%\printlength\textheight\\
%\printlength\marginparsep\\
%\printlength\footskip\\
%\printlength\hoffset\\
%\printlength\paperwidth\\
%\printlength\topmargin\\
%\printlength\headsep\\
%\printlength\textwidth\\
%\printlength\marginparwidth\\
%\printlength\marginparpush\\
%\printlength\voffset\\
%\printlength\paperheight\\
%\baselinestretch\\
%\@thesispoints\\
%
\newif\ifmarginsmessedwith
\marginsmessedwithfalse
\ifdim\oddsidemargin=41.54103pt \else oddsidemargin has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\headheight=12.0pt \else headheight has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\textheight=674.33032pt \else textheight has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\marginparsep=10.0pt \else marginparsep has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\footskip=30.0pt \else footskip has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\hoffset=0.0pt \else hoffset has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\paperwidth=597.50787pt \else paperwidth has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\topmargin=-52.36449pt \else topmargin has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\headsep=25.0pt \else headsep has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\textwidth=412.56497pt \else textwidth has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\marginparwidth=35.0pt \else marginparwidth has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\marginparpush=7.0pt \else marginparpush has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\voffset=0.0pt \else voffset has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\paperheight=845.04684pt \else paperheight has been altered.\\ \marginsmessedwithtrue\fi
\newcommand{\pts}[1]{#1pt}
\ifdim\pts\baselinestretch = 1pt \else linespacing has been altered.\\ \marginsmessedwithtrue\fi
\ifdim\@thesispoints=12pt \else font size has been altered.\\ \marginsmessedwithtrue\fi
\ifmarginsmessedwith
\textbf{\large \em The required page layout has been changed.}
Please set up your document as in the example skeleton thesis document.
Do not change the page layout, or include packages like geometry,
savetrees, or fullpage, which change it for you.
We're not able to reliably undo arbitrary changes to the style. Please remove
the offending package(s), or layout-changing commands and try again. If you
can't figure out the problem, try adding your \LaTeX\ code a part at a time
to the example document.
\fi}