hệ điều hành trần thị như nguyệt bài tập fork() sinhvienzone com

7 169 4
hệ điều hành trần thị như nguyệt bài tập fork() sinhvienzone com

Đang tải... (xem toàn văn)

Thông tin tài liệu

When a process creates a new process using the fork() operation, which of the following states is shared between the parent process and the child process? a Stack b Heap c Shared memory segments Answer: Only the shared memory segments are shared between the parent process and the newly forked child process Copies of the stack and the heap are made for the newly created process -Lưu ý: Để kiểm tra kết tất tập bên dưới, sinh viên thực hiện: ▬ Mở hệ điều hành Ubuntu, tạo file *.c gõ đoạn code muốn kiểm tra vào (ví dụ test.c) ▬ Mở cửa sổ Terminal, gõ vào: gcc test.c -o test ▬ Sau gõ /test để chạy file test -1 Hỏi output LINE A gì? SinhVienZone.com https://fb.com/sinhvienzonevn Bao gồm process cha, hỏi đoạn code tạo process? Bao gồm process cha, hỏi đoạn code tạo process? SinhVienZone.com https://fb.com/sinhvienzonevn Giả sử pid process cha process 2600 2603, hỏi đoạn code sau, A, B, C D giá trị in hình gì? SinhVienZone.com https://fb.com/sinhvienzonevn Hỏi giá trị in hình LINE X LINE Y đoạn code - SinhVienZone.com https://fb.com/sinhvienzonevn Bài tập từ slide cũ: a Cho đoạn code sau: #include #include int main (int argc, char *argv[]) { int pid; printf(“hi”); pid = fork(); if (pid > 0){ fork(); printf(“hello”); } else fork(); printf(“bye”); } Hỏi chương trình in dòng chữ hình b Thay đổi đoạn code thành #include #include int main (int argc, char *argv[]) { int pid; printf(“hi”); pid = fork(); if (pid > 0){ fork(); printf(“hello”); } else SinhVienZone.com https://fb.com/sinhvienzonevn { fork(); printf(“bye”); } } Hỏi chương trình in dòng chữ hình a #include #include int main (int argc, char *argv[]) { int pid; printf(“hi”); pid = fork(); if (pid > 0){ fork(); fork(); printf(“hello”); } else fork(); printf(“bye”); } Hỏi chương trình in dòng chữ hình b Thay đổi đoạn code thành #include #include int main (int argc, char *argv[]) { int pid; printf(“hi”); pid = fork(); if (pid > 0){ fork(); fork(); SinhVienZone.com https://fb.com/sinhvienzonevn printf(“hello”); } else { fork(); printf(“bye”); } } Hỏi chương trình in dòng chữ hình a #include #include int main (int argc, char *argv[]) { int pid; printf(“ so 1”); pid = fork(); printf(“ so 2”); fork(); if (pid = 0){ fork(); printf(“hello”); } else{ fork(); printf(“bye”); } } Hỏi chương trình in dòng chữ hình? SinhVienZone.com https://fb.com/sinhvienzonevn ... tạo process? SinhVienZone. com https://fb .com/ sinhvienzonevn Giả sử pid process cha process 2600 2603, hỏi đoạn code sau, A, B, C D giá trị in hình gì? SinhVienZone. com https://fb .com/ sinhvienzonevn... *argv[]) { int pid; printf(“hi”); pid = fork(); if (pid > 0){ fork(); fork(); SinhVienZone. com https://fb .com/ sinhvienzonevn printf(“hello”); } else { fork(); printf(“bye”); } } Hỏi chương trình... 1”); pid = fork(); printf(“ so 2”); fork(); if (pid = 0){ fork(); printf(“hello”); } else{ fork(); printf(“bye”); } } Hỏi chương trình in dòng chữ hình? SinhVienZone. com https://fb .com/ sinhvienzonevn

Ngày đăng: 28/01/2020, 22:05

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan