Pergunta de entrevista da empresa SiFive

building a circular array with lock to ensure thread safe