In this paper, the supervisory control of a class of discrete event systems (DES) is investigated. DES are modeled either by a collection of finite state machines (FSMs) that behave asynchronously or by a hierarchical finite state machine. The basic problem of interest is to ensure the invariance of a set of particular configurations in the system. When the system is modeled as asynchronous FSMs, we provide algorithms that, based on a particular decomposition of the set of forbidden configurations, solve the control problem locally (i.e. on each component without computing the whole system) and produce a global supervisor ensuring the desired property. We then provide sufficient conditions under which the obtained controlled system is non-blocking. This kind of objectives may be useful to perform dynamic interactions between different parts of a system. Finally, we apply these results to the case of hierarchical FSMs.