In the industry, real-time systems are specified as a set of hundreds
of functionalities with timing constraints. Implementing those functionalities
as threads in a one-to-one relation is not realistic due to
the overhead caused by the large number of threads. In this paper,
we present task clustering, which aims at minimizing the number
of threads while preserving the schedulability. We prove that our
clustering problem is NP-Hard and describe a heuristic to tackle it.
Our approach has been applied to fixed-task or fixed-job priority
based scheduling policies as Deadline Monotonic (DM) or Earliest
Deadline First (EDF).