diff --git a/EOPSY/lab3/report/.report.tex.swp b/EOPSY/lab3/report/.report.tex.swp deleted file mode 100644 index d27796c7..00000000 Binary files a/EOPSY/lab3/report/.report.tex.swp and /dev/null differ diff --git a/EOPSY/lab4/EOPSY_LAB_4_KRZYSZTOF_RUDNICKI.pdf b/EOPSY/lab4/EOPSY_LAB_4_KRZYSZTOF_RUDNICKI.pdf new file mode 100644 index 00000000..4d4ab195 Binary files /dev/null and b/EOPSY/lab4/EOPSY_LAB_4_KRZYSZTOF_RUDNICKI.pdf differ diff --git a/EOPSY/lab4/report/mm1.png b/EOPSY/lab4/report/mm1.png new file mode 100644 index 00000000..b00a00e2 Binary files /dev/null and b/EOPSY/lab4/report/mm1.png differ diff --git a/EOPSY/lab4/report/mm2.png b/EOPSY/lab4/report/mm2.png new file mode 100644 index 00000000..6f27d5de Binary files /dev/null and b/EOPSY/lab4/report/mm2.png differ diff --git a/EOPSY/lab4/report/mm3.png b/EOPSY/lab4/report/mm3.png new file mode 100644 index 00000000..d567bafc Binary files /dev/null and b/EOPSY/lab4/report/mm3.png differ diff --git a/EOPSY/lab4/report/mm4.png b/EOPSY/lab4/report/mm4.png new file mode 100644 index 00000000..79df857f Binary files /dev/null and b/EOPSY/lab4/report/mm4.png differ diff --git a/EOPSY/lab4/report/mm5.png b/EOPSY/lab4/report/mm5.png new file mode 100644 index 00000000..94e6c2b4 Binary files /dev/null and b/EOPSY/lab4/report/mm5.png differ diff --git a/EOPSY/lab4/report/mm6.png b/EOPSY/lab4/report/mm6.png new file mode 100644 index 00000000..5034d008 Binary files /dev/null and b/EOPSY/lab4/report/mm6.png differ diff --git a/EOPSY/lab4/report/mm7.png b/EOPSY/lab4/report/mm7.png new file mode 100644 index 00000000..8be5e189 Binary files /dev/null and b/EOPSY/lab4/report/mm7.png differ diff --git a/EOPSY/lab4/report/report.aux b/EOPSY/lab4/report/report.aux index 03929e99..cbd59309 100644 --- a/EOPSY/lab4/report/report.aux +++ b/EOPSY/lab4/report/report.aux @@ -17,9 +17,35 @@ \providecommand\HyField@AuxAddToFields[1]{} \providecommand\HyField@AuxAddToCoFields[2]{} \citation{Page Replacement Algorithms} -\bibcite{Page Replacement Algorithms}{1} +\citation{Page Replacement Algorithms} +\citation{Page Replacement Algorithms} +\citation{pageWiki} \@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Page replacement algorithms}{1}{subsection.1.1}\protected@file@percent } \@writefile{toc}{\contentsline {paragraph}{First in First out}{1}{section*.1}\protected@file@percent } \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces PageFault.java file}}{1}{figure.1}\protected@file@percent } -\@writefile{toc}{\contentsline {paragraph}{Mapping}{1}{section*.2}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {2}Finishing comments}{1}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {paragraph}{Optimal Page Replacement}{1}{section*.2}\protected@file@percent } +\@writefile{toc}{\contentsline {paragraph}{Least Recently Used}{1}{section*.3}\protected@file@percent } +\citation{mmuWiki} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Other}{2}{subsection.1.2}\protected@file@percent } +\@writefile{toc}{\contentsline {paragraph}{Memory Management Unit}{2}{section*.4}\protected@file@percent } +\@writefile{toc}{\contentsline {paragraph}{Page fault}{2}{section*.5}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}Laboratory}{2}{section.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Instruction}{2}{subsection.2.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuration}{2}{subsection.2.2}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces memory.conf file}}{3}{figure.2}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces commands file}}{4}{figure.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Procedure}{5}{subsection.2.3}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces tracefile}}{6}{figure.4}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Very start of application}}{8}{figure.5}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces First step correctly mapped}}{9}{figure.6}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces 16th page correctly mapped}}{10}{figure.7}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {8}{\ignorespaces First page fault on 32th step}}{11}{figure.8}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {9}{\ignorespaces First in First out, we map page 0 physical to the page we just got page fault on}}{12}{figure.9}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {10}{\ignorespaces Again first in, first out}}{13}{figure.10}\protected@file@percent } +\bibcite{mmuWiki}{1} +\@writefile{lof}{\contentsline {figure}{\numberline {11}{\ignorespaces Final view of application}}{14}{figure.11}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}Finishing comments}{14}{section.3}\protected@file@percent } +\bibcite{faultWiki}{2} +\bibcite{Page Replacement Algorithms}{3} +\bibcite{pageWiki}{4} diff --git a/EOPSY/lab4/report/report.fdb_latexmk b/EOPSY/lab4/report/report.fdb_latexmk index da7087c5..44476e60 100644 --- a/EOPSY/lab4/report/report.fdb_latexmk +++ b/EOPSY/lab4/report/report.fdb_latexmk @@ -1,5 +1,5 @@ # Fdb version 3 -["pdflatex"] 1651819250 "report.tex" "report.pdf" "report" 1651819251 +["pdflatex"] 1651873378 "report.tex" "report.pdf" "report" 1651873378 "/etc/texmf/web2c/texmf.cnf" 1649511474 475 c0e671620eb5563b2130f56340a5fde8 "" "/usr/share/texlive/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 "" "/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/tcti1000.tfm" 1136768653 2048 3777f70f4372b17e2d3fda2b5684af05 "" @@ -77,11 +77,18 @@ "/usr/share/texmf/web2c/texmf.cnf" 1581979058 38841 ce3692aa899bb693b90b87eaa5d4d84e "" "/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map" 1649511498 4770781 1ed1abab22da9c3e2cc82e4db562318b "" "/var/lib/texmf/web2c/pdftex/pdflatex.fmt" 1649511522 8256308 efb305160d4d659dcd0c4df67bdfa340 "" - "report.aux" 1651819250 1291 2ad45efb724135c31d626d6936d14b17 "pdflatex" - "report.out" 1651819250 100 25fdc042cd41a4fc702071f1ee9cd704 "pdflatex" - "report.tex" 1651819249 1665 7fe501939e4c3d08e14885cab811844d "" + "mm1.png" 1651872367 13028 31af420353ece32f7494128003dbffaf "" + "mm2.png" 1651872375 13116 c3e873b1ba354ba43d7b6eb9470b0bd6 "" + "mm3.png" 1651872399 13219 94c9555ab465af789980738d5f1c2536 "" + "mm4.png" 1651872411 13219 831ca09a484aef81b028f35bcb2477a5 "" + "mm5.png" 1651872418 13185 8d670ae1494b8c40c74135a114fafefa "" + "mm6.png" 1651872426 13206 35c1d3862e02fa30a217bc45585960f1 "" + "mm7.png" 1651872466 14687 d757d7ec7fd0db9517bbf4d9bce1e180 "" + "report.aux" 1651873378 3899 9d93be87e479de6fc8cb4c757de8f751 "pdflatex" + "report.out" 1651873378 455 4916b4a3abc871847d3be1481c7d301d "pdflatex" + "report.tex" 1651873377 9779 3df555b282997bb28c357aee6eddcac8 "" (generated) "report.pdf" "report.aux" - "report.out" "report.log" + "report.out" diff --git a/EOPSY/lab4/report/report.fls b/EOPSY/lab4/report/report.fls index bdb58bff..c455e7b1 100644 --- a/EOPSY/lab4/report/report.fls +++ b/EOPSY/lab4/report/report.fls @@ -117,6 +117,7 @@ INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmsy8.tfm INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmsy6.tfm INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmr12.tfm INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx12.tfm +INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx12.tfm INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx10.tfm INPUT /usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty INPUT /usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty @@ -127,6 +128,27 @@ INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/tcti1000.tfm INPUT /usr/share/texlive/texmf-dist/tex/latex/base/omlcmr.fd INPUT /usr/share/texlive/texmf-dist/tex/latex/base/omlcmr.fd INPUT /var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map +INPUT mm1.png +INPUT ./mm1.png +INPUT ./mm1.png +INPUT mm2.png +INPUT ./mm2.png +INPUT ./mm2.png +INPUT mm3.png +INPUT ./mm3.png +INPUT ./mm3.png +INPUT mm4.png +INPUT ./mm4.png +INPUT ./mm4.png +INPUT mm5.png +INPUT ./mm5.png +INPUT ./mm5.png +INPUT mm6.png +INPUT ./mm6.png +INPUT ./mm6.png +INPUT mm7.png +INPUT ./mm7.png +INPUT ./mm7.png INPUT report.aux INPUT ./report.out INPUT ./report.out diff --git a/EOPSY/lab4/report/report.log b/EOPSY/lab4/report/report.log index 8d82079b..8260961a 100644 --- a/EOPSY/lab4/report/report.log +++ b/EOPSY/lab4/report/report.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2022.4.9) 6 MAY 2022 08:40 +This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2022.4.9) 6 MAY 2022 23:42 entering extended mode restricted \write18 enabled. file:line:error style messages enabled. @@ -289,52 +289,148 @@ LaTeX Font Info: External font `cmex10' loaded for size (/usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty File: lstlang1.sty 2019/09/10 1.8c listings language file ) -LaTeX Font Info: Trying to load font information for OMS+cmr on input line 20. +LaTeX Font Info: Trying to load font information for OMS+cmr on input line 22. (/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd File: omscmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions ) LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available -(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 20. -LaTeX Font Info: Trying to load font information for OML+cmr on input line 25. +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. +LaTeX Font Info: Trying to load font information for OML+cmr on input line 27. (/usr/share/texlive/texmf-dist/tex/latex/base/omlcmr.fd File: omlcmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions ) LaTeX Font Info: Font shape `OML/cmr/m/it' in size <10> not available -(Font) Font shape `OML/cmm/m/it' tried instead on input line 25. +(Font) Font shape `OML/cmm/m/it' tried instead on input line 27. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 27. +(Font) <7> on input line 29. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 27. -Package atveryend Info: Empty hook `BeforeClearDocument' on input line 48. +(Font) <5> on input line 29. [1 {/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}pdfTeX warning (ext4): destination with the same identifier (name{figure.1}) has been already used, duplicate ignored \AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi -l.48 \end{document} - ] -Package atveryend Info: Empty hook `AfterLastShipout' on input line 48. +l.62 \subsection + {Other}] +LaTeX Font Info: Font shape `OML/cmr/m/n' in size <10> not available +(Font) Font shape `OML/cmm/m/it' tried instead on input line 102. + [2] [3pdfTeX warning (ext4): destination with the same identifier (name{figure.2}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.242 \end{figure} + ] [4pdfTeX warning (ext4): destination with the same identifier (name{figure.3}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.242 \end{figure} + ] [5] + +File: mm1.png Graphic file (type png) + +Package pdftex.def Info: mm1.png used on input line 256. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [6pdfTeX warning (ext4): destination with the same identifier (name{figure.4}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.257 \end{figure} + ] + +File: mm2.png Graphic file (type png) + +Package pdftex.def Info: mm2.png used on input line 260. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [7] + +File: mm3.png Graphic file (type png) + +Package pdftex.def Info: mm3.png used on input line 264. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [8pdfTeX warning (ext4): destination with the same identifier (name{figure.5}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.265 \end{figure} + <./mm1.png>] + +File: mm4.png Graphic file (type png) + +Package pdftex.def Info: mm4.png used on input line 268. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [9pdfTeX warning (ext4): destination with the same identifier (name{figure.6}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.269 \end{figure} + <./mm2.png>] + +File: mm5.png Graphic file (type png) + +Package pdftex.def Info: mm5.png used on input line 273. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [10pdfTeX warning (ext4): destination with the same identifier (name{figure.7}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.274 \end{figure} + <./mm3.png>] + +File: mm6.png Graphic file (type png) + +Package pdftex.def Info: mm6.png used on input line 277. +(pdftex.def) Requested size: 433.62001pt x 506.79997pt. + [11pdfTeX warning (ext4): destination with the same identifier (name{figure.8}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.278 \end{figure} + <./mm4.png>] + +File: mm7.png Graphic file (type png) + +Package pdftex.def Info: mm7.png used on input line 281. +(pdftex.def) Requested size: 433.62001pt x 455.41608pt. + [12pdfTeX warning (ext4): destination with the same identifier (name{figure.9}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.282 \end{figure} + <./mm5.png>] [13pdfTeX warning (ext4): destination with the same identifier (name{figure.10}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.283 \section + {Finishing comments} <./mm6.png>] [14pdfTeX warning (ext4): destination with the same identifier (name{figure.11}) has been already used, duplicate ignored + +\AtBegShi@Output ...ipout \box \AtBeginShipoutBox + \fi \fi +l.291 \bibitem{faultWiki} + \href{https://en.wikipedia.org/wiki/Page_fault}{[... <./mm7.png>] +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 299. + [15] +Package atveryend Info: Empty hook `AfterLastShipout' on input line 299. (./report.aux) -Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 48. -Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 48. +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 299. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 299. Package rerunfilecheck Info: File `report.out' has not changed. -(rerunfilecheck) Checksum: 25FDC042CD41A4FC702071F1EE9CD704;100. -Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 48. +(rerunfilecheck) Checksum: 4916B4A3ABC871847D3BE1481C7D301D;455. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 299. ) Here is how much of TeX's memory you used: - 7424 strings out of 481239 - 110306 string characters out of 5920378 - 570541 words of memory out of 5000000 - 22566 multiletter control sequences out of 15000+600000 - 537009 words of font info for 39 fonts, out of 8000000 for 9000 + 7738 strings out of 481239 + 114084 string characters out of 5920378 + 628834 words of memory out of 5000000 + 22707 multiletter control sequences out of 15000+600000 + 537316 words of font info for 40 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 - 34i,6n,42p,215b,1492s stack positions out of 5000i,500n,10000p,200000b,80000s + 34i,6n,42p,226b,1493s stack positions out of 5000i,500n,10000p,200000b,80000s {/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc} -Output written on report.pdf (1 page, 96710 bytes). +Output written on report.pdf (15 pages, 205194 bytes). PDF statistics: - 85 PDF objects out of 1000 (max. 8388607) - 72 compressed objects within 1 object stream - 24 named destinations out of 1000 (max. 500000) - 17 words of extra memory for PDF output out of 10000 (max. 10000000) + 380 PDF objects out of 1000 (max. 8388607) + 336 compressed objects within 4 object streams + 196 named destinations out of 1000 (max. 500000) + 100 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/EOPSY/lab4/report/report.out b/EOPSY/lab4/report/report.out index a9178fc8..67691293 100644 --- a/EOPSY/lab4/report/report.out +++ b/EOPSY/lab4/report/report.out @@ -1,2 +1,8 @@ \BOOKMARK [1][-]{section.1}{Introduction}{}% 1 -\BOOKMARK [1][-]{section.2}{Finishing comments}{}% 2 +\BOOKMARK [2][-]{subsection.1.1}{Page replacement algorithms}{section.1}% 2 +\BOOKMARK [2][-]{subsection.1.2}{Other}{section.1}% 3 +\BOOKMARK [1][-]{section.2}{Laboratory}{}% 4 +\BOOKMARK [2][-]{subsection.2.1}{Instruction}{section.2}% 5 +\BOOKMARK [2][-]{subsection.2.2}{Configuration}{section.2}% 6 +\BOOKMARK [2][-]{subsection.2.3}{Procedure}{section.2}% 7 +\BOOKMARK [1][-]{section.3}{Finishing comments}{}% 8 diff --git a/EOPSY/lab4/report/report.pdf b/EOPSY/lab4/report/report.pdf index 166a635e..4d4ab195 100644 Binary files a/EOPSY/lab4/report/report.pdf and b/EOPSY/lab4/report/report.pdf differ diff --git a/EOPSY/lab4/report/report.synctex.gz b/EOPSY/lab4/report/report.synctex.gz index 281b7281..1486228c 100644 Binary files a/EOPSY/lab4/report/report.synctex.gz and b/EOPSY/lab4/report/report.synctex.gz differ diff --git a/EOPSY/lab4/report/report.tex b/EOPSY/lab4/report/report.tex index 4fa15a74..1bfbfa94 100644 --- a/EOPSY/lab4/report/report.tex +++ b/EOPSY/lab4/report/report.tex @@ -10,8 +10,9 @@ \date{\today} \maketitle \section{Introduction} -\subsection{Page replacament algorithms} +\subsection{Page replacement algorithms} \paragraph{First in First out} +What page replacament algorithm is being used? \\ We use FIFO (First in First out) page replacement algorithm for those laboratories as indicated by the PageFault.java file line 18 \begin{figure}[H] @@ -45,16 +46,249 @@ We replace pages which in the future will not be used for the longest time. This is purely theoretical algorithm. It is perfect but not doable in practice since operating systems can not know future requests. \\ It is used as a benchmark against which we compare other algorithms. -\cite{Page Replacament Algorithms} +\cite{Page Replacement Algorithms} \paragraph{Least Recently Used} -We replace page which was not used for the longest time. -\cite{Page Replacamanet Algorithms} +We replace page which was not used for the longest time. \\ +It is based on the idea that we will in future work on pages which we used +heavily in the past. In theory its performance can be close to optimal one but +in practice it is expensive to implement. \\ +Most expensive way of implementing this algorithm is using linked lists. Most +recently used pages in front, least recently used in the back. Every time we +reference memory we have to move elements in list which takes a lot of time. \\ +We can also use operating system counter \\ +This algorithm is often used in different cheaper modified versions. +\cite{Page Replacement Algorithms} \cite{pageWiki} -\paragraph{Mapping} +\subsection{Other} +\paragraph{Memory Management Unit} +Hardware unit which translates virtual memory to physical one. +\cite{mmuWiki} +\paragraph{Page fault} +Exception raised when process wants to access page without preparations. +Preparation consists of adding the mapping to process's virtual address space +and/or loading page from a disk. MMU detects the fault but it is up to kernel +and/or loading page from a disk. +\section{Laboratory} +\subsection{Instruction} +\begin{enumerate} + \item Map 8 pages of physical memory to the first 8 pages of virtual + memory + \item Go through each virtual page and read from one virtual memory + address +\end{enumerate} +\subsection{Configuration} +In memory.conf file I changed the memset and mapped first 8 pages of virtual +memory to first 8 pages of physical memory (we could use any physical memory +pages we wanted so I settled for this for sake of simplicity) +\begin{figure}[H] +\caption{memory.conf file} +\begin{lstlisting} +// memset virt page # physical page # R (read from) +// M (modified) inMemTime (ns) lastTouchTime (ns) +memset 0 0 0 0 0 0 +memset 1 1 0 0 0 0 +memset 2 2 0 0 0 0 +memset 3 3 0 0 0 0 +memset 4 4 0 0 0 0 +memset 5 5 0 0 0 0 +memset 6 6 0 0 0 0 +memset 7 7 0 0 0 0 +// enable_logging 'true' or 'false' +// When true specify a log_file or leave blank for stdout +enable_logging true + +// log_file +// Where is the name of the file you want output +// to be print to. +log_file tracefile + +// page size, defaults to 2^14 and cannot be greater than 2^26 +// pagesize or <'power' num (base 2)> +pagesize 16384 + +// addressradix sets the radix +// in which numerical values are displayed +// 2 is the default value +// addressradix +addressradix 16 + +// numpages sets the number of pages (physical and virtual) +// 64 is the default value +// numpages must be at least 2 and no more than 64 +// numpages +numpages 64 +\end{lstlisting} +\end{figure} +We want to access each virtual page and read from one virtualk memory address of +each page. \\ +To achieve this we need to read from pages in increments of pagesize. Which is +set by default to 16384 and I do not change that. \\ +We have 64 pages so the last address we will read from will be address +\[ 64 \cdot 16384 = 1048576 \] +And since we start from address number 0 we need to substract +\[ 1048576 - 16384 = 1032192 \] +And so the last address we will read from is \textbf{1032192} \\ +We modify the commands file accordingly +\begin{figure} + \caption{commands file} +\begin{lstlisting} +READ 0 +READ 16384 +READ 32768 +READ 49152 +READ 65536 +READ 81920 +READ 98304 +READ 114688 +READ 131072 +READ 147456 +READ 163840 +READ 180224 +READ 196608 +READ 212992 +READ 229376 +READ 245760 +READ 262144 +READ 278528 +READ 294912 +READ 311296 +READ 327680 +READ 344064 +READ 360448 +READ 376832 +READ 393216 +READ 409600 +[...] +READ 704512 +READ 720896 +READ 737280 +READ 753664 +READ 770048 +READ 786432 +READ 802816 +READ 819200 +READ 835584 +READ 851968 +READ 868352 +READ 884736 +READ 901120 +READ 917504 +READ 933888 +READ 950272 +READ 966656 +READ 983040 +READ 999424 +READ 1015808 +READ 1032192 +\end{lstlisting} +\end{figure} +\subsection{Procedure} +After modifying config files I run the simulation using make compile and make +run in work directory and go step by step through the program. +\begin{figure}[H] + \caption{tracefile} +\begin{lstlisting} +READ 0 ... okay +READ 4000 ... okay +READ 8000 ... okay +READ c000 ... okay +READ 10000 ... okay +READ 14000 ... okay +READ 18000 ... okay +READ 1c000 ... okay +READ 20000 ... okay +READ 24000 ... okay +READ 28000 ... okay +READ 2c000 ... okay +READ 30000 ... okay +READ 34000 ... okay +READ 38000 ... okay +READ 3c000 ... okay +READ 40000 ... okay +READ 44000 ... okay +[...] +READ 54000 ... okay +READ 58000 ... okay +READ 5c000 ... okay +READ 60000 ... okay +READ 64000 ... okay +READ 68000 ... okay +READ 6c000 ... okay +READ 70000 ... okay +READ 74000 ... okay +READ 78000 ... okay +READ 7c000 ... okay +READ 80000 ... page fault +READ 84000 ... page fault +READ 88000 ... page fault +READ 8c000 ... page fault +READ 90000 ... page fault +READ 94000 ... page fault +READ 98000 ... page fault +READ 9c000 ... page fault +READ a0000 ... page fault +READ a4000 ... page fault +[...] +READ e4000 ... page fault +READ e8000 ... page fault +READ ec000 ... page fault +READ f0000 ... page fault +READ f4000 ... page fault +READ f8000 ... page fault +READ fc000 ... page fault% +\end{lstlisting} +\end{figure} +As we can see mapping first 8 pages was successful. Their mapping was specified +in memory.conf file and they were mapped as expected. \\ +Then pages up to 32 were also mapped correctly \\ +Then we get to page number 32 and we get page fault. We do not have mapping +between this page and physical page so we use algorithm of first in first out +and map page 32 to page 0, which was mapped to virtual page 0 in the first step. +\\ +This process gets repeated up to the last page. We take the virtual page which +was mapped to physical one as a first one and we map it to virtual page which +got page fault error. \\ +This can be observed on following screens: +\begin{figure}[H] + \caption{Very start of application} + \includegraphics[width=\linewidth]{mm1} +\end{figure} +\begin{figure}[H] + \caption{First step correctly mapped} + \includegraphics[width=\linewidth]{mm2} +\end{figure} +\begin{figure}[H] + \caption{16th page correctly mapped} + \includegraphics[width=\linewidth]{mm3} +\end{figure} +\begin{figure}[H] + \caption{First page fault on 32th step} + \includegraphics[width=\linewidth]{mm4} +\end{figure} +\begin{figure}[H] + \caption{First in First out, we map page 0 physical to the page we just + got page fault on} + \includegraphics[width=\linewidth]{mm5} +\end{figure} +\begin{figure}[H] + \caption{Again first in, first out} + \includegraphics[width=\linewidth]{mm6} +\end{figure} +\begin{figure}[H] + \caption{Final view of application} + \includegraphics[width=\linewidth]{mm7} +\end{figure} \section{Finishing comments} +Both by looking at the source code and simulation results we can say that the +simulation uses First in First out algorithm. First 8 pages were mapped +correctly because of the memory.conf file, pages up to 32 were mapped correctly +because they are mapped by default by the application. \\ +Then we got page faults which were resolved by first in first out algorithm. \begin{thebibliography}{9} + \bibitem{mmuWiki} \href{https://en.wikipedia.org/wiki/Memory_management_unit}{Wiki Memory Management Unit} + \bibitem{faultWiki} \href{https://en.wikipedia.org/wiki/Page_fault}{[Wiki Page Fault]} \bibitem{Page Replacement Algorithms} \href{https://www.geeksforgeeks.org/page-replacement-algorithms-in-operating-systems/}{[Geeks for Geeks page replacament algorithms]} diff --git a/EOPSY/lab4/task4/work/.memory.conf.swp b/EOPSY/lab4/task4/work/.memory.conf.swp deleted file mode 100644 index 235982c0..00000000 Binary files a/EOPSY/lab4/task4/work/.memory.conf.swp and /dev/null differ diff --git a/EOPSY/lab4/task4/work/commands b/EOPSY/lab4/task4/work/commands index f80c6f81..d7a15e62 100644 --- a/EOPSY/lab4/task4/work/commands +++ b/EOPSY/lab4/task4/work/commands @@ -1,11 +1,73 @@ // Enter READ/WRITE commands into this file // READ // WRITE -READ bin 100 -READ 19 -WRITE hex CC32 -READ bin 100000000000000 -READ bin 100000000000000 -WRITE bin 110000000000001 -WRITE random +// Enter READ/WRITE commands into this file +// READ +// WRITE +//64 addresses increasing by 16384 +READ 0 +READ 16384 +READ 32768 +READ 49152 +READ 65536 +READ 81920 +READ 98304 +READ 114688 +READ 131072 +READ 147456 +READ 163840 +READ 180224 +READ 196608 +READ 212992 +READ 229376 +READ 245760 +READ 262144 +READ 278528 +READ 294912 +READ 311296 +READ 327680 +READ 344064 +READ 360448 +READ 376832 +READ 393216 +READ 409600 +READ 425984 +READ 442368 +READ 458752 +READ 475136 +READ 491520 +READ 507904 +READ 524288 +READ 540672 +READ 557056 +READ 573440 +READ 589824 +READ 606208 +READ 622592 +READ 638976 +READ 655360 +READ 671744 +READ 688128 +READ 704512 +READ 720896 +READ 737280 +READ 753664 +READ 770048 +READ 786432 +READ 802816 +READ 819200 +READ 835584 +READ 851968 +READ 868352 +READ 884736 +READ 901120 +READ 917504 +READ 933888 +READ 950272 +READ 966656 +READ 983040 +READ 999424 +READ 1015808 +READ 1032192 + diff --git a/EOPSY/lab4/task4/work/tracefile b/EOPSY/lab4/task4/work/tracefile new file mode 100644 index 00000000..6e1b2d31 --- /dev/null +++ b/EOPSY/lab4/task4/work/tracefile @@ -0,0 +1,64 @@ +READ 0 ... okay +READ 4000 ... okay +READ 8000 ... okay +READ c000 ... okay +READ 10000 ... okay +READ 14000 ... okay +READ 18000 ... okay +READ 1c000 ... okay +READ 20000 ... okay +READ 24000 ... okay +READ 28000 ... okay +READ 2c000 ... okay +READ 30000 ... okay +READ 34000 ... okay +READ 38000 ... okay +READ 3c000 ... okay +READ 40000 ... okay +READ 44000 ... okay +READ 48000 ... okay +READ 4c000 ... okay +READ 50000 ... okay +READ 54000 ... okay +READ 58000 ... okay +READ 5c000 ... okay +READ 60000 ... okay +READ 64000 ... okay +READ 68000 ... okay +READ 6c000 ... okay +READ 70000 ... okay +READ 74000 ... okay +READ 78000 ... okay +READ 7c000 ... okay +READ 80000 ... page fault +READ 84000 ... page fault +READ 88000 ... page fault +READ 8c000 ... page fault +READ 90000 ... page fault +READ 94000 ... page fault +READ 98000 ... page fault +READ 9c000 ... page fault +READ a0000 ... page fault +READ a4000 ... page fault +READ a8000 ... page fault +READ ac000 ... page fault +READ b0000 ... page fault +READ b4000 ... page fault +READ b8000 ... page fault +READ bc000 ... page fault +READ c0000 ... page fault +READ c4000 ... page fault +READ c8000 ... page fault +READ cc000 ... page fault +READ d0000 ... page fault +READ d4000 ... page fault +READ d8000 ... page fault +READ dc000 ... page fault +READ e0000 ... page fault +READ e4000 ... page fault +READ e8000 ... page fault +READ ec000 ... page fault +READ f0000 ... page fault +READ f4000 ... page fault +READ f8000 ... page fault +READ fc000 ... page fault \ No newline at end of file