Resource allocation algorithms and preamble design for massive IoT systems