title: Would process with more threads on linux have more cpu time than process with one thread?
body: <p>Would a process with more threads on Linux have more cpu time than a process with one thread?</p>
  
  <p>In Linux processes and threads are described by a task struct, and <a href="https://stackoverflow.com/questions/8463741/how-linux-handles-threads-and-process-scheduling">scheduling is based on tasks</a>. I found also <a href="http://oreilly.com/catalog/linuxkernel/chapter/ch10.html" rel="nofollow noreferrer">this</a>:</p>
  
  <blockquote>
    <p>When a new process is created, <code>do_fork()</code> sets the counter field of both current (the parent) and p (the child) processes in the following way:</p>
  
  <pre><code>current-&gt;counter &gt;&gt;= 1;
  p-&gt;counter = current-&gt;counter;
  </code></pre>
    
    <p>In other words, the number of ticks left to the parent is split in two halves, one for the parent and one for the child. This is done to prevent users from getting an unlimited amount of CPU time by using the following method: the parent process creates a child process that runs the same code and then kills itself; by properly adjusting the creation rate, the child process would always get a fresh quantum before the quantum of its parent expires. This programming trick does not work since the kernel does not reward forks. Similarly, a user cannot hog an unfair share of the processor by starting lots of background processes in a shell or by opening a lot of windows on a graphical desktop. More generally speaking, a process cannot hog resources (unless it has privileges to give itself a real-time policy) by forking multiple descendants.</p>
  </blockquote>
  
  <p>Actually I didn't find that in the kernel sources, but maybe it's my fault, maybe I saw wrong kernel version.</p>
  
  <p>But what happens later, would every thread participate in scheduling like a separate process? Would a process with ten threads get ten times more ticks than a process with one thread?
  What about IO in this sense?</p>