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
inessss [21]
3 years ago
7

Write a program that accepts a phrase of unspecified length on the command line. For example: prompt% letter print Operating Sys

tems Class at Kent-State The main0 in this program has to create two threads running functions (vow and cons). The threads should take turns printing the respective words of the phrase supplied on the command line. The vow thread should print all the words that start with a vowel and the cons thread should print all words starting with a consonant. Note that the main thread (running main0) should not print anything itself-the output should be supplied by the threads that it creates. The order of words in the phrase should not be changed in the printout. Your program should work for any phrase of any reasonable length, not just the one given in the example. The output of your program should looks similar to the following prompt% letter print Operating Systems Class at Kent-State vow: Operating cons: Systems cons: Class vow: at cons: Kent-State In this part you are not allowed to use synchronization primitives such as mutexes for thread coordination. You can use sched yield0 to relinquish control of the CPU

Computers and Technology
1 answer:
Sedaia [141]3 years ago
3 0

Answer:

Check the explanation

Explanation:

#define _MULTI_THREADED

#include <pthread.h>

#include <stdio.h>

#include <errno.h>

#define           THREADS          2

int               i=1,j,k,l;

int argcG;

char *argvG[1000];

void *threadfunc(void *parm)

{

int *num;

num=(int*)parm;

while(1)

   {

   if(i>=argcG)

   break;

   if(*num ==1)

   if(argvG[i][0]=='a' ||argvG[i][0]=='2'||argvG[i][0]=='i' ||argvG[i][0]=='o' ||argvG[i][0]=='u')

   {

   printf("%s\n",argvG[i]);

   i++;

   continue;

   }

    if(*num ==2)

   if(!(argvG[i][0]=='a' ||argvG[i][0]=='2'||argvG[i][0]=='i' ||argvG[i][0]=='o' ||argvG[i][0]=='u'))

   {

   printf("%s\n",argvG[i]);

   i++;

   continue;

   }

   sched_yield();

   }

return NULL;

}

int main(int argc, char *argv[])

{

pthread_t            threadid[THREADS];

int                  rc=0;

int                  loop=0;

int arr[2]={1,2};

argcG=argc;

for(rc=0;rc<argc;rc++)

argvG[rc]=argv[rc];

printf("Creating %d threads\n", THREADS);

for (loop=0; loop<THREADS; ++loop) {

     rc =pthread_create(&threadid[loop], NULL, threadfunc,&arr[loop]);

}

for (loop=0; loop<THREADS; ++loop) {

   rc = pthread_join(threadid[loop], NULL);

}

printf("Main completed\n");

return 0;

}

The below attached image is a sample output

You might be interested in
What doyou mean by process model and project model?
vlabodo [156]

Answer:

A process model is a narrative of each type of process. These models consist of processes that are inherently similar and are categorized accordingly; a logical set of actions executed in a comprehensible framework.

A project model is concise and visual, it depicts how a project will be implemented. They are specifically tailored according to each project, describing each of its functional aspects. Decision gates and partitions are important aspects and need to be exemplified throughout the project.

4 0
3 years ago
The net force on a vehicle that is accelerating at a rate of 1.2 m/s2 is 1500 newtons. What is the mass of the vehicle to the ne
Rudiy27

Answer:

The mass of the vehicle is 1250kg

Explanation:

Given

Net\ Force = 1500N

Acceleration = 1.2m/s^2

Required

Determine the vehicle's mass

This question will be answered using Newton's second law which implies that:

Net\ Force (F) =  Mass (m) * Acceleration (a)

In other words:

F = ma

Substitute values for F and a

1500 = m * 1.2

Make m the subject

m = \frac{1500}{1.2}

m = 1250kg

<em>Hence, the mass of the vehicle is 1250kg</em>

6 0
3 years ago
Assume that you have been hired by a small veterinary practice to help them prepare a contingency planning document. The practic
nikdorinn [45]

Answer:

Answer explained below

Explanation:

