The problem of preemptively scheduling a task system consisting of a set of n independent tasks on one processor so as to minimize the mean flow time is considered. The goal is to find a preemptive schedule such that the mean flow time is minimized subject to the constraint that each task Ti is executed within the interval between its release time and its deadline. Such a schedule, if it exists, is called an optimal schedule. It is shown that the problem of finding an optimal schedule is NP-hard. A greedy algorithm is given to find an optimal schedule for a large class of task systems.