1answer.
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
Paladinen [302]
3 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. 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
Computers and Technology
1 answer:
Novay_Z [31]3 years ago
4 0

Answer: Provided in the explanation section

Explanation:

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;

}

Observation of the program:

  1. The read() call may block until data becomes available
  2. If the read() call blocks, the process will be suspended until data arrives
  3. Pipes can fill, which will cause the write() call to block until the read() call is able to read data from the pipe

⇒ Therefore,Option 1,3 and 5 correct

Cheers i hope this helped !!!

You might be interested in
For robot arms the first three axes are called
Semmy [17]

\huge\purple{Hi!}

Cartesian robots (sometimes called rectilinear or gantry robots) have three linear axes, x, y, z.

6 0
3 years ago
Submit a report outlining the steps you will take to obtain digital evidence. In your report you must include the legal requirem
Helen [10]

The steps you will take to obtain digital evidence.

  • One has to Respond First.
  • Then a Search and Seizure is ordered.
  • There is the Evidence Collection.
  • There is the Securing of the Evidence.
  • There is Data Acquisition stage.
  • Then there is Data Analysis.
  • Then there is Evidence Assessment.
  • Then there is  Documentation and Reporting.
  • The last is expert witness testimony.
<h3>What is Digital evidence?</h3>

Digital evidence is known to be a kind of information that is often saved or transmitted in a method that uses binary form that can be relied on in case of court.

Note that it is one that can be found on a computer hard drive, a mobile device such as phone, among other means.

Hence, The steps you will take to obtain digital evidence.

  • One has to Respond First.
  • Then a Search and Seizure is ordered.
  • There is the Evidence Collection.
  • There is the Securing of the Evidence.
  • There is Data Acquisition stage.
  • Then there is Data Analysis.
  • Then there is Evidence Assessment.
  • Then there is  Documentation and Reporting.
  • The last is expert witness testimony.

Learn more about digital evidence from

brainly.com/question/18566188

#SPJ1

8 0
3 years ago
Which type of network medium is used by an integrated services digital network adapter?
user100 [1]
ISDN uses a two-wire telephone line.
8 0
4 years ago
Can anybody tell me why when I use my camera to scan the question is not working?
sleet_krkn [62]

Answer:

Have you tried reseting or updating your device?

Explanation:

5 0
3 years ago
A company was asked to develop a smartphone app to help people locate a car of their choice to purchase from a complex of more t
daser333 [38]

Answer:

the gps and a map

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • As a trainer for Exempla Healthcare, Tina is faced with many challenges to properly training her new hires. There are over 40 di
    15·1 answer
  • 3. By default, Blender® remembers your last 32 actions and allows you to undo them one at a time by pressing CTRL+Z. (1 point)
    9·1 answer
  • Question 14 (3 points)
    5·1 answer
  • An AM index between 0 and 1 indicates what? a. the AM signal is very small and will not be detected by the receiver b. distortio
    12·1 answer
  • What does it mean to have an "online presence"? Explain how it can affect a job search?
    11·1 answer
  • Write a VB program to convert a temperature from Celsius to Fahrenheit and vice versa.
    15·1 answer
  • Catherine is designing the backup strategy for the new private cloud that her company is implementing. She specifies that a full
    13·1 answer
  • What is another word for: a location in memory that contains a value?
    7·2 answers
  • Freee poiiiiintttttssss​
    14·2 answers
  • Write javascript code for the form that appears in the image below. you are expected to add validation to the name field, email
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!