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...
icon
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.
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY