Documentation for 95ed72a452

This commit is contained in:
github-actions
2021-10-15 16:44:16 +00:00
parent 567c4ff764
commit 7e9f4857e2
365 changed files with 6848 additions and 4620 deletions

View File

@@ -0,0 +1,376 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: cpu_scheduling_algorithms/fcfs_scheduling.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('df/d47/fcfs__scheduling_8cpp.html','../../'); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">fcfs_scheduling.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Implementation of <a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> CPU scheduling algorithm.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;algorithm&gt;</code><br />
<code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;cstdlib&gt;</code><br />
<code>#include &lt;ctime&gt;</code><br />
<code>#include &lt;iomanip&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;queue&gt;</code><br />
<code>#include &lt;unordered_set&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for fcfs_scheduling.cpp:</div>
<div class="dyncontent">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d4/d2f/fcfs__scheduling_8cpp__incl.svg" width="100%" height="395"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d4a/class_compare.html">Compare&lt; S, T, E &gt;</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Comparator class for priority queue. <a href="../../de/d4a/class_compare.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/dca/class_f_c_f_s.html">FCFS&lt; S, T, E &gt;</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class which implements the <a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> scheduling algorithm. <a href="../../dd/dca/class_f_c_f_s.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a18920aa331faf4476b251c8cdb2c2bec"><td class="memTemplParams" colspan="2">template&lt;typename S , typename T , typename E &gt; </td></tr>
<tr class="memitem:a18920aa331faf4476b251c8cdb2c2bec"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../df/d47/fcfs__scheduling_8cpp.html#a18920aa331faf4476b251c8cdb2c2bec">sortcol</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E &gt; &amp;t1, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E &gt; &amp;t2)</td></tr>
<tr class="memdesc:a18920aa331faf4476b251c8cdb2c2bec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Comparator function for sorting a vector. <a href="../../df/d47/fcfs__scheduling_8cpp.html#a18920aa331faf4476b251c8cdb2c2bec">More...</a><br /></td></tr>
<tr class="separator:a18920aa331faf4476b251c8cdb2c2bec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f2b90cb64d63a7080965e66a05ccf86"><td class="memTemplParams" colspan="2">template&lt;typename S , typename T , typename E &gt; </td></tr>
<tr class="memitem:a8f2b90cb64d63a7080965e66a05ccf86"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E, double, double, double &gt; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../df/d47/fcfs__scheduling_8cpp.html#a8f2b90cb64d63a7080965e66a05ccf86">get_final_status</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; uint32_t, uint32_t, uint32_t &gt; &gt; input)</td></tr>
<tr class="memdesc:a8f2b90cb64d63a7080965e66a05ccf86"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to be used for testing purposes. This function guarantees the correct solution for <a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> scheduling algorithm. <a href="../../df/d47/fcfs__scheduling_8cpp.html#a8f2b90cb64d63a7080965e66a05ccf86">More...</a><br /></td></tr>
<tr class="separator:a8f2b90cb64d63a7080965e66a05ccf86"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <a href="../../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">More...</a><br /></td></tr>
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d47/fcfs__scheduling_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Entry point of the program. <a href="../../df/d47/fcfs__scheduling_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">More...</a><br /></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Implementation of <a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> CPU scheduling algorithm. </p>
<p ><a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> is a non-preemptive CPU scheduling algorithm in which whichever process arrives first, gets executed first. If two or more processes arrive simultaneously, the process with smaller process ID gets executed first. <a class="el" href="../../">https://bit.ly/3ABNXOC</a>Pratyush Vatsa </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a8f2b90cb64d63a7080965e66a05ccf86" name="a8f2b90cb64d63a7080965e66a05ccf86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8f2b90cb64d63a7080965e66a05ccf86">&#9670;&nbsp;</a></span>get_final_status()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename S , typename T , typename E &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E, double, double, double &gt; &gt; get_final_status </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; uint32_t, uint32_t, uint32_t &gt; &gt;&#160;</td>
<td class="paramname"><em>input</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Function to be used for testing purposes. This function guarantees the correct solution for <a class="el" href="../../dd/dca/class_f_c_f_s.html" title="Class which implements the FCFS scheduling algorithm.">FCFS</a> scheduling algorithm. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">input</td><td>the input data</td></tr>
</table>
</dd>
</dl>
<p>Sorts the input vector according to arrival time. Processes whose arrival times are same get sorted according to process ID For each process, completion time, turnaround time and completion time are calculated, inserted in a tuple, which is added to the vector result. </p><dl class="section return"><dt>Returns</dt><dd>A vector of tuples consisting of process ID, arrival time, burst time, completion time, turnaround time and waiting time for each process. </dd></dl>
<div class="fragment"><div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> {</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/sort.html">sort</a>(input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/begin.html">begin</a>(), input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/end.html">end</a>(), sortcol&lt;S, T, E&gt;);</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector&lt;tuple&lt;S, T, E, double, double, double&gt;</a>&gt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>(input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>());</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="keywordtype">double</span> timeElapsed = 0;</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i{}; i &lt; input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>(); i++) {</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> T arrival = get&lt;1&gt;(input[i]);</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> E burst = get&lt;2&gt;(input[i]);</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> </div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> <span class="keywordflow">if</span> (arrival &gt; timeElapsed) {</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> timeElapsed += arrival - timeElapsed;</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> }</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> timeElapsed += burst;</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> <span class="keywordtype">double</span> completion = timeElapsed;</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> <span class="keywordtype">double</span> turnaround = completion - arrival;</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> <span class="keywordtype">double</span> waiting = turnaround - burst;</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> </div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> get&lt;0&gt;(result[i]) = get&lt;0&gt;(input[i]);</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> get&lt;1&gt;(result[i]) = arrival;</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> get&lt;2&gt;(result[i]) = burst;</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> get&lt;3&gt;(result[i]) = completion;</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> get&lt;4&gt;(result[i]) = turnaround;</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> get&lt;5&gt;(result[i]) = waiting;</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> }</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>;</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span>}</div>
<div class="ttc" id="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/begin.html">std::vector::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/end.html">std::vector::end</a></div><div class="ttdeci">T end(T... args)</div></div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition:</b> fibonacci_sum.cpp:76</div></div>
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
<div class="ttc" id="asort_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/sort.html">std::sort</a></div><div class="ttdeci">T sort(T... args)</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Entry point of the program. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> {</div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> <a class="code hl_function" href="../../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span>}</div>
<div class="ttc" id="afcfs__scheduling_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> fcfs_scheduling.cpp:256</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d47/fcfs__scheduling_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="575" height="170"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="a18920aa331faf4476b251c8cdb2c2bec" name="a18920aa331faf4476b251c8cdb2c2bec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a18920aa331faf4476b251c8cdb2c2bec">&#9670;&nbsp;</a></span>sortcol()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename S , typename T , typename E &gt; </div>
<table class="memname">
<tr>
<td class="memname">bool sortcol </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E &gt; &amp;&#160;</td>
<td class="paramname"><em>t1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/tuple.html">tuple</a>&lt; S, T, E &gt; &amp;&#160;</td>
<td class="paramname"><em>t2</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Comparator function for sorting a vector. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">S</td><td>Data type of Process ID </td></tr>
<tr><td class="paramname">T</td><td>Data type of Arrival time </td></tr>
<tr><td class="paramname">E</td><td>Data type of Burst time </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">t1</td><td>First tuple </td></tr>
<tr><td class="paramname">t2</td><td>Second tuple </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if t1 and t2 are in the CORRECT order </dd>
<dd>
false if t1 and t2 are in the INCORRECT order </dd></dl>
<div class="fragment"><div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> {</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">if</span> (get&lt;1&gt;(t1) &lt; get&lt;1&gt;(t2)) {</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (get&lt;1&gt;(t1) == get&lt;1&gt;(t2) &amp;&amp; get&lt;0&gt;(t1) &lt; get&lt;0&gt;(t2)) {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> }</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">&#9670;&nbsp;</a></span>test()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void test </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Self-test implementations. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> {</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i{}; i &lt; 1000; i++) {</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">time</a>(<span class="keyword">nullptr</span>));</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> uint32_t n = 1 + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">rand</a>() % 1000;</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> <a class="code hl_class" href="../../dd/dca/class_f_c_f_s.html">FCFS&lt;uint32_t, uint32_t, uint32_t&gt;</a> readyQueue;</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector&lt;tuple&lt;uint32_t, uint32_t, uint32_t&gt;</a>&gt; input(n);</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> </div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> <span class="keywordflow">for</span> (uint32_t i{}; i &lt; n; i++) {</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> get&lt;0&gt;(input[i]) = i;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">time</a>(<span class="keyword">nullptr</span>));</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> get&lt;1&gt;(input[i]) = 1 + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">rand</a>() % 10000;</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">time</a>(<span class="keyword">nullptr</span>));</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> get&lt;2&gt;(input[i]) = 1 + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">rand</a>() % 10000;</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> }</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> </div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> <span class="keywordflow">for</span> (uint32_t i{}; i &lt; n; i++) {</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> readyQueue.<a class="code hl_function" href="../../dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69">addProcess</a>(get&lt;0&gt;(input[i]), get&lt;1&gt;(input[i]),</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> get&lt;2&gt;(input[i]));</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> }</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector&lt;tuple&lt;uint32_t, uint32_t, uint32_t, double, double, double&gt;</a>&gt;</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> res = get_final_status&lt;uint32_t, uint32_t, uint32_t&gt;(input);</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> assert(res == readyQueue.<a class="code hl_function" href="../../dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91">scheduleForFcfs</a>());</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> <span class="comment">// readyQueue.printResult();</span></div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span> }</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">cout</a> &lt;&lt; <span class="stringliteral">&quot;All the tests have successfully passed!&quot;</span> &lt;&lt; <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="aclass_f_c_f_s_html"><div class="ttname"><a href="../../dd/dca/class_f_c_f_s.html">FCFS</a></div><div class="ttdoc">Class which implements the FCFS scheduling algorithm.</div><div class="ttdef"><b>Definition:</b> fcfs_scheduling.cpp:97</div></div>
<div class="ttc" id="aclass_f_c_f_s_html_a8fbfe4d85f7576b4a7aade07d29fbd69"><div class="ttname"><a href="../../dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69">FCFS::addProcess</a></div><div class="ttdeci">void addProcess(S id, T arrival, E burst)</div><div class="ttdoc">Adds the process to the ready queue if it isn't already there.</div><div class="ttdef"><b>Definition:</b> fcfs_scheduling.cpp:129</div></div>
<div class="ttc" id="aclass_f_c_f_s_html_aa25dbe30ba9930b5a7c1a6d11758bd91"><div class="ttname"><a href="../../dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91">FCFS::scheduleForFcfs</a></div><div class="ttdeci">vector&lt; tuple&lt; S, T, E, double, double, double &gt; &gt; scheduleForFcfs()</div><div class="ttdoc">Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor...</div><div class="ttdef"><b>Definition:</b> fcfs_scheduling.cpp:154</div></div>
<div class="ttc" id="amatrix__exponentiation_8cpp_html_a600eaf353befc174637855795f12d258"><div class="ttname"><a href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a></div><div class="ttdeci">#define endl</div><div class="ttdef"><b>Definition:</b> matrix_exponentiation.cpp:36</div></div>
<div class="ttc" id="arand_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a></div><div class="ttdeci">T rand(T... args)</div></div>
<div class="ttc" id="asrand_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a></div><div class="ttdeci">T srand(T... args)</div></div>
<div class="ttc" id="atime_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/chrono/c/time.html">std::time</a></div><div class="ttdeci">T time(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d47/fcfs__scheduling_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="476" height="170"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_cc8e79ed9d2b7756c78e8d0c87c6c0c7.html">cpu_scheduling_algorithms</a></li><li class="navelem"><a class="el" href="../../df/d47/fcfs__scheduling_8cpp.html">fcfs_scheduling.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,9 @@
var fcfs__scheduling_8cpp =
[
[ "Compare< S, T, E >", "de/d4a/class_compare.html", "de/d4a/class_compare" ],
[ "FCFS< S, T, E >", "dd/dca/class_f_c_f_s.html", "dd/dca/class_f_c_f_s" ],
[ "get_final_status", "df/d47/fcfs__scheduling_8cpp.html#a8f2b90cb64d63a7080965e66a05ccf86", null ],
[ "main", "df/d47/fcfs__scheduling_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
[ "sortcol", "df/d47/fcfs__scheduling_8cpp.html#a18920aa331faf4476b251c8cdb2c2bec", null ],
[ "test", "df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ]
];

View File

@@ -0,0 +1,8 @@
<map id="test" name="test">
<area shape="rect" id="node1" title="Self&#45;test implementations." alt="" coords="5,89,49,116"/>
<area shape="rect" id="node2" href="$dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69" title="Adds the process to the ready queue if it isn&#39;t already there." alt="" coords="111,64,246,91"/>
<area shape="rect" id="node6" href="$dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91" title="Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor..." alt="" coords="97,115,260,141"/>
<area shape="rect" id="node3" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/end.html#" title=" " alt="" coords="308,5,471,32"/>
<area shape="rect" id="node4" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/find.html#" title=" " alt="" coords="323,57,456,98"/>
<area shape="rect" id="node5" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/insert.html#" title=" " alt="" coords="323,122,456,163"/>
</map>

View File

@@ -0,0 +1 @@
eb25f61bb3c01f732953e7b177f935be

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.49.1 (20210923.0004)
-->
<!-- Title: test Pages: 1 -->
<svg width="357pt" height="127pt"
viewBox="0.00 0.00 357.00 126.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 122.5)">
<title>test</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-122.5 353,-122.5 353,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Self&#45;test implementations.">
<polygon fill="#bfbfbf" stroke="black" points="0,-36 0,-55 33,-55 33,-36 0,-36"/>
<text text-anchor="middle" x="16.5" y="-43" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69" target="_top" xlink:title="Adds the process to the ready queue if it isn&#39;t already there.">
<polygon fill="white" stroke="black" points="79.5,-55 79.5,-74 180.5,-74 180.5,-55 79.5,-55"/>
<text text-anchor="middle" x="130" y="-62" font-family="Helvetica,sans-Serif" font-size="10.00">FCFS::addProcess</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M33,-48.14C42.64,-49.78 55.7,-52.01 69.09,-54.29"/>
<polygon fill="midnightblue" stroke="midnightblue" points="68.89,-57.81 79.33,-56.04 70.06,-50.91 68.89,-57.81"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a xlink:href="../../dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91" target="_top" xlink:title="Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor...">
<polygon fill="white" stroke="black" points="69,-17 69,-36 191,-36 191,-17 69,-17"/>
<text text-anchor="middle" x="130" y="-24" font-family="Helvetica,sans-Serif" font-size="10.00">FCFS::scheduleForFcfs</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node6 -->
<g id="edge5" class="edge">
<title>Node1&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M33,-42.86C41.2,-41.46 51.87,-39.64 63.11,-37.73"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.82,-41.16 73.09,-36.03 62.65,-34.26 63.82,-41.16"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/end.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="227,-99 227,-118 349,-118 349,-99 227,-99"/>
<text text-anchor="middle" x="288" y="-106" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set::end</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node2&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M164.85,-74.05C187.85,-80.53 218.48,-89.17 243.32,-96.18"/>
<polygon fill="midnightblue" stroke="midnightblue" points="242.64,-99.63 253.22,-98.97 244.54,-92.89 242.64,-99.63"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/find.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="238,-49.5 238,-79.5 338,-79.5 338,-49.5 238,-49.5"/>
<text text-anchor="start" x="246" y="-67.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set</text>
<text text-anchor="middle" x="288" y="-56.5" font-family="Helvetica,sans-Serif" font-size="10.00">::find</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node2&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M180.79,-64.5C195.78,-64.5 212.39,-64.5 227.92,-64.5"/>
<polygon fill="midnightblue" stroke="midnightblue" points="227.95,-68 237.95,-64.5 227.95,-61 227.95,-68"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/insert.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="238,-0.5 238,-30.5 338,-30.5 338,-0.5 238,-0.5"/>
<text text-anchor="start" x="246" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set</text>
<text text-anchor="middle" x="288" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::insert</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node2&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M161.45,-54.94C180.77,-48.87 206.38,-40.82 229.43,-33.58"/>
<polygon fill="midnightblue" stroke="midnightblue" points="230.64,-36.87 239.13,-30.54 228.54,-30.19 230.64,-36.87"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -0,0 +1,9 @@
<map id="main" name="main">
<area shape="rect" id="node1" title="Entry point of the program." alt="" coords="5,89,56,116"/>
<area shape="rect" id="node2" href="$df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" title="Self&#45;test implementations." alt="" coords="104,89,148,116"/>
<area shape="rect" id="node3" href="$dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69" title="Adds the process to the ready queue if it isn&#39;t already there." alt="" coords="210,64,345,91"/>
<area shape="rect" id="node7" href="$dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91" title="Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor..." alt="" coords="196,115,359,141"/>
<area shape="rect" id="node4" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/end.html#" title=" " alt="" coords="407,5,569,32"/>
<area shape="rect" id="node5" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/find.html#" title=" " alt="" coords="421,57,555,98"/>
<area shape="rect" id="node6" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/unordered_set/insert.html#" title=" " alt="" coords="421,122,555,163"/>
</map>

View File

@@ -0,0 +1 @@
d1153ad5effebcdd01be2ae30d68c8af

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.49.1 (20210923.0004)
-->
<!-- Title: main Pages: 1 -->
<svg width="431pt" height="127pt"
viewBox="0.00 0.00 431.00 126.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 122.5)">
<title>main</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-122.5 427,-122.5 427,4 -4,4"/>
<!-- Node1 -->
<g id="node1" class="node">
<title>Node1</title>
<g id="a_node1"><a xlink:title="Entry point of the program.">
<polygon fill="#bfbfbf" stroke="black" points="0,-36 0,-55 38,-55 38,-36 0,-36"/>
<text text-anchor="middle" x="19" y="-43" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="node2" class="node">
<title>Node2</title>
<g id="a_node2"><a xlink:href="../../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="Self&#45;test implementations.">
<polygon fill="white" stroke="black" points="74,-36 74,-55 107,-55 107,-36 74,-36"/>
<text text-anchor="middle" x="90.5" y="-43" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1" class="edge">
<title>Node1&#45;&gt;Node2</title>
<path fill="none" stroke="midnightblue" d="M38.26,-45.5C46.07,-45.5 55.31,-45.5 63.79,-45.5"/>
<polygon fill="midnightblue" stroke="midnightblue" points="63.95,-49 73.95,-45.5 63.95,-42 63.95,-49"/>
</g>
<!-- Node3 -->
<g id="node3" class="node">
<title>Node3</title>
<g id="a_node3"><a xlink:href="../../dd/dca/class_f_c_f_s.html#a8fbfe4d85f7576b4a7aade07d29fbd69" target="_top" xlink:title="Adds the process to the ready queue if it isn&#39;t already there.">
<polygon fill="white" stroke="black" points="153.5,-55 153.5,-74 254.5,-74 254.5,-55 153.5,-55"/>
<text text-anchor="middle" x="204" y="-62" font-family="Helvetica,sans-Serif" font-size="10.00">FCFS::addProcess</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2" class="edge">
<title>Node2&#45;&gt;Node3</title>
<path fill="none" stroke="midnightblue" d="M107,-48.14C116.64,-49.78 129.7,-52.01 143.09,-54.29"/>
<polygon fill="midnightblue" stroke="midnightblue" points="142.89,-57.81 153.33,-56.04 144.06,-50.91 142.89,-57.81"/>
</g>
<!-- Node7 -->
<g id="node7" class="node">
<title>Node7</title>
<g id="a_node7"><a xlink:href="../../dd/dca/class_f_c_f_s.html#aa25dbe30ba9930b5a7c1a6d11758bd91" target="_top" xlink:title="Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor...">
<polygon fill="white" stroke="black" points="143,-17 143,-36 265,-36 265,-17 143,-17"/>
<text text-anchor="middle" x="204" y="-24" font-family="Helvetica,sans-Serif" font-size="10.00">FCFS::scheduleForFcfs</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node7 -->
<g id="edge6" class="edge">
<title>Node2&#45;&gt;Node7</title>
<path fill="none" stroke="midnightblue" d="M107,-42.86C115.2,-41.46 125.87,-39.64 137.11,-37.73"/>
<polygon fill="midnightblue" stroke="midnightblue" points="137.82,-41.16 147.09,-36.03 136.65,-34.26 137.82,-41.16"/>
</g>
<!-- Node4 -->
<g id="node4" class="node">
<title>Node4</title>
<g id="a_node4"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/end.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="301,-99 301,-118 423,-118 423,-99 301,-99"/>
<text text-anchor="middle" x="362" y="-106" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set::end</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node4 -->
<g id="edge3" class="edge">
<title>Node3&#45;&gt;Node4</title>
<path fill="none" stroke="midnightblue" d="M238.85,-74.05C261.85,-80.53 292.48,-89.17 317.32,-96.18"/>
<polygon fill="midnightblue" stroke="midnightblue" points="316.64,-99.63 327.22,-98.97 318.54,-92.89 316.64,-99.63"/>
</g>
<!-- Node5 -->
<g id="node5" class="node">
<title>Node5</title>
<g id="a_node5"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/find.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="312,-49.5 312,-79.5 412,-79.5 412,-49.5 312,-49.5"/>
<text text-anchor="start" x="320" y="-67.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set</text>
<text text-anchor="middle" x="362" y="-56.5" font-family="Helvetica,sans-Serif" font-size="10.00">::find</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node5 -->
<g id="edge4" class="edge">
<title>Node3&#45;&gt;Node5</title>
<path fill="none" stroke="midnightblue" d="M254.79,-64.5C269.78,-64.5 286.39,-64.5 301.92,-64.5"/>
<polygon fill="midnightblue" stroke="midnightblue" points="301.95,-68 311.95,-64.5 301.95,-61 301.95,-68"/>
</g>
<!-- Node6 -->
<g id="node6" class="node">
<title>Node6</title>
<g id="a_node6"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/unordered_set/insert.html#" xlink:title=" ">
<polygon fill="white" stroke="black" points="312,-0.5 312,-30.5 412,-30.5 412,-0.5 312,-0.5"/>
<text text-anchor="start" x="320" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::unordered_set</text>
<text text-anchor="middle" x="362" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">::insert</text>
</a>
</g>
</g>
<!-- Node3&#45;&gt;Node6 -->
<g id="edge5" class="edge">
<title>Node3&#45;&gt;Node6</title>
<path fill="none" stroke="midnightblue" d="M235.45,-54.94C254.77,-48.87 280.38,-40.82 303.43,-33.58"/>
<polygon fill="midnightblue" stroke="midnightblue" points="304.64,-36.87 313.13,-30.54 302.54,-30.19 304.64,-36.87"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -144,7 +144,7 @@ Functions</h2></td></tr>
</div><!-- fragment --><p >The direction ratios (DR) are calculated as follows: 1st DR, J: (b * z) - (c * y) 2nd DR, A: -((a * z) - (c * x)) 3rd DR, N: (a * y) - (b * x)</p>
<p >Therefore, the direction ratios of the cross product are: J, A, N The following C++ Program calculates the direction ratios of the cross products of two vector. The program uses a function, <a class="el" href="../../df/d66/vector__cross__product_8cpp.html#a225732399c5c076976eae5b180a9f8c9" title="Function to calculate the cross product of the passed arrays containing the direction ratios of the t...">cross()</a> for doing so. The direction ratios for the first and the second vector has to be passed one by one seperated by a space character.</p>
<p >Magnitude of a vector is the square root of the sum of the squares of the direction ratios.</p>
<h3><a class="anchor" id="autotoc_md79"></a>
<h3><a class="anchor" id="autotoc_md80"></a>
Example:</h3>
<p >An example of a running instance of the executable program: </p><pre class="fragment">Pass the first Vector: 1 2 3
</pre><p> Pass the second Vector: 4 5 6 The cross product is: -3 6 -3 Magnitude: 7.34847</p>