Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Will rate and give points to the person who helps me understand and figure this

ID: 667207 • Letter: W

Question

Will rate and give points to the person who helps me understand and figure this out the BEST!!!

UNIX/LINUX systems usually include some command that allows you to trace system calls made by a process. Under Linux, this command is strace. For example, to trace all the system calls made during execution of “ls“ you would type “strace ls”. If the display is too long to fit your screen, you can use “strace –o out4ls ls” to write your output into file out4ls. Check “man strace” (traditional UNIX manual pages) or “info strace” (GNU style manual pages) in your Linux system for details. It is a good tool for learning, either as a light-weight debugger, or as a primitive profiler.

1. (20%) STRACE a small program. Create your own program in C (named as checkfile.c) as follows #include <stdio.h> int main(void) { FILE *fd; If ((fd=fopen("OSclass","rw"))==NULL) printf(" Program Failed, figure out why... "); else { fclose(fd); printf(" Program ran successfully "); } } a) Without creating file OSclass (no such a file in your working directory), run “strace checkfile”, read your output, pick/list five major system calls made from your program to explain why the program failed. b) With file OSclass (a dummy file) being created, run “strace checkfile” again, read your output and explain the major differences from part a). c) Is “fopen” a system call? If not, which system call it mainly correlates with? d) Is “printf” a system call? If not, which system call it mainly correlates with?

2. (20%) STRACE a Linux utility command. Run “strace” for a command of your choice (e.g. pwd, date, ps, jobs and so on), capture the output, and then pick at least four different system calls to briefly their functionality, and their input/output parameters.   

3. (20%) STRACE Linux utility commands “ls”. Run “strace –c ls”, capture the output, and then identify five of the most frequently used system calls for “ls”. For the identified system calls, use “strace –T –e trace=xxxx1,xxx2,xxx3,xxx4,xxx5 ls” to report their average execution time in microseconds, as well as their min and max execution time.

4. (20%) STRACE/LTRACE Linux utility commands “ls”. Command ltrace is another tracing tool used for tracing the library function calls. Use both strace and ltrace to Linux command ls to report what library functions and system calls are used to a) Open the current directory b) Get the list of directory entries c) Print the output to your screen

5. (20%) STRACE a running process such as “vim”. Strace can be helpful when you’re trying to understand or troubleshoot a process. For example, if you have a “firefox” is running as a process (PID=xxxx) you can run “strace –p xxxx) to watch out all system calls made at runtime. Instead of “firefox”, you will be asked to practice it with “vim”:

Run “vim filename &” as a background job (it will suspend immediately), use “ps” to find out its process ID yyyy Run “strace –o out4top –c –p yyyy &” Use “jobs” and “fg” to bring process “vim” into the foreground. Leave it running for about 10 seconds by inserting text, deleting others, and finally writing back to exit. Read your output file “out4top” to report 5 system calls which spent most of time.

Explanation / Answer

checkfile.c

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote