This is coded on a linux operating system, use system calls whenever possible. I
ID: 3595304 • Letter: T
Question
This is coded on a linux operating system, use system calls whenever possible. I know there is a limit to the questions you can do so only do question 1. I'll post questions 2, 3, and 4 on seperate posts.
Linux Process Management (Creation and Termination) ective To work with Linux process management system calls and to understand the relations between newly created processes Description Creating a process in modern operating systems usually includes creating a process control block (PCB) and loading an executable image of the program into memory. To be able to pass arguments and return status information between processes, operating systems maintain organizational information that relates processes to each other. When a process terminates, its memory is made available for other processes and its PCB is deallocated Throughout the process lifetime, the OS keeps track of a process by updating the PCB which has many identifying information. This includes the process ID (PID), its parent's ID (PPID), open file descriptors the process's state and values of the CPU registers last time the process ran on the CPU. The PID, isa unique number that identifies the process throughout its lifetime while the PPID is usually used to pass status information from the terminating child process to its parent. PIDs may be reused after a process terminates, but this usually happens after an extended period and/or when the system runs out of numbers to use Linux provides a parent-child relation between processes. A process, considered a parent process, can create new processes, child processes, which can create their own child processes as well. The parent process ideally should wait for its child processes before it terminates so it gets back the return status info from the child processes. Linux provides many system calls to manage processes throughout their lifetime. These include - pid t fork (void) http://man7.org/linux/man-pages/man2/fork.2.html - pid t vfork(void); http://man7 orq/linux/man-pages/man2/vfork.2.html - pid t getpid (void)http://man7. ora/linux/man-pages/man2/getpid. 2.html - pidt getppid (void) - pid t waitpid (pid_t pid, int *wstatus, int options); - unsigned int sleep (unsigned int seconds) //library function htt man7.org/linux/man-pages/man3/sleep.3.html Submission Submit the answers to the questions below in pdf format One compressed file that contains all C and pdf files To get used to system calls please pay attention to the following o Check the success of every system call you use o Make sure a parent process waits for all of its childrenExplanation / Answer
1
a. There will be four process created. Main will create two process. First process created by main will create 1 more process. (Dont forget main is also one proess);
b. This will have 8 process
c) If n consecutive fork call then there will be 2^n total process
e) Zombie process (process whose parent no longer exist are adobpted by init process and hence pid change)
f)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.