answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kamila [148]
2 years ago
3

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
Computers and Technology
1 answer:
ValentinkaMS [17]2 years ago
6 0

<u>Solution and Explanation:</u>

 "The read() call may block until data becomes available"

             This is true for Blocking read, false if Non-Blocking read

   There are 2 kinds of read() call

                1)Blocking (Reader will block until some data is there for read)

                2)Non-Blocking (Reader won't blocked, but ERROR status will be returned)

   To make Non-Blocking we have to call

fcntl(pipeFDs[1], F_SETFL, O_NONBLOCK);

If Non-Blocking read() call won't block the process, Error status EAGAIN will be returned instead of number of bytes read.

 If Blocking (By Default) , read() call will block the process until some bytes write by writer .

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                                      "This is false"

   For Both Socket and Pipe Read will give bytes based on Buffer size specified.

   IF More Bytes available than given buffer size, only bytes that can be fit it Buffer capacity will be copied to Buffer. Next Bytes will be given in next read() call

   If Less or equal number of bytes to Buffer size is available, all will be copied to buffer

You might be interested in
Type the correct answer in the box. Spell all words correctly.
kvasek [131]

Answer:

Presentations?

Explanation:

6 0
2 years ago
Mary has been locked out of her account after failing to correctly enter her password three times. As the system administrator,
Digiron [165]
Oh hey lol yea yea lol I got the money back to me put on the phone so you know
7 0
2 years ago
If byte stuffing is used to transmit Data, what is the byte sequence of the frame (including framing characters)? Format answer
Lerok [7]

Answer:

Correct Answers: 01h 79h 1Bh 78h 78h 1Bh 7Ah 04

Explanation:

Solution is attached below

4 0
2 years ago
The Tell Me feature also includes access to the _____ feature.
Ierofanga [76]

Answer:

the quick access toolbar can be customized to include additional commands such as. -"tell me what you want to do" box ... custom programs or additional commands that extend the functionality of a Microsoft office program ... in the open window. it also includes ribbon display options and control buttons that enable you to ...

Explanation:

7 0
2 years ago
In what section of the MSDS would you find information that may help if you use this substance in a lab with a Bunsen burner?
dybincka [34]

Answer:

The answer is "Fire-fighting measures".

Explanation:

This section is used to includes instructions to combat a chemicals flame. It is also known as the identify sources, which include the instructions for effective detonating devices and details for removing devices only appropriate for just a specific situation. It is the initiatives list, that is necessary destruction technology, materials; flaming inferno dangers.

8 0
2 years ago
Other questions:
  • Name an analog quantity other than temperature and sound.
    14·1 answer
  • Suppose the algorithms used to implement the operations at layer k is changed. how does this impact services at layers k-1 and k
    10·1 answer
  • Which of these is an on-site metric for social media marketing?
    13·1 answer
  • Marissa works at a company that makes perfume. She noticed many samples of the perfume were not passing inspection. She conducte
    6·2 answers
  • PHP is based on C rather than ______.
    5·1 answer
  • Write a program to determine all pairs of positive integers, (a, b), such that a &lt; b &lt; 1000 and [a2 + b2 + 1)/(ab) is an i
    13·1 answer
  • A 'array palindrome' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are sa
    5·1 answer
  • Distinguish among packet filtering firewalls, stateful inspection firewalls, and proxy firewalls. A thorough answer will require
    9·1 answer
  • Which of the following is true of how the Internet has responded to the increasing number of devices now using the network? a) T
    12·2 answers
  • Write a statement to create a new Thing object snack that has the name "potato chip". Write the statement below.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!