Given: The information provided is given as follows:

  • There is a small veterinary practice which includes the services like office visits, surgery, hospitalization and boarding.
  • The clinic only has a small LAN, four computers and internet access.
  • The clinic only accepts cats and dogs.
  • Hurricanes are the major threatening factor in the geographical region where the clinic is located.
  • The clinic is established in a one-story building with no windows and meet all the codes related to hurricanes.
  • As public shelters do not allow animals to stay when there is a possibility of hurricanes, therefore the clinic does not accept animals for boarding during that time

Contingency planning documents for the tasks given is as follows:

  1. Threat category along with their business impact:
  • Hurricane: It is given that the region where the clinic is located is highly threatened by hurricanes. This type of disaster can affect the life of the employees as well as patients present in the building. Also, in case of a strong hurricane, the building can also be damaged.
  • Preventive measures: Separate shelters can be installed for animals in case of emergency.

  • Fire: In case of fire due to malfunctioning of any electrical equipment or any other reason, there is no window or emergency exit available. It can damage the building and the life of the employees and animals will be in danger.
  • Preventive measures: Services should be provided to all the electrical equipment’s from time to time and emergency exits should be constructed so that there is a way to get out of the building in case the main entrance is blocked due to any reason in the time of emergency.

  • Viral Influenza: If an employee or animal is suffering from any serious viral disease. That viral infection can easily spread to others and make other animals as well as employees sick. If the employees working in the clinic are sick. This will highly affect the efficiency of them which will then affect the business.
  • Preventive measures: This can be avoided by giving necessary vaccines to the employees from time to time and taking care of the hygiene of the patient as well as the clinic which will make the chance of infection to spread low.

  • Flood: In case of a flood like situation, as given the building has only one story and there is no emergency exit for employees and animals to escape. This can put the life of the employees and animals in danger and can affect the working of the clinic as well.
  • Preventive measures: This can be prevented by collecting funds and increasing the story’s in the building or constructing alternate site location so that in case of emergency, the animals or employees can be shifted to other locations.
4 0
3 years ago
Explain online issue management​
Over [174]

Answer:

Online issue tracking system is a computer software solution for managing issues lists. The lists of issues are defined by the organization activity field.The best example of online issue tracking software is a customer support call center. ... A Bug Tracker is also one of possible online issue tracking software

Explanation:

the answer has the explanation needed.

7 0
2 years ago
_________ cards contain a chip that can store a large amount of information as well as on a magnetic stripe for backward compati
wariber [46]

Answer:

Smart

Explanation:

The RFID or the radio frequency identification is an electronic device that stores information electronically. It stores and makes available the information which is stored electromagnetically, once the user is authenticated.

This technology is implemented in market places and other individual activities. It is implemented in cards called smart card for ease of payment transaction and promote online commerce (e-commerce). It is also implemented in smartphones.

3 0
3 years ago
Other questions:
  • Which of the following statements is false? a. Racks and bins are examples of storage equipment. b. Automation refers to equipme
    9·1 answer
  • Which should you use to find a saved file?
    15·2 answers
  • The right headlight does not function on either high or low beam. Technician A says this could be caused by an open ground on th
    12·1 answer
  • What is a computer attack where an attacker accesses a wireless computer network, intercepts data, uses network services, and/or
    7·1 answer
  • If you have an equipment failure while driving on an expressway, you should
    8·1 answer
  • ☢☢☢does anyone know how to do the TYNKER CANNON assignment ( lesson 2 intro to game design) I'll give BRANLIEST(¬‿¬)❤ dont answe
    11·2 answers
  • What does the statement that follows do? double gallons[6] = { 12.75, 14.87 }; a. It assigns the two values in the initializatio
    13·1 answer
  • Which are resources that a programmer might use? Select all that apply.
    5·2 answers
  • Davingould1115...................answer 3​
    11·1 answer
  • Operating systems move code and data, as necessary, to a portion of the disk that is used as if it were memory, not just disk st
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!