title: SCHED_FIFO process with priority of 99 gets preempted?
body: <p>this is from sched_setscheduler(2) - Linux man page:</p>
  
  <p>"Processes scheduled under one of the real-time policies (SCHED_FIFO, SCHED_RR) have a sched_priority value in the range 1 (low) to 99 (high)."</p>
  
  <p>"A SCHED_FIFO process runs until either it is blocked by an I/O request, it is preempted by a higher priority process, or it calls sched_yield(2)."</p>
  
  <p>I have the following code:</p>
  
  <pre><code>struct sched_param sp;
  memset( &amp;sp, 0, sizeof(sp) );
  sp.sched_priority = 99;
  sched_setscheduler( 0, SCHED_FIFO, &amp;sp );
  </code></pre>
  
  <p>Now the process should be running under the highest possible priority (99)
  and should never be preempted.</p>
  
  <p>So, when it starts running the following loop:</p>
  
  <pre><code>while ( 1 ) ;
  </code></pre>
  
  <p>it should be running forever and no other process should be allowed to run.</p>
  
  <p>In spite of this, when I start such a process, I can use other processes too. Other processes run much slower, but they DO run.</p>
  
  <p>My processor has 2 cores, so I started two copies of the process.
  Usage of both cores jumped to 97%-100%. Both processes were running their infinite loop.</p>
  
  <p>I could still type commands in a shell and watch their output. I could use GUI programs as well. </p>
  
  <p>How's that possible since a SCHED_FIFO process with a priority of 99 should never be preempted?</p>