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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:50, Mordred809
Type the correct answer in the box. spell all words correctly. which view of report creation allows you to customize the report before the database program creates it? creating a report in allows you to customize the report before the database program creates it. pl asap
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, loveworld3798
When working with a team you should always do the following, except? question 3 options: be dependable and trustworthy be sensitive to others feelings do your fair share critique members of the group
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, arguellesjavier15
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
image
Computers and Technology, 23.06.2019 09:00, opgbadwolf5
What provides an array of buttons for quick access to commonly used commands and tools
Answers: 1
You know the right answer?
Two of the most fundamental functions for dealing with interprocess communication are read() and wri...

Questions in other subjects: