![Computer Systems: A Programmer's Perspective (3rd Edition)](https://www.bartleby.com/isbn_cover_images/9780134092669/9780134092669_largeCoverImage.gif)
Concept explainers
This problem concerns the m. o module from Figure 7.5 and the following version of the swap, c function that counts the number of times it has been called:
For each symbol that is defined and referenced in swap. o, indicate if it will have a symbol table entry in the symbol section in module swap. o. If so, indicate the module that defines the symbol (swap .o or m. o), the symbol type (local, global, or extern), and the section (.text, .data, or bss) it occupies in that module.
![Check Mark](/static/check-mark.png)
Sections in relocatable object files:
There are many sections in a relocatable object file. They are given below:
- “.text”:
- It is the machine code of the compiled program.
- “.rodata”:
- This section is used to read only the data in the format such as
- Strings in “printf” statements.
- Jump tables for switch statements.
- This section is used to read only the data in the format such as
- “.data”:
- This section is used in the initialized “C” variables of global variable and static “C” variables.
- Local “C” variables are initialized at execution time on the stack.
- It does not show in either the “.data” or “.bss” sections.
- “.bss”:
- It is used in the uninitialized global and static “C” variables, along with any global or static variables that are assigned to zero.
- “.symtab”:
- It is a symbol table.
- It contains the information about functions and global variables that are defined and referenced in the program.
- “.rel.text”:
- This section contains a list of locations in the “.text” section.
- It will require to be changed once the linker merges this object file with others.
- This section contains a list of locations in the “.text” section.
- “.rel.data”:
- This section contains relocation information for any global variables that are referenced or defined by the module.
- “.debug”:
- It is a symbol table for debugging
- It contains entries for following
- Definition of Local variables, global variables and typedefs variables and original “C” source file.
- “.line”:
- It is a mapping between line numbers in the given program
- That is in original “C” source program and machine code instructions in the “.text” section.
- It is a mapping between line numbers in the given program
- “.strtab”:
- It is a string table.
- It contains symbol tables in the “.symtab” and “.debug” sections.
- It is the table for section names in the section headers.
- It is a string table.
Explanation of Solution
For symbol “buf”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is an “extern” type. Because, the variable “buf” is declared in “extern” type which is present in “swap.c” file.
- Module defined position:
- The “buf” type is defined in “m.o” module.
- Because, the symbol “buf” are defined in “m.c” file”.
- When converting source file “m.c” to a relocatable object file, the given file becomes “m.o”.
- Section:
- The symbol “buf” is defined in “.data” section. It is the initialized global variable of “m.c” file.
For symbol “bufp0”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is a “global” symbol type. Because, the variable “bufp0” is declared outside the function in “swap.c” file.
- Module defined position:
- The “bufp0” type is defined in “swap.o” module.
- Because, the symbol “bufp0” are defined in “swap.c” file”.
- When converting source file “swap.c” to a relocatable object file, the given file becomes “swap.o”.
- Section:
- The symbol “bufp0” is defined in “.data” section. It is the initialized global variable of “swap.c” file
For symbol “bufp1”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is a “local” type. Because, the variable “bufp1” with “static” type in “swap.c” file.
- Module defined position:
- The “bufp1” type is defined in “swap.o” module.
- Because, the symbol “bufp1” are defined in “swap.c” file”.
- When converting source file “swap.c” to a relocatable object file, the given file becomes “swap.o”.
- Section:
- The symbol “bufp1” is defined in “.bss” section. It is the uninitialized static “C” variable of “swap.c” file
For symbol “swap”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is a “global” type. Because, the symbol “swap” is used in the entire program.
- Module defined position:
- The “swap” type is defined in “swap.o” module.
- Because, the symbol “swap” are defined in “swap.c” file”.
- When converting source file “swap.c” to a relocatable file, the given file becomes “swap.o”.
- Section:
- The symbol “swap” is present in “.text” section. It is the machine code of the compiled program.
For symbol “temp”:
- “.symtab” entry:
- The local variable “temp” does not a have a symbol table entry.
- So, it does not have a symbol type, module defined position and section.
- The local variable “temp” does not a have a symbol table entry.
For symbol “incr”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is a “local” type. Because, the function “incr” uses return type of “static” in “swap.c” file.
- Module defined position:
- The “swap” type is defined in “swap.o” module.
- Because, the symbol “swap” are defined in “swap.c” file”.
- When converting source file “swap.c” to a relocatable file, the given file becomes “swap.o”.
- Section:
- The symbol “swap” is present in “.text” section. It is the machine code of the compiled program.
For symbol “count”:
- “.symtab” entry:
- It is occurs in the symbol table.
- Symbol type:
- It is a “local” type. Because, the variable “count” declared in “static” type in the “swap.c” file.
- Module defined position:
- The “swap” type is defined in “swap.o” module.
- Because, the symbol “swap” are defined in “swap.c” file”.
- When converting source file “swap.c” to a relocatable file, the given file becomes “swap.o”.
- Section:
- The symbol “swap” is present in “.bss” section. Here, the static variables “count” are initialized to “0” in “swap.c” file.
The final table is
Symbol | .symtab entry? | Symbol type | Module where defined | Section |
buf | Yes | extern | m.o | .data |
bufp0 | Yes | global | swap.o | .data |
bufp1 | Yes | local | swap.o | .bss |
swap | Yes | global | swap.o | .text |
temp | No | - | - | - |
incr | Yes | local | swap.o | .text |
count | Yes | local | swap.o | .bss |
Want to see more full solutions like this?
Chapter 7 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Electric Circuits. (11th Edition)
Database Concepts (8th Edition)
Mechanics of Materials (10th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
- Please answer the homework scenario below and make a JAVA OOP code. You have been hired by GMU to create and manage their course registration portal. Your first task is to develop a program that will create and track different courses in the portal. Each course has the following properties: • a course number ex. IT 106, IT 206, • A course description, ex. Intro to Programming • Total credit hour ex. 3.0, and • current enrollment ex. 30 Each course must have at least a course number and credit hours. The maximum enrollment for each course is 40 students. The current enrollment should be no greater than the maximum enrollment. A course can have a maximum of 4 credit hour. The DDC should calculate the number of seats remaining for the course. Design an object-oriented solution to create a data definition class for the course object. The course class must define all the constructors, mutators with proper validation, accessors, and special purpose methods. The DDC should calculate the…arrow_forwardFor this case study, students will analyze the ethical considerations surrounding artificial intelligence and big data in healthcare, as explored in the case study found in the textbook (pages 34-36) and in the extended version available here There will also be additional articles in this weeks learning module to show both sides of the coin. https://www.delftdesignforvalues.nl/wp-content/uploads/2018/03/Saving-the-life-of-medical-ethics-in-the-age-of-AI-and-Big-Data.pdf Students should refer to the syllabus for specific guidelines regarding length, format, and content requirements. Reflection Questions to Consider: What are the key ethical dilemmas presented in the case? How does AI challenge traditional medical ethics principles such as autonomy, beneficence, and confidentiality? In what ways can responsible innovation help address moral overload in healthcare decision-making? What are the potential risks and benefits of integrating AI-driven decision-making into patient care?…arrow_forwardCan you please solve this. Thanksarrow_forward
- can you solve this pleasearrow_forwardIn the previous homework scenario problem below: You have been hired by TechCo to create and manage their employee training portal. Your first task is to develop a program that will create and track different training sessions in the portal. Each training session has the following properties: • A session ID (e.g., "TECH101", "TECH205") • A session title (e.g., "Machine learning", "Advanced Java Programming") • A total duration in hours (e.g., 5.0, 8.0) • Current number of participants (e.g., 25) Each session must have at least a session ID and a total duration and must met the following requirements: • The maximum participant for each session is 30. • The total duration of a session must not exceed 10 hours. • The current number of participants should never exceed the maximum number of participants. Design an object-oriented solution to create a data definition class(DDC) and an implementation class for the session object. In the DDC, a session class must include: • Constructors to…arrow_forwardIn the previous homework scenario problem below: You have been hired by TechCo to create and manage their employee training portal. Your first task is to develop a program that will create and track different training sessions in the portal. Each training session has the following properties: • A session ID (e.g., "TECH101", "TECH205") • A session title (e.g., "Machine learning", "Advanced Java Programming") • A total duration in hours (e.g., 5.0, 8.0) • Current number of participants (e.g., 25) Each session must have at least a session ID and a total duration and must met the following requirements: • The maximum participant for each session is 30. • The total duration of a session must not exceed 10 hours. • The current number of participants should never exceed the maximum number of participants. Design an object-oriented solution to create a data definition class(DDC) and an implementation class for the session object. In the DDC, a session class must include: • Constructors to…arrow_forward
- Send me the lexer and parserarrow_forwardHere is my code please draw a transition diagram and nfa on paper public class Lexer { private static final char EOF = 0; private static final int BUFFER_SIZE = 10; private Parser yyparser; // parent parser object private java.io.Reader reader; // input stream public int lineno; // line number public int column; // column // Double buffering implementation private char[] buffer1; private char[] buffer2; private boolean usingBuffer1; private int currentPos; private int bufferLength; private boolean endReached; // Keywords private static final String[] keywords = { "int", "print", "if", "else", "while", "void" }; public Lexer(java.io.Reader reader, Parser yyparser) throws Exception { this.reader = reader; this.yyparser = yyparser; this.lineno = 1; this.column = 0; // Initialize double buffering buffer1 = new char[BUFFER_SIZE]; buffer2 = new char[BUFFER_SIZE]; usingBuffer1 = true; currentPos = 0; bufferLength = 0; endReached = false; // Initial buffer fill fillBuffer(); } private…arrow_forwardIf integer x is divisible by 3, can you prove that ceil(x/2) + floor(x/6) = floor(x/2) + ceil(x/6)arrow_forward
- Draw the NFA for thisarrow_forwardWhat are three examples each of closed-ended, open-ended, and range-of-response questions? thank youarrow_forwardCreate 2 charts using this data. One without using wind speed and one including max speed in mph. Write a Report and a short report explaining your visualizations and design decisions. Include the following: Lead Story: Identify the key story or insight based on your visualizations. Shaffer’s 4C Framework: Describe how you applied Shaffer’s 4C principles in the design of your charts. External Data Integration: Explain the second data and how you integrated it with the Halloween dataset. Compare the two datasets. Attach screenshots of the two charts (Bar graph or Line graph) The Shaffer 4 C’s of Data Visualization Clear - easily seen; sharply defined• who's the audience? what's the message? clarity more important than aestheticsClean - thorough; complete; unadulterated, labels, axis, gridlines, formatting, right chart type, colorchoice, etc.Concise - brief but comprehensive. not minimalist but not verboseCaptivating - to attract and hold by beauty or excellence does it capture…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781305503922/9781305503922_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)