subject

Two of the most fundamental functions for dealing with interprocess communication are read() and write(). Consider the following otherwise valid C program:int r, pipeFDs[2]; char message[512];
pid_t spawnpid;

pipe(pipeFDs);
spawnpid = fork();

switch (spawnpid)
{
case 0:
close(pipeFDs[0]); // close the input file descriptor
write(pipeFDs[1], "hi process, this is the STUFF!!", 21);
break;

default:
close(pipeFDs[1]); // close output file descriptor
r = read(pipeFDs[0], message, sizeof(message));
printf("Message received from other: %s\n", message);
break;
}

Select each of the following answers that is correct. CAN BE MULTIPLE CHOICES...
(1) The read() call may block until data becomes available
(2) When the read() call returns, this one call will return all of the data that was sent through the pipe, which is different behavior than if this was a socket
(3) If the read() call blocks, the process will be suspended until data arrives
(4) The write() call will return before all of the data has been written, if the corresponding read() call blocks mid-transfer
(5) Pipes can fill, which will cause the write() call to block until the read() call is able to read data from the pipe

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
20 points archie wants to use a reflector as he photographs a newlywed couple. what would he consider in his choice? a. shadow and sunny b. homemade and professional c. lamps and boards d. incident and reflected e. neutral density and enhancement
Answers: 3
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
You know the right answer?
Two of the most fundamental functions for dealing with interprocess communication are read() and wri...
Questions
question
Computers and Technology, 10.03.2022 22:10
question
Mathematics, 10.03.2022 22:10
question
Mathematics, 10.03.2022 22:10
question
Mathematics, 10.03.2022 22:10
Questions on the website: 13722360