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
Concept explainers
Textbook Question
Chapter 10, Problem 10.8HW
Write a version of the statcheck program in Figure 10.10, called fstatcheck that takes a descriptor number on the command line rather than a filename.
______________________________________________________________code/io/statcheck c
______________________________________________________________code/io/statcheck c
Figure 10.10 Querying and manipulating a file's st_mode bits.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format: Harry Potter t..d@hogwarts.edu Hermione Granger b..h@hogwarts.edu Ron Weasley r..b@hogwarts.edu Draco Malfoy m..s@hogwarts.edu Severus Snape h..e@hogwarts.edu Albus Dumbledore a..x@hogwarts.edu Your program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item: 1) look up an email address 2) add a new name and email address 3) change an email address 4) delete a name and email address 5) save address book and exit When the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry under that name, the program should print, "Sorry,…
Unix-based operating systems usually include a tool named tail. It displays the last 10 lines of a file whose name is provided as a command line argument. Write a Java program that provides the same behavior i.e. the user can specify how many lines to print from the terminal. Display an appropriate error message if the file requested by the user does not exist, or if the command line argument is omitted.
Note: Make sure to display the last n lines of a file whose name is provided as a command line argument. You might need to pass a file as an argument, therefore make sure to have access to a sample file, the contents of which you want to print out.
The Committee for Fairness to File Descriptors is organizing a protest against the UNIX system
because whenever the latter returns a file descriptor, it always returns the lowest number not
currently in use. Consequently, higher-numbered file descriptors are hardly ever used. Their plan
is to return the lowest number not yet used by the program rather than the lowest number
currently not in use. They claim that it is trivial to implement, will not affect existing programs,
and is fairer. What do you think?
Chapter 10 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 10.3 - Prob. 10.1PPCh. 10.8 - Practice Problem 10.2 (solution page 915) Suppose...Ch. 10.8 - Practice Problem 10.3 (solution page 915) As...Ch. 10.9 - Prob. 10.4PPCh. 10.9 - Practice Problem 10.5 (solution page 916) Assuming...Ch. 10 - Prob. 10.6HWCh. 10 - Prob. 10.7HWCh. 10 - Write a version of the statcheck program in Figure...Ch. 10 - Consider the following invocation of the...Ch. 10 - Prob. 10.10HW
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Suppose number is a variable of type int. Write an if-else statement that outputs the word "Positive" if the va...
Absolute Java (6th Edition)
This is automatically provided for a class if you do not write one yourself. a. accessor method b. default inst...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
What limitation does a static member function have?
Starting Out with C++: Early Objects
Describe the role of data dictionary in the management and maintenance of a database.
Modern Database Management
The spreadsheet in Microsoft Excel file Ch01Ex01_U10e.xlsx contains records of employee activity on special pro...
Using MIS (10th Edition)
This key word is used to declare a named constant. a. constant b. namedConstant c. final d. concrete
Starting Out with Java: From Control Structures through Objects (6th 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
- Hi, I am trying to learn and execute a morse code in this way and by using this format, I already know another way and it works but it will be very helpful to understand this one as well, thanks. def print_intro(): def get_input(): def encode(message): def decode(message): def process_lines(filename, mode): def write_lines(lines): def check_file_exists(filename): def main():arrow_forwardUnix-based operating systems usually include a tool named tail. It displays the last 10 lines of a file whose name is provided as a command line argument. Write a Java program that provides the same behavior i.e. the user can specify how many lines to print from the terminal. Display an appropriate error message if the file requested by the user does not exist, or if the command line argument is omitted.arrow_forwardWrite a Java GUI program using BufferedReader that asks the user to input the file to be opened. If said file exists, the program shows its first line text. It is given that you have myFile.txt in your working directory with the following text. Sample Output:arrow_forward
- With code screen shot pleasearrow_forwardSuppose you want to back up a huge file (e.g., a 10-GB AVI file) to aCD-R. You can achieve it by splitting the file into smaller pieces and backing upthese pieces separately. Write a utility program that splits a large file into smallerones using the following command:java Exercise17_10 SourceFile numberOfPiecesThe command creates the files SourceFile.1, SourceFile.2, . . . , SourceFile.n,where n is numberOfPieces and the output files are about the same size.arrow_forwardAttached The contents of input.txt file:arrow_forward
- Exercise 2:Write a Java program that allows the user to specify a file name on the command line and prints the number of characters, words, lines, average number of words per line, and average number of characters per word in that file. If the user does not specify any file name, then prompt the user for the name.arrow_forwardWith screen shot for the code and details also algorithm for beginnerarrow_forwardUse EMACS to correct the script below: ################################################ Favorite Food# Repair this script# Enters Fish & Chips# Bring about a file with the food name and the calculation in the file: foods# Date: 03/31/2022# Note: this script has errors... please repair them!################################################## ask the user what their favorite food isecho -n "What do I like to eat? "# Read in the estimateread estimate## Set calculation to zerocalculation=999Utilize a while loop to read in the food name until "Fish & Chips" is entered#while test $foodname != "Fish & Chips" ; do## add one to calculation let calculation=calculation+1## write out the food to a file called foods echo "$estimate:$calculation" >> echo $estimate "Nope, try again! "; read estimatedonearrow_forward
- Task 3: Measure the Entropy of Kernel In the virtual world, it is difficult to create randomness, i.e., software alone is hard to create random numbers. Most systems resort to the physical world to gain the randomness. Linux gains the randomness from the following physical resources: void add_keyboard_randomness(unsigned char scancode); void add_mouse_randomness(__u32 mouse_data); void add_interrupt_randomness(int irq); void add_blkdev_randomness(int major); The first two are quite straightforward to understand: the first one uses the timing between key presses; the second one uses mouse movement and interrupt timing; the third one gathers random numbers using the interrupt timing. Of course, not all interrupts are good sources of randomness. For example, the timer interrupt is not a good choice, because it is predictable. However, disk interrupts are a better measure. The last one measures the finishing time of block device requests. The randomness is measured using entropy, which is…arrow_forwardWrite a bash program that takes in a word and a filename from the command line and print out the number of occurrences of the word in the file. Name the program count_word.sh. Your program should work as follow:hb117@uxb5:~$ ./count_word.sh global /home/hb117/shared/cs371/lab04/global.txt global 9 hb117@uxb5:~$ ./count_word.sh nuclear /home/hb117/shared/cs371/lab04/global.txt hb117@uxb5:~$ add awk to your pipearrow_forwardImplement a system of three concurrent processes which read and write sequence numbers to a file. Each of the three processes must obtain 200 integers from the file. The file only holds one integer at a given time. Given a file, F, containing a single integer, each process must perform the following steps: Please show steps and answer.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
Linux - Tutorial for Beginners in 13 MINUTES! [ UPDATED ]; Author: bai;https://www.youtube.com/watch?v=BMGixkvJ-6w;License: Standard YouTube License, CC-BY
What is Linux?; Author: Techquickie;https://www.youtube.com/watch?v=zA3vmx0GaO8;License: Standard YouTube License, CC-BY
Introduction to Linux and Basic Linux Commands for Beginners; Author: sakitech;https://www.youtube.com/watch?v=IVquJh3DXUA;License: Standard Youtube License