Question 1 Sample Run Sav Write a program in C which first initializes $./question1 [Increasing] an integer variable to a random value Variable: 188 between 100 and 200. By using signal() Variable: 198 system call for SIGINT, alter the behaviour CTRL-C [Decreasing] of Ctrl-C such that whenever this variable: 188 combination is pressed, the program Variable: 178 Variable: 168 switches between adding or subtracting 10 CTRL-O from this variable in an endless loop with 1 [Increasing] Variable: 178 second delays. Your program must indicate Variable: 188 whether it is increasing or decreasing the variable: 198 variable and it must end if value of the Variable: 208 variable is below 100 or above 200. as well. Parent should display process ID's Question 2 Write a C program which creates a child of both child processes and terminate only process. This child process must write after both of them are terminated. 1.000.000 random integers to a text file, each seperated by one space character and Sample Run then terminate. Parent process must wait $ ./question2 for this child process to terminate, then tCHILD1] Wrote 1000000 integers to create an another child process. This new numbers.txt, terminating. child process must count how many of the !PARENT] Child process ÏD: 22679 numbers in the text file are even and how numbers: 317278, terminating. [PARENT] Child process ID: 22678 [CHILD2] Even numbers: 682722, odd many of them are odd and then terminate [PARENT] Terminating.
Question 1 Sample Run Sav Write a program in C which first initializes $./question1 [Increasing] an integer variable to a random value Variable: 188 between 100 and 200. By using signal() Variable: 198 system call for SIGINT, alter the behaviour CTRL-C [Decreasing] of Ctrl-C such that whenever this variable: 188 combination is pressed, the program Variable: 178 Variable: 168 switches between adding or subtracting 10 CTRL-O from this variable in an endless loop with 1 [Increasing] Variable: 178 second delays. Your program must indicate Variable: 188 whether it is increasing or decreasing the variable: 198 variable and it must end if value of the Variable: 208 variable is below 100 or above 200. as well. Parent should display process ID's Question 2 Write a C program which creates a child of both child processes and terminate only process. This child process must write after both of them are terminated. 1.000.000 random integers to a text file, each seperated by one space character and Sample Run then terminate. Parent process must wait $ ./question2 for this child process to terminate, then tCHILD1] Wrote 1000000 integers to create an another child process. This new numbers.txt, terminating. child process must count how many of the !PARENT] Child process ÏD: 22679 numbers in the text file are even and how numbers: 317278, terminating. [PARENT] Child process ID: 22678 [CHILD2] Even numbers: 682722, odd many of them are odd and then terminate [PARENT] Terminating.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
![Question 1
Sample Run
Save PC
Write a program in C which first initializes $ ./question1
[Increasing]
Variable: 188
an integer variable to a random value
between 100 and 200. By using signal() Variable: 198
<CTRL-O
[Decreasing]
such that whenever this Variable: 188
system call for SIGINT, alter the behaviour
of Ctrl-C
combination is pressed, the program Variable: 178
Variable: 168
switches between adding or subtracting 10 CTRL-O
from this variable in an endless loop with 1 [Increasing]
Variable: 178
second delays. Your program must indicate
Variable: 188
whether it is increasing or decreasing the variable: 198
variable and it must end if value of the Variable: 208
variable is below 100 or above 200.
as well. Parent should display process ID's
Question 2
Write a C program which creates a child of both child processes and terminate only
process. This child process must write after both of them are terminated.
1.000.000 random integers to a text file,
each seperated by one space character and Sample Run
then terminate. Parent process must wait $ ./question2
for this child process to terminate, then iCHILD1] Wrote 1000000 integers to
create an another child process. This new numbers.txt, terminating.
child process must count how many of the tCHILD2] Even numbers: 682722, odd
numbers in the text file are even and how numbers: 317278, terminating.
[PARENT] Child process ID: 22678
[PARENT] Child process ID: 22679
many of them are odd and then terminate [PARENT] Terminating.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F86dadd27-9a4c-40b7-843d-433ab8a2784c%2Feb350c80-785b-4c47-ba01-8e99fd5d3fa3%2F76ytsao9_processed.png&w=3840&q=75)
Transcribed Image Text:Question 1
Sample Run
Save PC
Write a program in C which first initializes $ ./question1
[Increasing]
Variable: 188
an integer variable to a random value
between 100 and 200. By using signal() Variable: 198
<CTRL-O
[Decreasing]
such that whenever this Variable: 188
system call for SIGINT, alter the behaviour
of Ctrl-C
combination is pressed, the program Variable: 178
Variable: 168
switches between adding or subtracting 10 CTRL-O
from this variable in an endless loop with 1 [Increasing]
Variable: 178
second delays. Your program must indicate
Variable: 188
whether it is increasing or decreasing the variable: 198
variable and it must end if value of the Variable: 208
variable is below 100 or above 200.
as well. Parent should display process ID's
Question 2
Write a C program which creates a child of both child processes and terminate only
process. This child process must write after both of them are terminated.
1.000.000 random integers to a text file,
each seperated by one space character and Sample Run
then terminate. Parent process must wait $ ./question2
for this child process to terminate, then iCHILD1] Wrote 1000000 integers to
create an another child process. This new numbers.txt, terminating.
child process must count how many of the tCHILD2] Even numbers: 682722, odd
numbers in the text file are even and how numbers: 317278, terminating.
[PARENT] Child process ID: 22678
[PARENT] Child process ID: 22679
many of them are odd and then terminate [PARENT] Terminating.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY