Creating Task cause Site/CP to hang I have created a simple task to automatically create some entries if they don't exist and this all works fine.

The only issue I am having is that if the task is still running and I try and load a page on the site or another control panel page it simply hangs until the task is complete.

I can't seem to get the task to run in a similar way to the task that runs when updating a section's Entry URL Format (the task spinner and progress bar in the top right).

I have tried using the PowerNap example and changing the total steps to 100 (to give me enough time to see what is happening) and the same thing happens.

Do I have to create it as a specific background task?

Edit: To show sample code

&lt;?php
namespace Craft;

/**
 * Inception task
 */
class Bounce_TotalUpdateTask extends BaseTask
{
    /**
     * Defines the settings.
     *
     * @access protected
     * @return array
     */
    protected function defineSettings()
    {
        return array();
    }

    /**
     * Returns the default description for this task.
     *
     * @return string
     */
    public function getDescription()
    {
        return 'Update Total Record';
    }

    /**
     * Gets the total number of steps for this task.
     *
     * @return int
     */
    public function getTotalSteps()
    {
        return craft()-&gt;elements-&gt;getCriteria(ElementType::User, array(
            "group" =&gt; "members",
            "limit" =&gt; null,
        ))-&gt;total();
    }

    /**
     * Runs a task step.
     *
     * @param int $step
     * @return bool
     */
    public function runStep($step)
    {
        $users = craft()-&gt;elements-&gt;getCriteria(ElementType::User, array(
            "group" =&gt; "members",
            "limit" =&gt; null,
        ))-&gt;find();

        $section = craft()-&gt;sections-&gt;getSectionByHandle("totals");

        if (isset($users[$step])) {
            $user = $users[$step];

            $record = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry, array(
                    "section" =&gt; "totals",
                    "authorId" =&gt; $user-&gt;id,
                )
            )-&gt;first();

            if (!$record) {
                $entry = new EntryModel();
                $entry-&gt;sectionId  = $section-&gt;id;
                $entry-&gt;typeId     = $section-&gt;id;
                $entry-&gt;authorId   = $user-&gt;id;
                $entry-&gt;enabled    = true;

                craft()-&gt;entries-&gt;saveEntry($entry);
            }

            return true;
        } else {
            return "Result " . ($step) . " does not exist";
        }
    }
}
I recently dealt with a similar issue. Keep your tasks small and quick by using subtasks or by creating multiple instances of your main task. In your example, make each entry creation its own tasks or subtask, so that each step only has one process to take care of. You can have a private array on the task object to store an array of entry data to iterate through. 

private $entry_data = array();
//Fill array with the data you want to use

public function runStep($step)
{

    $new_entry = $entry_data[$step];
    //code to create new entry

    return true;

}