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 8, Problem 8.23HW
One of your colleagues is thinking of using signals to allow a parent process to count events that occur in a child process. The idea is to notify the parent each time an event occurs by sending it a signal and letting the parent's signal handler increment a global counter variable, which the parent can then inspect after the child has terminated. However, when he runs the test program in Figure 8.45 on his system, he discovers that when the parent calls printf, counter always has a value of 2, even though the child has sent five signals to the parent. Perplexed, he comes to you for help. Can you explain the bug?
Figure 8.45 Counter program referenced in Problem 8-23.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
In programming, we use the mask concept to indicate information that can be shown to the user and information that must be “masked”, that is, hidden. In an implementation of a hangman game, we use a mask to indicate which secret word positions the player has already guessed right (whose the contents must therefore be shown to the player), and which positions must remain hidden. Each time that the player hits a letter of the hidden word, the mask is updated so that it has little dashes in the places of letters that the player has not hit yet and show it, in their proper place, the letters that he already hit it.
For example, if the word is "cards", the current mask is: - a - - s and the player guesses the letter "d", the mask should be updated to: - a - ds.Write a function called update_mask that takes as input a string containing the word secret (in the example above, this word would be “cards”), a list whose elements are the characters of the current mask (in the example above…
Write a complete processing program so that you can control a red ball on the screen
using keyboard arrow keys:
UP/DOWN: ball moves up/down;
LEFT/RIGHT: ball moves left/right;
when the ball hits border, it won't be able to move across the border is (stuck there
instead). R/r key resets the ball back to center.
SPIM simulator (QtSpim).
Simulation: Write a MIPS program that computes the expression;
y = A * B + C * D Where A, B, C, and D are integers
Chapter 8 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 8.2 - Prob. 8.1PPCh. 8.4 - Prob. 8.2PPCh. 8.4 - Prob. 8.3PPCh. 8.4 - Prob. 8.4PPCh. 8.4 - Practice Problem 8.5 (solution page 797) Write a...Ch. 8.4 - Practice Problem 8.6 (solution page 797) Write a...Ch. 8.5 - Practice Problem 8.7 (solution page 798) Write a...Ch. 8.5 - Prob. 8.8PPCh. 8 - Prob. 8.9HWCh. 8 - In this chapter, we have introduced some functions...
Ch. 8 - How many hello output lines does this program...Ch. 8 - How many "hello' output lines does this program...Ch. 8 - Prob. 8.13HWCh. 8 - How many hello output lines does this program...Ch. 8 - How many "hello lines does this program print?Ch. 8 - Prob. 8.16HWCh. 8 - Prob. 8.17HWCh. 8 - Consider the following program: Determine which of...Ch. 8 - How many lines of output does the following...Ch. 8 - Use execve to write a program called my1s whose...Ch. 8 - What are the possible output sequences from the...Ch. 8 - Write your own version of the Unix system function...Ch. 8 - One of your colleagues is thinking of using...Ch. 8 - Modify the program in Figure 8.18 so that the...Ch. 8 - Write a version of the fgets function, called...
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
- The Problem: You are coding a graphics filter that process each of an image through a filter. Each pixel is defined a triplet of real numbers (R,G,B) each of which is between 0 and 255.The filtering algorithms need to work on real numbers in order to do their job. But examining the program you discover that they only need two digits of accuracy. Any additional digits is just overkill.arrow_forwardImplement Thirsty problem using semaphore. Write the code in C/C++ Scenario: To drink, a thirsty person must have three things; water, ice and a glass. There are three thirsty people, each having a different one (and only one) of the three required items. A fourth person, a server has unlimited supply of all three items. If nobody is drinking, the server places two of the three items (chosen at random) onto table. Thirsty person who can make a drink from those two items will pick them up and drink a glass of ice water. When done, thirsty person will notify the server and the process will repeat.arrow_forwardWrite a PLI program that reads in pairs of points on a Cartesian coordinate system and classifies them according to the quadrant in which they lie. Make sure you take care of the possibility that one of the pairs lies on the axes of the coordinate system.arrow_forward
- Implement the attached pseudo-code in a Java program using a while loop and a switch-case statement. The program should be well structured, and the task performed under each option (at least options 'b' to 'e') should be implemented as a separate method.arrow_forwardSuppose you are employed by a advertisement agency to design a system to send advertisements in different languages and to different modes such as sms, email, in-mail, cable-tv, etc. (more can be added later or). The process of sending an advertisement is always the same irrespective of the language or the mode of the advertisement. The process is as follows: 1. The text of the advertisement is received as text 2. The text is then translated into a desired language. 3. The translation depends upon the mode of advertisement 4. The translated text is then proof-read for consistency 5. And then the text is advertised on the required mode Your task is the following: • Identify the design pattern that can be used over here • Justify your choice • Make a class diagram (using UML Notation) • Implement the classes in JAVA • Test your implementationarrow_forwardQUESTION 8 If we wanted something like the python else statement for a counter controlled loop in Java, what would it look like? We simply check either break or continue flags to see if either is set We simply check break variable to see if used. we check the for flag to see if loop terminated correctly Since there is no way for a loop in Java to tell you if it completed without breaks or continues, you'd need to set a boolean flag to indicate that and check it after the loop was completed.arrow_forward
- Lets say we are creating a python game. A word is displayed gets displayed on the screen. The players of the game must type as many words as they an that are related to the word that is displayed. If players type in the same word multiple times, it is ignored. One the players are done taking turns, the program gives each player a score that is based off how many wrods they entered that are similiar to what other words players have entered. So for a player to get a point, the word they typed must be typed by another student. QUESTION: We need to store the words typed by the players and all words etered. Would we use a list, set, dict or tuple?arrow_forwardJojo, Lili and Bibi are playing together. Because they had just learned the alphabet, Jojo also proposed a game using the alphabet to hone and deepen their abilities. The game is a game of changing strings. Initially Jojo has an X string. The X string will be changed through several processes given by Jojo. The process is changing an alphabet Ai to Bi. Each alphabet can only be changed once. After all processes take place. Jojo just wants to find out how many characters Bi are in the string X. If the alphabet does not appear in the string, the character does not need to be displayed. The alphabet displayed must be ordered by alphabet. Lili and Bibi want to do it, but they doubt their answer, for that they ask for your help to make an answer for the Jojo game. Format Input The input will consist of several lines of input in ”testdata.in” file. First consists of T, the number of test cases. For each testcase consists of several lines. The first line consists of the X string, Jojo’s…arrow_forwardWrite code java...arrow_forward
- The bean machine is a device for statistical experiments. It consists of an upright board with evenly spaced nails (or pegs) in a triangular form, as shown in Figure 7.13 from our assigned textbook.Balls are dropped from the opening at the top of the board. Every time a ball hits a nail, it has a 50% chance of falling to the left or to the right. The piles of balls are accumulated in the slots at the bottom of the board.Write a program to simulate the bean machine that has 8 slots as shown in the figure. Your program should prompt the user to enter the number of balls to drop. Simulate the falling of each ball by printing its path. For example, the path for the ball in Figure 7.13(b) is LLRRLLR and the path for the ball in Figure 7.13(c) is RLRRLRR. Note that there are 7 levels of nails, so your path should be 7 letters (not 8).Create an array called slots. Each element in slots store the number of balls in a slot. Each ball falls into a slot via a path. The number of “R”s in a path is…arrow_forwardChristy is interning at HackerRank. One day she has to distribute some chocolates to her colleagues. She is biased towards her friends and plans to give them more than the others. One of the program managers hears of this and tells her to make sure everyone gets the same number. To make things difficult, she must equalize the number of chocolates in a series of operations. For each operation, she can give pieces to all but one colleague. Everyone who gets a piece in a round receives the same number of pieces. Given a starting distribution, calculate the minimum number of operations needed so that every colleague has the same number of pieces. Example represents the starting numbers of pieces for each colleague. She can give pieces to the first two and the distribution is then . On the next round, she gives the same two pieces each, and everyone has the same number: . Return the number of rounds, . Function Description Complete the equal function in the editor below. equal has the…arrow_forwardSuppose a parent is waiting for the termination of its child. How can it get the return status of its child? Consider the last non-zero digit of your arid number. For example, if your arid number is “17-arid-840” then the last non-zero digit is 4. Suppose x represents the value of your last digit. Now write a program that creates as many child processes as the value of x. For each process, you must check whether it is created successfully or not. After creation, each child process will print the message “I am child “count”. (count = 1, 2, 3, … x) and then it will terminate normally using exit(). Count value will be used by each child as exit status value while exiting. After termination of child processes, parent process will check the exit status of each child and will display the status value that was used by the child while exiting. For example, parent can display the following statement for each child: “xxxx: My child has been terminated and its termination code was 3”. In this…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
Binary Numbers and Base Systems as Fast as Possible; Author: Techquikie;https://www.youtube.com/watch?v=LpuPe81bc2w;License: Standard YouTube License, CC-BY
Binary Number System; Author: Neso Academy;https://www.youtube.com/watch?v=w7ZLvYAi6pY;License: Standard Youtube License