Quantum oscillations from surface Fermi arcs in Weyl and Dirac semimetals