In this paper we consider the problem of designing controllers for linear plants to be implemented in embedded platforms under stringent real-time constraints. These include preemptive scheduling schemes, under which the maximum execution time allowed for control software tasks is uncertain. We propose an ``anytime control'' design approach, consisting in a hierarchy of controllers for the same plant. Higher controllers in the hierarchy provide better closed-loop performance, while typically requiring a larger worst-case execution time. We provide a procedure for the design of controllers which, together with a conditioning process of the stochastic scheduling, provides better performance than prevailing worst case-based design, while guaranteeing almost sure stability of the resulting switching system.