프로젝트/Pint OS

[Pint OS] 에러: missing "begin" message

KimCookieYa 2023. 6. 9. 20:02

발생

syscall_handler ()와 halt (), exit (), write () 시스템콜 함수를 구현하고 테스트해보기 위해 돌려보았는데, 모든 테스트케이스가 터졌다. halt ()와 exit () 함수가 틀리기도 어려운 정도의 쉬운 함수라서 어디서 틀린건지 도저히 알 수 없었다. 이틀을 넘게 코드를 뒤져봐도 원인을 알 수 없어서 포기하고, 이전 깃헙 푸쉬내역으로 롤백한 후 다시 구현했는데 통과했다.. 너무 허탈하다. 뭐가 달랐던 걸까?

 

pintos -v -k -T 60 -m 20 --fs-disk=10 -p tests/userprog/args-dbl-space:args-dbl-space -- -q -f run 'args-dbl-space two spaces!' < /dev/null 2> tests/userprog/args-dbl-space.errors > tests/userprog/args-dbl-space.output
perl -I../.. ../../tests/userprog/args-dbl-space.ck tests/userprog/args-dbl-space tests/userprog/args-dbl-space.result FAIL tests/userprog/args-dbl-space
Run didn't produce any output
pintos -v -k -T 60 -m 20 --fs-disk=10 -p tests/userprog/halt:halt -- -q -f run halt < /dev/null 2> tests/userprog/halt.errors > tests/userprog/halt.output
perl -I../.. ../../tests/userprog/halt.ck tests/userprog/halt tests/userprog/halt.result
FAIL tests/userprog/halt
missing 'begin' message
pintos -v -k -T 60 -m 20 --fs-disk=10 -p tests/userprog/exit:exit -- -q -f run exit < /dev/null 2> tests/userprog/exit.errors > tests/userprog/exit.output
perl -I../.. ../../tests/userprog/exit.ck tests/userprog/exit tests/userprog/exit.result
FAIL tests/userprog/exit
Run didn't produce any output

 

Solution

  • 수정 전
int
process_wait (tid_t child_tid UNUSED) {
    for (int i = 0; i < 100000000; i++);
    return -1;
}
  • 수정 후
int
process_wait (tid_t child_tid UNUSED) 
    for (int i = 0; i < 1000000000; i++);
    return -1;
}

 

process_wait() 함수에서 반복문을 10^8번 줬을 땐 터졌지만, 10^9번 주니까 성공했다.. 테스트케이스 중에 시간이 오래 걸리는 경우가 있어서 시간은 넉넉하게 10^9번 주는게 좋을 것 같다. 문제의 원인은 추측컨대 다음과 같다.

 

Pint OS의 테스트케이스는 init.c의 main () 함수 -> run_actions (argv) -> run_task (argv) -> process_wait (process_create_initd (task) -> User Program(테스트케이스)의 로직으로 동작한다. 그러나 테스트케이스를 돌릴 때 process_wait (process_create_initd (task))에서 process_wait ()이 너무 짧으면 User Program이 동작하기도 전에 프로세스가 종료되면서 Fail 되버린다.

 

고치고보니 아무것도 아닌 문제였어서 너무 허탈했다..