Computer Systems: A Programmer's Perspective (3rd Edition)
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
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 8.20HW

Use execve to write a program called my1s whose behavior is identical to the /bin/ is program. Your program should accept the same command-line arguments, interpret the identical environment variables, and produce the identical output.

  The 1s program gets the width of the screen from the COLUMNS environment variable. If COLUMNS is Unset, then 1s assumes that the screen is 80 columns wide. Thus, you can check your handling of the environment variables by setting the COLUMNS environment to something less than 80:

linux> setenv COLUMNS

linux> ./my1s

.

. //Output is 40 columns wide

.

linux> unsetenv COLUMNS

linux> ./my1s

.

 //Output is now 80 columns wide

.

Blurred answer
Students 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.
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.
We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game generates. Complete the main() function that implements this game by calling the get_user_input(), generate_secret(), and display_result(user_input, secret) functions that you will develop as follows: • Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters. • Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive). • Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference between these two numbers. For example: Test Input Result random.seed (10) S Enter a number from 1 to 2015 You entered 5. The secret was 19. The…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
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