We present a promising approach to the extremely fast sensing and correction of small wavefront errors in adaptive optics systems. As our algorithm’s computational complexity is roughly proportional to the number of actuators, it is particularly suitable to systems with 10,000 to 100,000 actuators. Our approach is based on sequential phase diversity and simple relations between the point-spread function and the wavefront error in the case of small aberrations. The particular choice of phase diversity, introduced by the deformable mirror itself, minimizes the wavefront error as well as the computational complexity. The method is well suited for high contrast astronomical imaging of point sources such as the direct detection and characterization of exoplanets around stars, and it works even in the presence of a coronagraph that suppresses the diffraction pattern. The accompanying paper in these proceedings by Korkiakoski et al. describes the performance of the algorithm using numerical simulations and laboratory tests.