Question
In the Linux environment, use C/C++/Java (or other languages) programming to complete the following experiments: 1) Refer to the Linux kernel source code structure, read
In the Linux environment, use C/C++/Java (or other languages) programming to complete the following experiments:
1) Refer to the Linux kernel source code structure, read the Linux kernel source code, analyze the composition of the Linux process, and observe the process management data structure such as task_struc of the Linxu process;
2) Design the business processing logic of the parent process and the child process by referring to relevant sample programs, consulting Linux system calls and other related materials; using advanced programming languages such as C++ and fork(), clone, exec() , wait ( ) , exit ( ) , kill () , getpid() and other system calls, create management processes, observe the structure and concurrent behavior of parent and child processes / threads, and master process control methods such as waiting and canceling.
Require:
( A ) at least 6 system calls such as fork() , clone , exec , wait , exit , kill , getpid are used;
( B ) The created parent and child processes each have different business processing logic. After the parent process creates the child process, the child process calls itself to execute the code through exec() ;
( C ) The process can be terminated actively by itself through exit() , or it can be terminated by the parent process executing the kill() command;
( D ) Observe and compare the differences between subtasks / processes / threads created by fork() and clone() , and analyze the parameters created by setting or not setting CLONE_FS , CLONE_VFORK , CLONE_FILES , CLONE_FS , CLONE_PID and other parameters in the clone() system call Impact of child processes / threads;
( E ) Add random delays at different positions in the created parent-child process / thread code, so that the process execution spans multiple time slices, such as by adding tens to hundreds of milliseconds of delay, to ensure that the process execution time is not less than 3 time slice
Step by Step Solution
3.44 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
The experiment youre describing involves working with process management in a Linux environment utilizing system calls like fork clone exec wait exit ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started