Question: Please help In c code on the Ubuntu terminal, and answer the questions System Profiling In addition to memory debugging, there are similar tools designed

Please help In c code on the Ubuntu terminal, and answer the questions

System Profiling

In addition to memory debugging, there are similar tools designed to profile the flow of execution through a program and report its use of system/library calls (providing useful debugging info). The utility program used in this part of the lab is called strace; please read the man pages to discover its operation and use. Run the strace utility on the executable of the Sample Program:

#include #include #include #define SIZE 16 int main() { char *data1, *data2; int i; do { data1 = malloc (SIZE); printf ("Please input your username: "); scanf ("%s", data1); if (!strcmp (data1, "quit")) break; data2 = malloc (SIZE); for (i=0; i

Ok, now read the man pages again to discover how to use command-line options to get a less cluttered output from strace/ltrace. Look for the option that reports a summary for each call. Then use the output to answer the following questions:

1. How many times is the write() system call invoked when running Sample Program 2?

Note: experiment. Then try to express your answer as a formula.

2. Examine the source code and output to answer the question: what is the primary 'C' library subroutine that causes the write() system call to be invoked while executing Sample Program?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!