[태그:] process termination

  • Pintos Project 2 한국어 설명서 (design report) – User Program, System Call

    목차

    0. Analysis
    0.1. Process Execution Procedure
    0.1.1. analysis
    0.2. System Call Procedure
    0.2.1. what is system call
    0.2.2. analysis
    0.3. File System
    0.3.1. what is file descriptor
    0.3.2. analysis

    1. Process terminate messages
    1.1. goal
    1.2. how to solve problems

    2. Argument Passing
    2.1. goal
    2.2. how to solve problems

    3. System Call
    3.1. goal
    3.2. how to solve problems
    3.2.1. data structure
    3.2.2. detailed algorithm
    3.2.3. implement system calls

    4. Denying Writes to Executables
    4.1. goal
    4.2. how to solve problems

    본문내용

    0. Analysis
    project 1에선 kernel에서 실행되는 thread들 위주였다면 project 2에서는 user program을 실행시키는 것이 위주이다. 따라서 project 1에선 alarm clock, priority scheduling, advanced scheduling 등의 코드들이 모두 kernel의 일부였고 해당 코드들을 kernel에서 직접 compile했지만, project 2에선 user program을 이용하여 compile한다. user program을 실행시키기 위하여 구현해야 하는 것은 아래와 같다.
    1. Process terminate messages
    2. Argument passing
    3. System call
    4. Denying writes to executables
    user program은 file system에서 load되고 있고, 많은 system call 구현은 file system에서 다뤄진다.
    0.1. Process Execution Procedure
    0.1.1. analysis
    1. main()
    Process Execution Procedure을 분석하기 위해 먼저 threads/init.c의 main 함수를 보겠다.
    0. Analysis 0.1. Process Execution Procedure
    0.1.1. analysis 0.2. System Call Procedure
    0.2.1. what is system call 0.2.2. analysis 0.3. File System 0.3.1. what is file descriptor 0.3.2. analysis

    출처 : 해피캠퍼스

  • Pintos Project 2 final report – User Program, System Call

    목차

    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);

    출처 : 해피캠퍼스