We prove the existence of resolution of singularities for arbitrary (not
necessarily reduced or irreducible) excellent two-dimensional schemes, via
permissible blow-ups. The resolution is canonical, and functorial with respect
to automorphisms or etale or Zariski localizations. We treat the embedded case
as well as the non-embedded case, with or without a boundary, and we relate the
diferent versions. In the non-embedded case, a boundary is a collection of
locally principal closed subschemes. Our main tools are the stratifications by
Hilbert-Samuel functions and the characteristic polyhedra introduced by H.
Hironaka. In an appendix we show that the standard method used in
characteristic zero - the theory of maximal contact - does not work for
surfaces in positive characteristic (the counterexamples are hypersurfaces in
affine threespace and work over any field of positive characteristic).
In this new version, we treat the case of locally noetherian but not
necessarily noetherian schemes in an appropriate way. Here one does not have a
finite resolution sequence, but still a canonical resolution morphism by
glueing. The same techniques allow to treat algebraic spaces and stacks.