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: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". any value that is the same as the immediately preceding value is considered a consecutive duplicate. in this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. note that the last 3 is not a consecutive duplicate because it was preceded by a 7. write some code that uses a loop to read such a sequence of non-negative integers , terminated by a negative number. when the code finishes executing, the number of consecutive duplicates encountered is printed. in this case, 3 would be printed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system.in); is given.
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
When is a chart legend used a. all the time b. whenever you are comparing data that is the same c. whenever you are comparing multiple sets of data d. only for hand-drawn charts
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
question
Computers and Technology, 24.06.2019 02:10
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
You know the right answer?
Two of the most fundamental functions for dealing with interprocess communication are read() and wri...
Questions
question
Social Studies, 30.03.2021 01:30
question
Mathematics, 30.03.2021 01:30
question
Mathematics, 30.03.2021 01:30
question
Mathematics, 30.03.2021 01:30
question
Mathematics, 30.03.2021 01:30
question
Mathematics, 30.03.2021 01:30
Questions on the website: 13722360