Pintos Project 2 final report - User Program, System Call
- 최초 등록일
- 2024.06.10
- 최종 저작일
- 2023.10
- 46페이지/ 어도비 PDF
- 가격 20,000원
소개글
pintos 프로젝트 2 User Program 최종보고서 입니다.
argument parsing, system call 등이 구현되어 있습니다.
코드와 설명이 하나도 빠짐없이 자세히 기록되어 있어,
그대로 따라하시면 all pass 나옵니다.
한양대 pintos 문서를 참고하였습니당
악명높은 multi-oom 해결 꿀팁도 적혀있습니다.
목차
1. Process termination message
1.1. algorithm
1.2. function
2. Argument passing
3. System calls for user process
3.1. algorithm
3.2. data structure
3.3. function
4. System calls for file manipulation
4.1. algorithm
4.2. data structure
4.3. function
5. denying writes
5.1. algorithm
5.2. function
6. discussion
6.1. argument passing 오류
6.2. bad test 오류
6.3. multi-oom 오류
6.4. 결과
본문내용
1. Process termination message
process가 종료될 때마다 process 종료 메세지를 띄워야 한다.
종료 메세지의 출력 예시와 형식은 아래와 같다.
printf("%s: exit(%d\n)",variable_1, variable_2)
ex) args-single: exit(0)
variable_1 : process의 이름
variable_2 : exit code
1.1. algorithm
exit system call을 담당하는 함수를 만들고
함수 안에서 해당 thread를 종료시키고, 종료 메세지를 출력하도록 한다.
process가 종료될 때마다 exit system call을 호출한다면
해당 thread도 종료될 것이고, 종료 메세지도 출력될 것이다.
1.2. function
원래 기존의 pintos에서는
해당 파일의 load에 실패한 경우 thread_exit()을 호출하였다.
static void
start_process (void *file_name_)
<중 략>
2. Argument passing
user에 의해 입력된 command는
프로그램 이름과 함께 부수적으로 붙는 option들이 다양하므로
이를 모두 인식할 수 있어야 한다.
그러나 현재 pintos는
command line에 명령어를 입력하였을 때
입력된 명령어 전체를 하나의 프로그램 이름으로 인식하도록 구현되어 있으며,
프로그램 이름과 option들을 구분하여 인식하지 못하는 상태이다.
따라서 입력된 command line을
프로그램 이름과 option들로 parsing될 수 있게 수정한다.
/* userprog/process.c */
tid_t
process_execute (const char *file_name)
{
char *command_line;
char *name;
char *remain;
tid_t tid;
// 메모리 할당, 메모리 할당 실패한 경우 함수종료, file_name을 comman
command_line = palloc_get_page (0);
if (command_line == NULL)
return TID_ERROR;
strlcpy (command_line, file_name, PGSIZE);
참고 자료
없음