\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{davidsb} \pdfinfo{ /Title (styrikerfi.pdf) /Creator (Cheatography) /Author (davidsb) /Subject (Stýrikerfi Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Stýrikerfi Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{davidsb} via \textcolor{DarkBackground}{\uline{cheatography.com/27383/cs/7926/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}davidsb \\ \uline{cheatography.com/davidsb} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 17th April, 2016.\\ Updated 12th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 1}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Instruction cycle is fetch, decode, execute \newline % Row Count 1 (+ 1) Cache er small, very fast memory on processor for recently used memory content for quick access \newline % Row Count 3 (+ 2) Memory Hierarchy. Fast, small, expensive on top, slow, large, cheap on bottom% Row Count 5 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 2}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Objectives of OS: Conveniance, efficiency, evolution \newline % Row Count 2 (+ 2) Multiprogramming: Processes use the same Processor \newline % Row Count 4 (+ 2) Batch processing: One program executed before the next one is started \newline % Row Count 6 (+ 2) Processes: A program in execution \newline % Row Count 7 (+ 1) Resource management: Fairness, Differential responsiveness, effiency% Row Count 9 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 3}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Instruction trace : Sequence of instructions executed for a process \newline % Row Count 2 (+ 2) Process states : ready, running, block, suspend. \newline % Row Count 3 (+ 1) Process control block: Contains information for OS to control processes \newline % Row Count 5 (+ 2) PCB Stack = Identification, State, priority, pc, memory pointers, context data, io status, accounting information. \newline % Row Count 8 (+ 3) Kernel mode has access to all, user should be restricted to protect the os.% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 4}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Process can have one or more threads. Threads are execution units within processes while processes are binaries. Process has one process control block while threads gets it's own space on the stack and control block. Threads share the state and resources of that process% Row Count 6 (+ 6) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{kaflar 11 oog 12}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Single buffer - process writes to buffer than has to wait for I/O to write and reverse. Double buffer - Process can write to one buffer and read another, don't have to wait. Circular buffer uses more than 2 buffers. \newline % Row Count 5 (+ 5) Blocking i/o - process continues in non blocking, os takes over if it is blocking% Row Count 7 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 5}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Race condition : "loser" makes the last change, affects all. \newline % Row Count 2 (+ 2) Mutual exclusion: only one process can access code or data. \newline % Row Count 4 (+ 2) Producer/Consumer \newline % Row Count 5 (+ 1) Producer puts data in buffer, consumer takes data from buffer. \newline % Row Count 7 (+ 2) If there is no data consumer sleeps and producer wakes him when he adds data. \newline % Row Count 9 (+ 2) If buffer is full, producer sleeps and consumer wakes him when he takes data. \newline % Row Count 11 (+ 2) Reader/Writer problem \newline % Row Count 12 (+ 1) The conditions that must be satisfied are as follows \newline % Row Count 14 (+ 2) 1.Any number of readers may simultaneously read the file \newline % Row Count 16 (+ 2) 2.Only one writer at a time may write to the file, no reader may read it \newline % Row Count 18 (+ 2) Monitors must be invoked with a call to a monitor procedure. uses wait and signal, if no process is waiting the signal is lost. \newline % Row Count 21 (+ 3) Message passing: direct and indirect.% Row Count 22 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Kafli 6}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Deadlocks} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Causes & Mutual exclusion, no preemption, hold and wait, circular wait \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{Prevention} & Eliminate on of the conditions. Direct eliminates circular waiting, indirect the other 3. Very conservative \tn % Row Count 7 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Avoidance} & Dynamic decision if current resource request will cause deadlock. Bankers algo \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{Detection} & Tests for deadlocks, consumes cosiderable cpu time, liberal with resources. \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{Starvation} & Where process is overlooked by scheduler even though it's ready to run. \tn % Row Count 16 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Kafli 7}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Partitioning} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Fixed equal & Program to big, use overlays, inefficient, internal fragmentation \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} Fixed unequal & Chooses the smalles space it can fit in, might lead to swapping,memory might go unused, internal fragmentation \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} Dynamic & Each process gets exactly what it needs, small holes, external fragmentation, compact \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} Best fit & Chooses the block closest in size \tn % Row Count 13 (+ 2) % Row 5 \SetRowColor{white} first fit & Chooses the next block which can hold the process. scan from beginning \tn % Row Count 16 (+ 3) % Row 6 \SetRowColor{LightBackground} next fit & Starts for current position, finds block next available large enough block. \tn % Row Count 19 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Kafli 8}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Translation lookaside buffer: checks the TLB table and if it's a hit it gets the frame number immediately and can add the offset and find the data it needs else it has to look up the address in the page table. \newline % Row Count 5 (+ 5) Page replacement: FIFO, LRU, Optimal, Clock.% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.09034 cm} x{2.88666 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{kafli 9}} \tn % Row 0 \SetRowColor{LightBackground} Levels of scheduling & Long term, medium term, short term. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Long term & Controls what programs are admitted to the system for processing \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} medium term & if process starts in swap out it is added to medium term scheduler \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} Short term & when program becomes a process it is added to the short term scheduler \tn % Row Count 12 (+ 4) % Row 4 \SetRowColor{LightBackground} Preemptive and non preemptive & Preemtive can take resources, non preemptive can not \tn % Row Count 15 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}