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 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 23.06.2019 02:50
There’s only one game mode that stars with the letter ‘e’ in cs: go. which of the options below is it?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
You know the right answer?
Two of the most fundamental functions for dealing with interprocess communication are read() and wri...
Questions
question
Mathematics, 16.11.2020 23:10
question
Business, 16.11.2020 23:10
question
Mathematics, 16.11.2020 23:10
question
Mathematics, 16.11.2020 23:10
question
History, 16.11.2020 23:10
Questions on the website: 13722367