view slide.pdf.html @ 3:623da64aac7a default tip

Internship_presentation
author shivanidubey
date Mon, 24 Jun 2019 13:05:55 +0900
parents 54dd75a92d04
children
line wrap: on
line source






<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="content-type" content="text/html;charset=utf-8">
   <title>Studying Operating System Using Docker Platform</title>

   <meta name="generator" content="Slide Show (S9) v4.1.0 on Ruby 2.3.7 (2018-03-28) [universal.x86_64-darwin16]">
   <meta name="author"    content="Shivani Dubey" >

<!-- style sheet links -->
<link rel="stylesheet" href="s6/themes/screen.css"       media="screen">
<link rel="stylesheet" href="s6/themes/print.css"        media="print">
<link rel="stylesheet" href="s6/themes/blank.css"        media="screen,projection">

<!-- JS -->
<script src="s6/js/jquery-1.11.3.min.js"></script>
<script src="s6/js/jquery.slideshow.js"></script>
<script src="s6/js/jquery.slideshow.counter.js"></script>
<script src="s6/js/jquery.slideshow.controls.js"></script>
<script src="s6/js/jquery.slideshow.footer.js"></script>
<script src="s6/js/jquery.slideshow.autoplay.js"></script>

<!-- prettify -->
<link rel="stylesheet" href="scripts/prettify.css">
<script src="scripts/prettify.js"></script>

<style>
  .slide {page-break-after: always;}
</style>




</head>
<body>

<div class="layout">
  <div id="header"></div>
  <div id="footer">
    <div align="right">
      <img src="s6/images/logo.svg" width="200px">
    </div>
  </div>
</div>

<div class="presentation">

  <div class='slide cover'>
    <table width="90%" height="90%" border="0" align="center">
      <tr>
        <td>
          <div align="center">
              <h1><font color="#808db5">Studying Operating System Using Docker Platform</font></h1>
          </div>
        </td>
      </tr>
      <tr>
        <td>
          <div align="left">
               Shivani Dubey
               Madan Mohan Malaviya University of Technology, Gorakhpur
            <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:100%;height:0.2em;">
          </div>
        </td>
      </tr>
    </table>
  </div>


<div class='slide'>
  
<!-- _S9SLIDE_ -->
<h2 id="why-do-we-study-operating-system">Why do we study Operating System?</h2>

<ul>
  <li>
    <p>Every computer system has an operating system, which manages the resources of the computer.</p>
  </li>
  <li>
    <p>IoT or IT Services can’t work well without resource managements.</p>
  </li>
  <li>
    <p>To handle it, we have to understand the API of OS.</p>
  </li>
  <li>
    <p>To understand the API, it is better to see the implementations.</p>
  </li>
  <li>
    <p>For example, API for tuning priorities of the processes.</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="xv6-operating-system-as-an-educational-tool">Xv6 Operating System as an educational tool</h2>

<ul>
  <li>
    <p>A Unix-like operating system developed in MIT, based on V6 kernel</p>
  </li>
  <li>
    <p>xv6 is written in ANSI C ( not in C++ )</p>
  </li>
  <li>
    <p>xv6 is small and simple (9628 lines of codes)</p>
  </li>
  <li>
    <p>It can run on Raspberry Pi ( Small PC board )</p>
  </li>
  <li>
    <p>Or on ARM emulator such as QEMU</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="xv6-development-environment-with-qemu">Xv6 development environment with QEMU</h2>

<ul>
  <li>
    <p>QEMU emulates ARM CPU with virtual memory</p>
  </li>
  <li>
    <p>Xv6 operating sytem itself is running on QEMU</p>
  </li>
  <li>
    <p>gdb debugger can be attached to the emulated program (both in user space and system space)</p>
  </li>
  <li>
    <p>We can step and trace inside xv6 kernel</p>

    <pre><code>... but it requires complex development environments setup
... very time consuming
</code></pre>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="our-development-environments">Our development environments</h2>

<ul>
  <li>
    <p>homebrew (it simplifies installation of software in macOS)</p>
  </li>
  <li>
    <p>Mercurial repository of the lab where we saved everything using ssh</p>
  </li>
  <li>
    <p>Cross Compilers</p>
  </li>
  <li>
    <p>ARM libraries for C language</p>
  </li>
  <li>
    <p>QEMU (ARM Emulator)</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="introducing-docker">Introducing Docker</h2>

<ul>
  <li>
    <p>What is Docker? It is a container.</p>
  </li>
  <li>
    <p>What is Container? An isolated envirornment such as file system.</p>
  </li>
  <li>
    <p>It has DockerFile, which describes how to setup the envrionment in the container.</p>
  </li>
  <li>
    <p>Docker can run on any computer using an emulator such as QEMU.</p>
  </li>
  <li>
    <p>Complex development environment can be build using DockerFile and docker built command.</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h1 id="the-dockerfile">The DockerFile</h1>

<pre><code>FROM phitek/qemu-arm
RUN apt-get update -y
RUN apt-get remove gdb -y
RUN apt-get install gcc-arm-none-eabi gdb-arm-none-eabi qemu-system-arm -y
WORKDIR /code
COPY ["src", "."]
RUN make
CMD /bin/bash
</code></pre>

<ul>
  <li>
    <p>FROM line specifies the shared image in Docker repository.</p>
  </li>
  <li>
    <p>apt-get installs Linux cross compiling tools.</p>
  </li>
  <li>
    <p>Then it creates working directory, copies our sources to it, and executes make.</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="docker-commands">Docker commands</h2>

<ul>
  <li>
    <p>Create docker image and environment, and build xv6 kernel</p>

    <p>docker build –tag xv6-docker</p>
  </li>
  <li>
    <p>Run xv6 kernel on QEMU in the container</p>

    <p>docker run –rm –privileged -it xv6-docker ./run-debug.sh</p>
  </li>
  <li>
    <p>Run gdb to connect the xv6 kernel running in the QEMU</p>

    <p>docker exec -it xv6-docker ./debug.sh</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h1 id="exercise--adding-priorities-to-the-xv6-scheduler">Exercise : Adding priorities to the xv6 scheduler</h1>

<ul>
  <li>
    <p>Added getpriority() and setpriority()</p>
  </li>
  <li>
    <p>get_highest_priority() functions in proc.c file of xv6</p>
  </li>
  <li>
    <p>Implemented it in schelduler()</p>
  </li>
  <li>
    <p>Added a test function testpriority() in usertests.c file of xv6 to implement our algorithm</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="function-used-in-our-exercise-to-find-highest-priority-process">Function used in our exercise to find highest priority process</h2>
<pre><code class="language-c">int get_highest_priority_proc(void)
{
  int highest_priority;
  int pid = 0;
  int hpid = -1;
  int rpid = 0;
  highest_priority=100;
 
 struct proc *p;
  for(p = ptable.proc; p &lt; &amp;ptable.proc[NPROC]; p++, pid++){
    if(p-&gt;state != RUNNABLE) {
      continue;    }
    rpid = pid;
    if (highest_priority &gt; p-&gt;priority) {
       highest_priority=p-&gt;priority;
       hpid = pid; } }
  return hpid &gt; 0?hpid:rpid;
}
</code></pre>
<ul>
  <li>
    <p>It assumes at least one process to be RUNNABLE.</p>
  </li>
  <li>
    <p>It may allow no highest priority process.</p>
  </li>
  <li>
    <p>The correctness of the function is <em>important</em>.</p>
  </li>
</ul>



</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h2 id="docker-limitation">Docker Limitation</h2>

<ul>
  <li>
    <p>If repository breaks, Docker poses a problem (a cloud problem).</p>
  </li>
  <li>
    <p>Cloud may be used conveniently but we must not rely on it.</p>
  </li>
  <li>
    <p>We can use a direct environment without Docker, since we have a Linux server.</p>
  </li>
  <li>
    <p>Docker images can easily eat up our disk spaces.</p>
  </li>
</ul>

<p>in ~/.zsh_history</p>

<pre><code class="language-c">: 1561014922:0;docker system prune
: 1561014973:0;docker container prune
: 1561015350:0;docker image prune
: 1561015362:0;docker volume prune
</code></pre>


</div>

<div class='slide'>
  <!-- _S9SLIDE_ -->
<h1 id="conclusion">Conclusion</h1>

<ul>
  <li>
    <p>Docker environment poses some problems, some of which are difficult to comprehend.</p>
  </li>
  <li>
    <p>Yet, it gives a good insight of the underlying important concepts of operating system because it is well documented, fast and uses less resources.</p>
  </li>
</ul>

</div>


</div><!-- presentation -->
</body>
</html>