Figure 12.5 demonstrates a concurrent server in which the parent process creates a child process to handle
Question:
Figure 12.5 demonstrates a concurrent server in which the parent process creates a child process to handle each new connection request. Trace the value of the reference counter for the associated file table for Figure 12.5.
Figure 12.5
Transcribed Image Text:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "csapp.h"
void echo(int connfd);
void sigchld_handler (int sig)
{
}
while (waitpid (-1, 0, WNOHANG) > 0)
;
return;
int main(int argc, char **argv)
{
}
int listenfd, connfd;
socklen_t clientlen;
struct sockaddr_storage clientaddr;
if (argc ! 2) {
fprintf(stderr, "usage: %s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "csapp.h"
void echo(int connfd);
void sigchld_handler (int sig)
{
}
while (waitpid (-1, 0, WNOHANG) > 0)
;
return;
int main(int argc, char **argv)
{
}
int listenfd, connfd;
socklen_t clientlen;
struct sockaddr_storage clientaddr;
if (argc ! 2) {
fprintf(stderr, "usage: %s \n", argv[0]);
exit(0);
}
Signal (SIGCHLD, sigchld_handler);
listenfd =
Open_listenfd (argv[1]);
while (1) {
clientlen sizeof (struct sockaddr_storage);
}|
connfd = Accept (listenfd, (SA) &clientaddr, &clientlen);
if (Fork () ==
== 0) {
Close (listenfd); /* Child closes its listening socket */
echo (connfd); /* Child services client */
Close (connfd);
exit(0);
/* Child closes connection with client */
/* Child exits */
}
Close (connfd); /* Parent closes connected socket (important!) */
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 57% (7 reviews)
When the parent process on the concurrent server starts executing the reference counter ...View the full answer
Answered By
PALASH JHANWAR
I am a Chartered Accountant with AIR 45 in CA - IPCC. I am a Merit Holder ( B.Com ). The following is my educational details.
PLEASE ACCESS MY RESUME FROM THE FOLLOWING LINK: https://drive.google.com/file/d/1hYR1uch-ff6MRC_cDB07K6VqY9kQ3SFL/view?usp=sharing
3.80+
3+ Reviews
10+ Question Solved
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Question Posted:
Students also viewed these Computer science questions
-
Write the C Program in which the parent process will create the child process through fork) system call. You need to perform the following activities in both child and parent processes respectively....
-
In the Linux environment, use C/C++/Java (or other languages) programming to complete the following experiments: 1) Refer to the Linux kernel source code structure, read the Linux kernel source code,...
-
Write the C Program in which the parent process will create the child process using the fork() system call. Following functionality be performed in the parent and child process. * In parent process...
-
To eliminate service inconsistencies, companies rely on ___________ and ___________.
-
Lytle Trucking projects a $3.2 million EBIT next year. The firms marginal tax rate is 40%, and it currently has $8 million in long-term debt with an average coupon rate of 8%. Management is...
-
Tri-State Mill uses a special sander to finish lumber. Data on the sander and its usage follow: Required Compute unused resource capacity in energy and repairs for Tri-StateMill. Cost Driver Rate...
-
Financial ratio analysis is conducted by four groups of analysts: managers, equity investors, long-term creditors, and short-term creditors. WTiat is the primary emphasis of each of" these groups in...
-
The Marino Company had the following balance sheet on January 1, 2010: On January 2, 2010, the Paul Company purchased the Marino Company by acquiring all its outstanding shares for $300,000 cash. On...
-
Q1. (10 points) Consider the following figure: LSL USL 30 99.73% 2200 605 1036 20 -le per 10 20 30 e 5o 60 Spes. Lim Percent lesie Specs Defective 1 Sigma 68 27 317300 +2 Sigma 95.45 45500 3 Sigma...
-
Assume that a CGI program needs to send dynamic content to the client. This is typically done by making the CGI program send its content to the standard output. Explain how this content is sent to...
-
Write a program dd2hex.c that converts its 16-bit network byte order to a 16-bit hex number and prints the result. For example, linux> ./dd2hex 1024 0x400
-
Explain the strategies for being an effective team leader.
-
What is XYZ Corp.'s net cash flow XYZ Corp. (for 2020) Revenue $5,000,000 Wages: $1,000,000 D&A: $1,000,000 Property, Plant & Equipment investment: $1,500,000 Tax Rate: 35% NOWC (2020): $750,000 NOWC...
-
Tower x (m) y (m) UU3 -118.1 -15.6 OU1 -85.3 -15.9 Sensor heights (m) 3.19, 4.16, 5.04, 7.24, 9.84 1.5, 3.0, 5.46, 9.86, 15.65 OU2 -90.0 -8.3 1.5, 2.96, 5.97, 9.91, 15.08 ASU -22.8 -8.6 5.0 UUT -13.3...
-
For each of the matrices determine the value(s) of c for which the given matrix is not invertible. [4 25. 26. 3 5 } ] 6 27. 28. 2 c+4 C -8 c-6]
-
Spitfire Company makes and sells three products: A, B, and C. The following data relate to these products: A B Demand in units Selling price per unit 110 100 90 $180 $210 $195 Raw material costs per...
-
NCF & Partners (NCF) is a firm of CPAslocated in Whitby that has been in business for 20 years. NCF's revenue has declined steadily over the past few years. The partners are looking for ways...
-
A gravimetric analysis of a mixture of ideal gases contained at 40 8C and 200 kPa shows 40% N2, 35% O2, and 25% CO2. Determine the volume of the 10-kg mixture and the work required to increase the...
-
In exchange for land, the company received a 12-month note on January 1. The face amount of the note is $1,000, and the stated rate of interest is 13%, compounded annually. The 13% rate is equal to...
-
Calculate 1.666015625 10 0 (1.9760 10 4 + -1.9744 10 4 ) by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the...
-
Calculate (1.666015625 10 0 1.9760 10 4 ) + (1.666015625 10 0 -1.9744 10 4 ) by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and...
-
Based on your answers to 3.38 and 3.39, does (1.666015625 10 0 1.9760 10 4 ) + (1.666015625 10 0 -1.9744 10 4 ) = 1.666015625 10 0 (1.9760 10 4 + -1.9744 10 4 )?
-
Lisa planned to produce 1,200 board sets in 2020. It actually produced 1,500 board sets. The following cost data for wood and direct labor related to Lisa' production in 2020: Standard Costs Actual...
-
Can anyone help with this? Summary of Transactions Exhibit 1.9 Cash Assets + Accounts + Supplies - Equipment Recevable Liabilities + Accounts + Common Payable Stock $30,000 Equity + Revenues...
-
Required: 1. Calculate the balance that should be reported in Allowance for Doubtful Accounts as of December 31. 2. Prepare the adjusting journal entry that is required on December 31. 3. Show how...
Study smarter with the SolutionInn App