Write a program that creates an array of length 10, then creates 8 threads. should request entrance to their critical sections that is controlled through semaphores, read the values written in the array, and write it to the screen with the following format: "Consumer number - consumed item number-with the value -" And to a file named "Consumer activity", then exit the critical section, and repeat till the producers stop production. The total number of elements generated by the producer and consumed by the consumers should be 10,000,000 number
Q: Roni and Rajesh love to play a rope-based game. The game is as follows. At first, Tracy writes a…
A: Algorithm: First input contains a single integer T, the number of test cases. Then the second line…
Q: Write the definition of the class linkedQueueType, which is derived from the class…
A: This solution has two files. name is mentioned in the step. please create both the files in the same…
Q: c. Write a Java a program with a main thread and two user threads, thrdl and thrd2. i) Have thrdl…
A: package prassu;import java.util.Scanner;public class myThread {public static void main(String[]…
Q: Implement the Round Robin Scheduler as described in attached notes “Round Robin Scheduler…
A: Answer :
Q: Consider the BadReaderWriter.java program attached with this homework. The program has three…
A: According to the infromation given:- we have to BadReaderWriter.java. It had 3 threads (reader,…
Q: you will create a spell checker. The program will take three command line arguments: number of words…
A: Filename: main.cpp #include <iostream> #include <string> #include "QuadraticProbing.h"…
Q: 3. Create a class with method to count odd and even number in 3X3 matrix. Create two threads to…
A: //find frequency of odd and even numbers in 3x3 matrix using Runnable interface class matrix…
Q: Write a multithreaded program (using pthread in Linux) that calculates various statistics values for…
A: Write a multithreaded program (using pthread in Linux) that calculatesvarious statistics values for…
Q: Part 3 One way to organize a collection of words is to use an array of sorted lists. The array…
A: Abstraction : One of the hard parts about PC writing computer programs is that, by and large,…
Q: Try the following commands in the C (CodeBlocks)"Interactions" pane and note what happens. Then try…
A: There are many languages which are used in today's wold. Computer language can be described as a…
Q: 4 Create a 10-D array with random digits (0-9) populated by 10 threads simultaneously. Scale the…
A: 4. import java.util.Random; import java.util.*; public class Main { public static void…
Q: c) Create a thread class named Worker that takes two positive integers, when it starts running, it…
A: ANSWER:-
Q: public class Facility implements Iterable { protected String name; } protected class StorageUnit {…
A: public class Facility implements Iterable { protected String name; protected class StorageUnit…
Q: neo Array length: 15 y name is heban :: created by Thread-0 nane is hebany :: created by Thread-1…
A: Our task: Provide a multithreaded java program to generate the output:
Q: In quicksort, after finishing the first partitioning, the array is looking like this: 25189 12 11 10
A: Step 1:- 8 and 9 are at their correct positionsAll elements on the left of 8 and 9 are smaller than…
Q: Write a multithreaded program using Pthreadlibraryin C++ that calculates various statistical…
A: Write a multithreaded program using Pthreadlibraryin C++ that calculates various statistical…
Q: Write a C program to implement threading. a. Use following two Arrays a. Student…
A: #include #include #include #include void* thread_1(void* arg) { int i; int *marks = (int…
Q: your program. #include int main (int argc, char *argv[]) { int i, thread id; int glob nloops, priv…
A: Here i filled up the blanks: ================================== 1.#pragma omp parallel…
Q: fork-join threading
A: Code: import java.util.Arrays;import java.util.concurrent.ForkJoinPool;import…
Q: Enter N For Nx2 Matrix: 3 homework3 [Java Application)…
A: Code import java.io.*;import java.util.*;class Main { static void rotate(int n, int matrix[][]){…
Q: The following recursive method is causing an exception because the base case is missing. This…
A: Here method print() will print element of array in reverse order. In this code we are passing last…
Q: In this part, you are required to write a program, using linked lists, that manipulates a set of…
A: #include <iostream>using namespace std;class cellphone{ private: long SerialNum;…
Q: Please use java Write a multithreaded program (using pthread in Linux) that calculates various…
A: Write a multithreaded program (using pthread in Linux) that calculatesvarious statistics values for…
Q: If in the ArrayStack, the first element that we push to the stack, is stored in location capacity -…
A: Let the capacity of stack be 10. If we perform the push in following order Push 2 Push 4 Push 6 Push…
Q: you will create a spell checker. The program will take three command line arguments: number of words…
A: #Code in C++ Filename: QuadraticProbing.cpp #include "QuadraticProbing.h"#include…
Q: Write a program such that the main method creates an array of 1000 double numbers and creates 10…
A: import java.lang.Math; class InitializeArray implements Runnable { private Thread t;…
Q: 8.11 LAB: Movie show time display Java Please Write a program that reads movie data from a csv…
A: ANSWER:-
Q: Below is a memory diagram of a LinkedIntList object. Which of the code fragments below the diagram…
A: Answer: Node newNode = new Node();newNode.item = 50;newNode.next = first.next;first.next = newNode;
Q: using C language Write a program that creates an array of length 10, then creates 8 threads. should…
A: Write a program that creates an array of length 10, then creates 8 threads. should request entrance…
Q: mplement the producer consumer problem (also known as bounded buffer problem) in java. create two…
A: producer : The producer’s job is to generate data, put it into the buffer. Consumer : The consumer…
Q: Write a windows32 assembly language program in visual studio that utilizes a recursive procedure.…
A: Using digital signal, function statements are: 1) That method has to be the same regardless of which…
Q: 4 Create a 10-D array with random digits (0-9) populated by 10 threads simultaneously. Scale the…
A: 4. import java.util.Random; import java.util.*; public class Main { public static void…
Q: implementation in Java
A: Introduction Java is a kind of programming language that provides a large number of applications…
Q: Write a server and client programs that do the following based on the written pseudocode: Client…
A: If one program is running into the network and a communication link is present within them then…
Q: Write a multithreaded program using Pthread library in C++ that calculates various statistical…
A: Program Approach:- Declaring the Global variables. Set length of the array to 7 as the given input…
Q: Write a function that will play Rock, Paper, Scissors with itself. It will pick two random elements…
A: Answer import random rps = [ 'rock' , 'paper' , 'scissors' ] rock = paper = scissors = 0 def…
Q: for this code explain How are the private variables created by the reduction parameter initialized?…
A: Definition: The reduction clauses are data-sharing attribute clauses that can be used to perform…
Q: Consider the BadReaderWriter.java program attached with this. The program has three threads, namely,…
A: Answer :
Q: We need to write a Java program that allows us to calculate the average grade in a class The program…
A: Solution Programming Approach Create class Grades.java Import necessary package Use he…
Q: Modify and run the program shown below in the following way. There is an array of 20 elements…
A:
Q: Write a multi-threading JAVA program that search creates a random array of integers (500 entries)…
A: The program is written in Java. Check the program screenshot for the correct indentation. Please…
Q: Create an application in Java that creates n (this is set at the beginning of the application not…
A: Given that, Create an application in Java that creates n (this is set at the beginning of the…
Q: Write a java application withtwothreads named “Thread-1” and “Thread-2”. The “Thread-1”reads the…
A: ANSWER:
Q: Write a Java program that simulates a basic library delivery system. The user of the program will be…
A: Program code: //import the required packagesimport java.io.*;import java.util.*;//define a class…
Q: Explain why synchronization is necessary in the following situation: You have modeled a bank as an…
A: Introduction: Synchronization is the process of managing multiple thread requests for resource…
Q: package Q2; import java.io.FileInputStream; import java.io.FileNotFoundException; import…
A: Code: package Q2; import java.io.FileInputStream; import java.io.FileNotFoundException; import…
Q: Write a multithreaded program (using pthread in Linux) that calculates various statistics values for…
A: Write a multithreaded program (using pthread in Linux) that calculatesvarious statistics values for…
Q: around a table with one chopstick between each of them. Let the Philosophers be numbered from 0 to…
A: Solution : As the code in the given question. This will lead to deadlock. Conditions of deadlock…
Q: Create an application in Java that creates n (this is set at the beginning of the application not…
A: The java code is gien below:-
using C language
Write a program that creates an array of length 10, then creates 8 threads.
should request entrance to their critical sections that is controlled through semaphores, read the values written in the array, and write it to the screen with the following format: "Consumer number - consumed item number-with the value -" And to a file named "Consumer activity", then exit the critical section, and repeat till the producers stop production. The total number of elements generated by the producer and consumed by the consumers should be 10,000,000 number
Step by step
Solved in 3 steps
- using C language Write a program that creates an array of size 10000, then creates two threads.should requests entrance to the critical section that is controlled through semaphores, reads the values written in the array, and writes it to the screen with the following format: "Consumer consumed item number - from position - with the value -" And to a file named Consumer activity, then exits the critical section, and repeats till the producer finishes productionIn Java programming Write the code to print out a customer report. Your code must read each customer from a file, populate the object, place the object in a linked list, and display the data from the linked list. Use the customer object name from Customer customer = new Customer ( “ customer name” ); Assume you have opened a file and read a line into the customer object. Write the signature line for this method Write the line of code that will write the object to a linked list Write the line of code that will print the customer object properties. Be sure to include a textual description of each property.In Java programming Write the code to print out an inventory report. Your code must read each inventory item from a file, populate the object, place the object in a linked list, and display the data by reading from the linked list after all items have been added. Use the inventory object name from Inventory inventory = new Inventory ( “inventory“); Assume you have opened a file and read a line into the inventory object Write the signature line for this method Write the line of code that will print the inventory object properties. Be sure to include a textual description of each property.
- In Python Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents…In java Browse Project Gutenberg (https://www.gutenberg.org/) for plain text versions of one or more works of literature of your choosing. Write a program that repeatedly searches a file for a target word or phrase.• Allow the user to supply the name of the file to search by means of a command-line argument; if the user does not supply a command line argument, ask for a file name interactively.• You may use either an array or an ArrayList to store each line in the file; but if you use an array, you’ll have to determine the array size (number of lines) before allocating the array. There are several ways to do this.• Report how many lines were read from the file.• Search for either individual words or phrases (Hint: use the .contains method, it’ll work for either a word or a phrase)• Show both the line number and the line itself for each line that contains the search target entered by the user (you may count the first line in the file as line 0).• If a search word is part of a larger…In Java Write a program that reads the student information from a tab separated values (tsv) file and creates a text file that contains student information together with the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Output the last names, first names, exam scores, and letter grades of the students into a text file named report.txt. Output one student per row and separate the values with a tab character. Ex: If the input of the program is: StudentInfo.tsv and the contents of StudentInfo.tsv are: Barrett Edan 70 45 59 Bradshaw Reagan 96 97 88 Charlton Caius 73 94 80 Mayo Tyrese 88 61 36 Stern Brenda 90 86 45…
- Purpose of this assignment: To allow student to be able to implement a Java thread-based application by loading allowing user to perform a computation operation. Instruction: This is an individual assignment. You have to use Java thread to write a program that can perform two calculation functions concurrently. One of the function will generate a series of Fibonacci number sequence. The second function will calculate the result of factiorial function. This factorial function will allow the user to input a start number, end number and number of threads. Then, function will split into thread to perform the calculation. At the end, the function will merge the result of each thread calculation and display the result.in java 8.8 LAB: Course Grade Write a program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20. Assume also the last names and first names do not contain whitespaces. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam…Directions: Use a file city.txt for answering the questions that follow each scheduling algorithm. This file has three columns (comma separated): the first column contains the job Id, the second column indicates the CPU burst, and column three is the arrival time of the corresponding job. Parallel Programming It is vaccine season! COVID19 vaccines are out, and everyone is rushing to get one. Vaccines are available from six different brands and you have been entrusted to write a program to count the total number of vaccines of each brand administered across 21 cities in the state. Write a multithreaded program (in the file vaccines.cpp) that counts the number of vaccines in 21 different files of numbers. Each line in each of the files will contain either one of the following brand names: v1, v2, v3. Your program must count the number of units for each vaccine brand administered, across all 21 cities, and display the total number of units for each brand. The files are named…
- 3. Create a class with method to count odd and even number in 3X3 matrix. Create two threads to perform the operation concurrently. Display the odd and even number count in the matrix. (use Runnable interface) Original array: 413 357 826 Frequency of odd numbers: 5 Frequency of even numbers: 4Directions: Use a file city.txt for answering the questions that follow each scheduling algorithm. This file has three columns (comma separated): the first column contains the job Id, the second column indicates the CPU burst, and column three is the arrival time of the corresponding job. Parallel Programming It is vaccine season! COVID19 vaccines are out, and everyone is rushing to get one. Vaccines are available from six different brands and you have been entrusted to write a program to count the total number of vaccines of each brand administered across 21 cities in the state. Write a multithreaded program (in the file vaccines.cpp) that counts the number of vaccines in 21 different files of numbers. Each line in each of the files will contain either one of the following brand names: v1, v2, v3. Your program must count the number of units for each vaccine brand administered, across all 21 cities, and display the total number of units for each brand. The files are named "city1.txt",…JAVA PPROGRAM Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find matches you should print the name and the line numbers where the match was found. While entering the file name, the program should allow the user to type quit to exit the program. If the file with a given name does not exist, then display a message and allow the user to re-enter the file name. The file may contain up to 100 names. You can use an array or ArrayList object of your choosing, however you can only have one array or ArrayList. Input validation: a) If the file does not exist, then you should display a message "File 'somefile.txt' is not found." and allow the…