Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 7, Problem 7.9HW
Consider the following program, which consists of two object modules:
When this program is compiled and executed on an x86-64 Linux system, it prints the string 0×48\n and terminates normally, even though function p2 never initializes variable main. Can you explain this?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
you will simulate a simple multithreading application with a “producer and consumer” problem.
IN JAVA Modify "Producer and Consumer Problem" from the lecture note so that it can use all buffer
space, not "buffersize - 1" as in the lecture note. This program should work as follows:
The user will run the program and will enter two numbers on the command line.
Those numbers will be used for buffersize and counter limit.
The main program will then create separate producer and consumer threads.
The Producer thread generates a random number through a random number
generator function, inserts it into the buffer, prints the number, and increment
counter.
The Consumer thread goes to the buffer, takes a number in the proper order, prints it
out, and increment counter.
After the counter reaches its limit, both threads should be terminated and returned to
the main.
Main program terminates.
I’m really struggling with fixing this error in this c program.This error code keeps popping up in my Linux putty server when I try to compile and run , it fails to compile .I don’t know how to fix it .
The task is to implement part of a linter program using python. Specifically, you must be able to
scan for grouping symbols ( "()", "[]", "{}") and ensure that there are no hanging open symbols or
stray closing symbols in the source file.
There will be files you will need to scan so you need the open() in your code. Also, you can use the
read() or readlines() to know which lines has no opening or stray closing symbols.
Example: You scan this code from a file, and you notice that there is a stray closing symbol ")".
1 int main(void) {
.
123
2
3
4
printf("Hello world"));
return 0;
}
The implementation must involve recursion in terms of scanning for the scope. If a different closing
symbol is encountered or the end of file is reached, the error message "Line :
missing closing symbol for "" should be displayed. For stray closing tags, the
message "Line : stray closing symbol for "".
Do not use "stack" in your code.
Chapter 7 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 7.5 - Prob. 7.1PPCh. 7.6 - Practice Problem 7.2 (solution page 718) In this...Ch. 7.6 - Practice Problem 7.3 (solution page 718) Let a and...Ch. 7.7 - Prob. 7.4PPCh. 7.7 - Prob. 7.5PPCh. 7 - This problem concerns the m. o module from Figure...Ch. 7 - Without changing any variable names, modify bar5.c...Ch. 7 - Prob. 7.8HWCh. 7 - Consider the following program, which consists of...Ch. 7 - Let a and b denote object modules or static...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Phone Book Program Design a program that you can use to keep all of your friends names and phone numbers in a f...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Using MIS (10th Edition)
Solve the differential equation dydx=xy1x+y+3 by finding h and k so that the substitutions x=u+h, y=v+k transfo...
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
List the functions of a database application.
Database Concepts (8th Edition)
Write a SELECT statement that will return the TradingSymbol column only from the rows where SellingPrice is gre...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What, if anything, prints when each of the following statements is performed? If nothing prints, then answer No...
C How to Program (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a script that opens a file containing a list of passwords and checks to see if the passwords are strong. 1. Save a list of five passwords in a text file. 2. Write a Python script that opens the text file and reads the passwords. 3. For each password, use regular expressions to check the password strength (I recommend creating a module to do this). For a password to be considered strong, it must satisfy the following requirements: + minimum length 8 characters + must contain one or more alphabetical characters [a-z] + must contain one or more Uppercase characters [A-Z] + must contain one or more numeric characters [0-9] + must contain one or more special characters [_$!]arrow_forwardWrite the C or C++ program system2 that reads, when being executed, OS commands via the "command line parameter" C/C++ feature, and then executes them. The command line parameters must be legal Unix/Linux commands. Print the number of commands entered. To prepare, read about argc, argv, and envp. Focus is only argc and argv. A sample execution by fictitious user "mike" is: herb$ ./a.out pwd ls whoami argc 4 pwd argv[1] Executing command /Users/mikey 'pwd' = ls argv[2] Executing command 'ls' Applications Contacts Music Pictures familie herb Downloads testl Favorites Library Movies testl.c pix_low_2020 test2 test2.c Desktop Public Documents a.out test.c argv[3] = whoami Executing command mikey 'whoami'arrow_forwardIn this assignment, you will create a Java program to search recursively for files in a directory.• The program must take two command line parameters. First parameter is the folder to search for. Thesecond parameter is the filename to look for, which may only be a partial name.• If incorrect number of parameters are given, your program should print an error message and show thecorrect format.• Your program must search recursively in the given directory for the files whose name contains the givenfilename. Once a match is found, your program should print the full path of the file, followed by a newline.• You can implement everything in the main class. You need define a recursive method such as:public static search(File sourceFolder, String filename)For each subfolder in sourceFolder, you recursively call the method to search.• A sample run of the program may look like this://The following command line example searches any file with “Assignment” in its name%java FuAssign7.FuAssignment7…arrow_forward
- Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements in c++ : Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use the find() function to find the index of a comma in each…arrow_forwardThis question was rejected because lack of a text file, which I do not see a way to upload. I saved the first part of the file as an image because that is all I can upload. If that doesn't suffice, please advise how to include a text file. In C++, I would like some help improving or making a better password lookup function for a Hash Table class/program I made, The function: it is supposed to lookup a user password using their ID and name which I read in from a text file. The one I have only works for the first 10 records, which I highlighted below in the program. string lookupPassword (string inUserID, string inUserName){ string thePassword; ... return thePassword; } Here is part of the program thus far: // Hash.cpp #include <iostream>#include<string>#include<iomanip>#include<fstream>using namespace std;//node classclass nodeBST {private: //user data string userID; string userName; string userPW; //BST left and right children nodeBST*…arrow_forwardJAVA Only Design, implement and test a Java class that processes a series of triangles. The triangle specification will be identical to that in Programming Assignment #2 (part A). As in that assignment, you will read in the three sides of the triangle, check the input for errors (and handle them if found), classify the triangle and compute its area. For this assignment, triangle data will be read from an input file and the program’s output will be written to another file. The output file will also include a summary of the data processed. You must use at least one dialog box in this program. The data for each triangle will be on a separate line of the input file, with the input data echoed and the results referred to by the line number (see example). Some things to note: All input data lines must be processed. A new line with triangle data always starts with the ‘#’ marker. If an error is encountered, it must be handled and the program will continue. Extraneous data must be…arrow_forward
- IN JAVA OR C++ you will simulate a simple multithreading application with a “producer and consumer” problem Modify “Producer and Consumer Problem” from the lecture note so that it can use all buffer space, not “buffersize – 1” as in the lecture note. This program should work as follows: 1. The user will run the program and will enter two numbers on the command line.Those numbers will be used for buffersize and counter limit.2. The main program will then create separate producer and consumer threads.3. The Producer thread generates a random number through a random number generator function, inserts it into the buffer, prints the number, and increment counter.4. The Consumer thread goes to the buffer, takes a number in the proper order, prints it out, and increment counter.5. After the counter reaches its limit, both threads should be terminated and returned to the main.6. Main program terminates.arrow_forwardNeed Help with C++ coding, and please explain the first step in detail. Write a program in C++ that performs three functions using threads on the attached text file called long_text.txt 1. Write your code in a such way that you can show in terms of time that using threads does not keep you blocked i.e., the main thread gets free once all threads start. a.This means that your program will run the three functions without threading and then with threading. 2. Functions to implement are: a. word_count() → will count the number of words in the text file b. sentence_count() → will count the number of sentences in the text file c. find_frequent_word() → finds the most frequently occurring word and number of times it occurred in the textarrow_forwardWrite a C program that gets a source file name from a user. If the file does not exist, it will generate a proper error and exits.If the file exists, it also gets the name of two more files from the user, say destination1 and destination2. These files don’t need to exist as they are files that need to be written to. If the files cannot be opened for writing, a proper error will be generated. The program then reads the source file line by line. It will copy every line that has a digit in it to destination 2 and lines that have no digit in them to destination 1. Feel free to use ctype’s isdigit() function to identify digit characters. Example: If source file is:Hi My name is VeriaHello My name is John. How can I help you?I have a problem with my giga bit internet. The speed should be around 1000 but it’s just 200 Sure! I can help with that. Can I have your number in case we get disconnected? Sure! My number’s 647-123-1234 First file (destination 1) should be Hi My name is Veria Hello…arrow_forward
- Is there a special reason why the symbol or name used in the C++ inclusion guard on a library interface file has to be special? A helpful tactic in this situation is to use proof by contradiction: assume that the symbol doesn't need to be unique, and then show what happens when two libraries that are both #included in the same application use the same symbol.arrow_forwardPlease help with implementing the Banker's algorithm for deadlock avoidance, that works on a given set of N processes and M resource types (N<10,M<10). Use Java for the implementation, with a simple text interface, where the user enters only the name of the input file (text only). The program reads all the necessary input data from that file. The input data and result is then displayed on the screen. Please help by using BACKTRACKING and find all solutions Subject: Java Programmingarrow_forwardProblem Y: Implement the reader writer problem using pthreads and semaphores. You should allow multiple readers to read at the same time and only one single writer to write to the data set. You are required to use the following: 1. A semaphore rw_muter initialized to 1. 2. A semaphore muter initialized to 1. 3. An integer reader_count initialized to 0.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY