Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part II ( 5 0 % ) Using the installed Linux operating system, write a C program that defines a global variable with an initial
Part II Using the installed Linux operating system, write a C program that defines a global variable with an initial value eg Your program should create three processes: one parent process and two child processes. The parent process will print the value of the global variable. The first child process will increment the global variable and print its new value. The second child process will decrement the global variable and print its new value. Tasks: Write a program as described above. Discuss the order of the output from the parent and children processes. Explain why the value of the global variable isn't affected by the incrementdecrement operations in other processes. Use "Itrace" and "strace" with proper parameters to show the list of system calls and library calls used by your program. Discuss in detail the system calls used by your program. Use top or htop to monitor and show realtime process information like CPU and memory usage, and state during program execution. Discuss observations related to your program's processes. Use ps with appropriate options to show detailed information about processes running at the time of execution. Analyze the output and discuss specific fields relevant to your program eg Process ID Parent Process ID State
Part II
Using the installed Linux operating system, write a C program that defines a global variable with
an initial value eg Your program should create three processes: one parent process and
two child processes.
The parent process will print the value of the global variable.
The first child process will increment the global variable and print its new value.
The second child process will decrement the global variable and print its new value.
Tasks:
Write a program as described above.
Discuss the order of the output from the parent and children processes.
Explain why the value of the global variable isn't affected by the incrementdecrement
operations in other processes.
Use "Itrace" and "strace" with proper parameters to show the list of system calls and
library calls used by your program.
Discuss in detail the system calls used by your program.
Use top or htop to monitor and show realtime process information like CPU and memory
usage, and state during program execution. Discuss observations related to your program's
processes.
Use ps with appropriate options to show detailed information about processes running at the
time of execution. Analyze the output and discuss specific fields relevant to your program
eg Process ID Parent Process ID State
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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