You need to write and run C programs (as processes on your Linux machine), and monitor their behavior. Consider the following problem: A program is to be written to print all numbers between 1 and 1000 (inclusive) that are not (evenly) divisible by either 2 or 3. This problem is to be solved using three processes (P0, P1, P2) and two one-integer buffers (B0 and B1) as follows: P0 is to generate the integers from 1 to 1000, and place them in B0 one at a time. After placing 1000 in the buffer, P0 places the sentinel 0 in the buffer, and terminates. P1 is to read successive integers from B0. If a value is not divisible by 2, the value is placed in B1. If the value is positive and divisible by 2, it is ignored. If the value is 0, 0 is placed in B1, and P1 terminates. P2 is to read successive integers from B1. If a value is not divisible by 3, it is printed. If the value is positive and divisible by 3, it is ignored. If the value is 0, P2 terminates. Write a program to implement P0, P1, and P2 as separate processes and B0 and B1 as separate pieces of shared memory {each the size of just one integer}. Use semaphores to coordinate processing. Access to B0 should be independent of access to B1; for example, P0 could be writing into B0 while either P1 was writing into B1 or P2 was reading.
In: Computer Science
At 700 K acetaldehyde decomposes in the gas phase to methane and
carbon monoxide. The reaction is:
CH3CHO(g)→CH4(g)+CO(g)
A sample of CH3CHO is heated to 700 K and the pressure is measured
as 0.43 atm before any reaction takes place. The kinetics of the
reaction are then followed by measurements of total pressure and
these data are obtained:
t(s) | 0 | 1000 | 3000 | 7000 |
PTotal (atm) | 0.43 | 0.50 | 0.59 | 0.68 |
Question:
Find total pressure after 1.39×104 s .
In: Chemistry
TASK 1
Chantel Cohen works for ABC retailers and is seeking management’s approval to install an automatic mail-response system. Using the correct proposal format, write to Jamie Oliver, Chantel’s manager requesting a decision to be made with regard to the installation of an automatic mail-response system.
Pay careful attention to the following:
· Audience, register, tone and style
· Choice of words and language structure
· Format
Criteria used for Assessment Marks
Correct format 3
The problem 5
The solution 14
Cost analysis 4
Conclusion 4
Total 30
In: Accounting
************CODING IN C++ ONLY ********************
Instructions
Write a function, remove, that takes three parameters: an array of integers, the number of elements in the array, and an integer (say, removeItem).
The function should find and delete the first occurrence of removeItem in the array. (Note that after deleting the element, the number of elements in the array is reduced by 1.) Assume that the array is unsorted. Also, write a program to test the function.
Your program should prompt the user to enter 10 digits for the array. Display the starting array to the user and prompt them to select an integer to remove. After the selected integer has been removed, the updated list should be displayed to the user. If the value does not exist or the array is empty, output the following message: x is not in the list
GRADING CRITERIA
1) Defined the remove function
2) Removing elements from the list
3) List does not contain integer to be removed
TESTING WITH INPUT
2 7 6 8 3 9 10 1 5 4 6
OUTPUT SHOULD BE
2 7 8 3 9 10 1 5 4
*************************************
A SAMPLE OF MY CODE, IT HAS MANY ERRORS
#include <iostream>
using namespace std;
void remove(int arrayList[],int& size,int
removeItem)
{
int i, j;
for (i = 0; i < size; i++)
if (arrayList[i] == removeItem)
if(i == size-1)
{
//decrease items
size--;
return;
}
else
{
for (j = i; j < size-1; j++)
arrayList[j] = arrayList [j+1];
size --;
return;
}
cout <<" item" << remove item << is not found in
the array";
}
In: Computer Science
1. What is the pH of pure water?
2. What is the change in pH when 10.0 mL of 0.010 M HCl is added to 500 mL of pure water.
3. What is the change in pH when 10.0 mL of 0.010 M NaOH is added to 500 mL of pure water.
In: Chemistry
You are planning to save for retirement over the next 20 years. To do this, you will invest $900 a month in a stock account and $600 a month in a bond account. The return of the stock account is expected to be 9 percent, and the bond account will pay 5 percent. When you retire, you will combine your money into an account with a return of 7 percent.
How much can you withdraw each month from your account assuming a 20-year withdrawal period?
Multiple Choice
a)$78,868.22
b)$6,572.35
c)$373,037.17
d)$6,440.9
e)$6,703.8
In: Finance
In: Finance
Compare and contrast spin recovery procedures for
Cessna 150 and
T-37 What makes the recoveries different for each aircraft?
In: Physics
In: Anatomy and Physiology
Suppose astronomers were to discover a new comet at an aphelion of 40.0 AU, with a transverse velocity of v0= 941 m/s
What
In: Physics
The neo-classical growth model emphasizes two determinants of intensive growth (ie. growth in output per person). Write a concise essay in which you explain the operation of the neo-classical growth model and the role played by the two key determinants of growth within the model.
In: Economics
Halley's comet, which passes around the Sun every 76 years, has an elliptical orbit. When closest to the Sun (perihelion) it is at a distance of 8.823
In: Physics
Interpret these correlation coefficients:
•r = -0.84 between total mileage and car resale value
•r = 0.03 between anxiety level and college GPA
•r = 0.56 between age of schoolchildren and reading comprehension
In: Math
You are working in an area that has been contaminated by heavy metals, what plant-based strategy will you try to remediate the soil so that you can later create a park?
In: Biology
go online and find some exchange-rate policy that is going on in the world. It doesn't necessarily have to be between the United States and some other country it could be between Australia and the Philippines for example.
Again using chapter as a guide, find some trade events or policies that are going on in the world that are driving the currency exchange - and the Net Capital Out or Inflow. Is it a case where the purchase power is way off? Is it military or conflict driven? Is it currency (de)valuation?
In: Economics