Use CPU scheduling with distributed shell
You can run the distributed shell by specifying resources other than memory and vCores. The following is an example for distributed shell but you can use CPU scheduling with other frameworks as well.
Use the following command to allocate two cores for two containers:
yarn jar </opt/cloudera/parcels/<CDH-version>/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell.jar> \
-jar </opt/cloudera/parcels/<CDH-version>/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell.jar> \
-shell_command "sleep 120" \
-container_resources memory-mb=3072,vcores=2 \
-num_containers 2