Job scheduler in C