Number of CPUs per Task in Spark
<p>I don't quite understand <code>spark.task.cpus</code> parameter. It seems to me that a “task” corresponds to a “thread” or a "process", if you will, within the executor. Suppose that I set "spark.task.cpus" to 2. </p>

<ol>
<li><p>How can a thread utilize two CPUs simultaneously? Couldn't it require locks and cause synchronization problems?</p></li>
<li><p>I'm looking at <code>launchTask()</code> function in deploy/executor/Executor.scala, and I don't see any notion of "number of cpus per task" here. So where/how does Spark eventually allocate more than one cpu to a task in the standalone mode?</p></li>
</ol>