Wednesday, May 6, 2020

System Programming free essay sample

Tanisha Brinson CPS 360 System Programming Chapter 2 Questions 1. System Software on a Unix System perform the same basic services as System Software on a Microsoft Windows System. However, there are some fundamental differences in how the system software is designed and developed. Describe at least two differences. †¢ The code for MS Windows is proprietary and closed source, while the code for many Unix distributions (such as Linux) is free and open source. †¢ MS Windows is a single, monolithic, integrated system, while Unix is modular, with users able to switch out pieces of the system. MS Windows is designed to make operating a computer as easy as possible; many details of how the system operates are hidden from users. In a Unix system, all the details are easier to access, for study or for modification. 2. Briefly describe two operations that a debugger can perform (i. e. , commands that you can give to a debugger? What two things does the compiler do to assist a debugger? Answer: Set a breakpoint to pause execution of the program at a given line number. We will write a custom essay sample on System Programming or any similar topic specifically for you Do Not WasteYour Time HIRE WRITER Only 13.90 / page It can also print the value of a variable during execution also run a single line of program code, pausing after it completes. 3. Why must a program specifically be compiled for debugging to be able to execute that program in a debugger? What two things does the compiler do to assist a debugger? Answer: The compiler adds a symbol table to the executable so that variable names from the source code can be understood. The compiler avoids optimizing operations so that lines of code in the executable can be related to the riginal lines of source code. 4. Describe two ways a text editor can assist with writing program code (as opposed to writing generic text using a word processor). Answer: The text editor emacs, the bracket matching feature can briefly move the cursor to the opening bracket every time a closing bracket is typed, animating the grouping. Some text editors also provide color coding to highlight matching brackets and their enclosed blocks of code. 5. A Unix system typically has many programs that can run from its graphical user interface (menus).For the system you are using, pick five programs and identify the actual filename that is being executed. Use a shell to type the name of the program at the prompt to start the program instead of starting it from the menu. 6. For the text editor of your choice, identify what keystroke or menu option it provides in order to display the line number of the current cursor location. Also identify how to jump the cursor to a given line. Answer: A text editor can provide a keystroke to move the cursor to a matching brace or parenthesis.It can display the line number, and provide a method to move the cursor to a given line number. It can highlight programming language keywords. It can color code blocks. It can automatically adjust indentation. 7. Debug the following code by compiling it for debugging and executing it within a debugger. At which line of code does the program crash? Why does it crash there? Answer: #include #include main (int argc, char *argv[]) { int n, i; int d2, count, double d1; while (1) { printf (Enter a number (0 to quit): ); scanf (%d, n); if (n == 0) break; count = 0; for (i = 1; i

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.