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.

a. The read() call may block until data becomes available
b. 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
c. If the read() call blocks, the process will be suspended until data arrives
d. The write() call will return before all of the data has been written, if the corresponding read() call blocks mid-transfer
e. 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: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Acetylene is a gas which burns rapidly on its own, and is considered highly explosive. a) true b) false
Answers: 2
question
Computers and Technology, 22.06.2019 08:30
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
You know the right answer?
Two of the most fundamental functions for dealing with interprocess communication are read() and wri...
Questions
question
Mathematics, 27.04.2021 17:40
question
Mathematics, 27.04.2021 17:40
Questions on the website: 13722362