CS334 – Assignment 2 Solved

30.00 $

Category:

Description

5/5 - (1 vote)

Please complete a report and upload the corresponding codes.
The documents to be submitted for this assignment are:
1. report.pdf
2. shell.c

3. [15 pts] Read Chapter 2 of “Three Easy Pieces” (https://pages.cs.wisc.edu/~remzi/OSTEP/intr
o.pdf). Answer the following questions:
(1) What are the “three easy pieces” of operating systems? Explain each of them with your own words.
(2) How do these “three easy pieces” map to the chapters in the “dinosaur book”?

4. [15 pts] Read Chapter 6 of “Three Easy Pieces” (https://pages.cs.wisc.edu/~remzi/OSTEP/cpu -mechanisms.pdf) and explain what happens during context switch in detail?
5. [20 pts] Read slides “L03 Processes I” and “L04 Processes II” and answer the following questions:
(1) Explain what happens when the kernel handles the fork() system call (hint: your answer should include the system call mechanism, PCB, address space, CPU scheduler, context switch, return values of the system call).
(2) Explain what happens when the kernel handles the exit() system call (hint: your answer should include discussion on the zombie state and how it is related to the wait() system call).
6. [15 pts] What are the three methods of transferring the control of the CPU from a user process to OS kernel? Compare them in detail.
7. [10 pts] Describe the life cycle of a process (hint: explain the reasons for process state transitions).
8. [25 pts] Realize a shell of your own in myshell.c through fork () + exec () + wait (). The shell needs to include the following functions:
——It can run ps , ls , pwd and other basic instructions
——Switch the current directory through cd
——The user name and host name will be automatically switched according to the running machine
——You can exit the shell through exit
——(bonus 20pts)To realize other functions (such as background process, pipe, FIFO, etc.), Bonus can be used to supplement the total score of assignments, but it can not exceed the full score of assignments.
For all the above functions, your report should include screenshots of the code, corresponding output and corresponding description.

  • Assignment2-1gwest.zip