title: Operating Systems - General Process Creation
body: <p>Review Question</p>
  
  <blockquote>
    <p>Consider the Program</p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(){
      putchar('X');
      exit(0); 
  }
  </code></pre>
  
  <blockquote>
    <p>Suppose it is compiled an an a.out file is generated. now suppose that a user in a local console window types a.out and hits the return key. what happens? be sure to describe a plausible but detailed and comprehensive sequence of operating system actions and events, not just what the user sees. </p>
  </blockquote>
  
  <p>My answer</p>
  
  <ul>
  <li><p>First, the shell will create a process in User Space</p></li>
  <li><p>Then it will perform the system call 'putchar' Which simulates input, and the process will switch to kernel mode</p></li>
  <li><p>It will then add the process (thread) to the long term scheduler where it will join the set of all processes that are ready to run</p></li>
  <li><p>Once it is selected, it will move to the short term scheduler, where it will receive some processing time (ready -> running)</p></li>
  <li><p>Since this process is an IO bound process, it will then head to the IO queue, where it will be stored in a buffer where it awaits execution (running -> waiting) </p></li>
  <li><p>Once the IO is complete, the putchar call will print the X on the peripheral for which it is applied (the monitor) (waiting -> running) </p></li>
  <li><p>Once the process returns to the short term scheduler it will again receive more processing time. Since there is nothing left to do but terminate, the process terminates (running -> terminated)</p></li>
  </ul>
  
  <p>Is this valid understanding? Am I missing some critical concepts for process creation? I know it is relatively simple process, but please advise anything I am missing.</p>
  
  <p>Thanks for reading, and thanks in advance for assistance. </p>