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: 60% (5 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...
-
Use Figure 17.2 to explain why cost minimization through a tangency between an isoquant and a budget line does not apply in cases where D and M are either perfect complements or perfect substitutes....
-
It looks to me that you have devoted everything to this company and they have treated you badly. Is that right?
-
Design a production plan for Mamas Stuffin in Problem 14-4 using linear programming and Excel Solver. a) Annual demand= 36,000 pallets Average annual demand = 36,000/12= 3,000 Total number of workers...
-
Levinn's utility function is expressed as the following: U= C1 C2 0.3 where C1 is his first period consumption and C2 is his second period consumption. His income in the first period is $2500 and...
-
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
-
As a loud, low-frequency sound wave travels past a small balloon, the balloons size is affected. Explain what happens.
-
From a purely physical perspective the function of an ecosystem is recognized by "a continuous transformation of matter and energy." In other words, nature manifests its existence through this...
-
Why is it good for the economy that markets be efficient?
-
Who is the CFO, and where does this individual fit into the corporate hierarchy? What are some of his or her responsibilities?
-
Whats the difference between a commercial bank and an investment bank?
-
The contingent valuation method (CVM) works with the premise that it is possible to create an "artificial" market-like condition and elicit individuals" WTP through a well-designed survey questions....
-
When auditing contingent liabilities , which of the management assertions discussed in professional auditing standards are of primary concern to an auditor? Explain.
-
5. Convert the following ERD to a relational model. SEATING RTABLE Seating ID Nbr of Guests Start TimeDate End TimeDate RTable Nbr RTable Nbr of Seats RTable Rating Uses EMPLOYEE Employee ID Emp...
-
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 )?
-
what steps/How starbuck company take in their digital transformation. The pros and cons of their digital trasformation. write down the references too
-
A multi-specialty medical center has several physicians. Each physician has one specialty. The administration of this medical center needs to keep track of the information about each physician such...
-
1.1. You are assigned to develop a personalized contacts management app for Android using Java and XML with a backend SQLite database. The app will allow users to store and manage their contacts'...
Study smarter with the SolutionInn App