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
gayaneshka [121]
4 years ago
7

Your task is to improve a multi-threaded program that frequently writes small entries to a shared file by introducing a layer th

at merges in memory before writing to file to reduce the number of expensive I/O operations. Imagine a program which writes to file small log entries very frequently. The program is multithreaded and each thread writes log entries to a common log file. To simplify implementation, each thread just writes log individually with blocking I/O interface. Even though threads write to the shared file concurrently without any locking, this is correct because the OS guarantees the atomicity of individual write() operation
Computers and Technology
1 answer:
VikaD [51]4 years ago
5 0

Answer:

The program is given below

import java.io.IOException;

import java.util.InputMismatchException;

import java.util.Scanner;

public class Add {

public static void main(String[] args)throws IOException

{

   int a=0, b=0, sum;

   Scanner sc=new Scanner(System.in);

   System.out.println("Enter the numbers to be summed");

   try{

       a=sc.nextInt();

       sc.nextLine();

       b=sc.nextInt();

   }

   catch(InputMismatchException e){

       System.out.println("Please enter an Integer number");

       e.printStackTrace();}

   catch(Exception e){System.out.println(e);}

   sum=a+b;

   System.out.println(sum);

   sc.close();

}

}

You might be interested in
After the closing entries have been posted:
Nimfa-mama [501]
Closing entries are entries<span> made at the end of an accounting period to zero out all temporary accounts. The balances are transferred to permanent accounts. 
After the closing entries have been posted:
A. the temporary accounts are zeroed out
Revenues and expenses are transferred to the income Summary Account and then Income Summary is closed to Retained earnings.</span>
7 0
3 years ago
Which is an example,of an input devices? Choose the answer.
Alenkasestr [34]

Answer:

microphone

Explanation:

You have to plug in microphones, and if you plug it in, it is considered an input.

3 0
3 years ago
What piece of marketing material would be the most important when running an e-commerce website? coupons location logarithms cre
Yuri [45]
The answer would be coupons 
8 0
4 years ago
Read 2 more answers
1.
aev [14]

The pictures that people post and the likes that they receive have the power to influence the actions of the people who see them.

Answer: Option (A) is correct

<u>Explanation:</u>

The pictures and the text that is posted on social media have a great influence on the actions of a person viewing it. So it is of utmost consideration that whatever we share on social media should have a positive impact on the actions of the viewer.

Social media has become an important part of our lives, and if something negative is posted by someone on this platform, then it might influence our mind and we will respond accordingly. So it advisable to always post correct and positive content on social media to get good and encouraging feedback.

7 0
3 years ago
Read 2 more answers
Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
ZanzabumX [31]

Answer:

Explanation:

Find attach the solution

6 0
3 years ago
Other questions:
  • Consider a simple application level protocol built on top of udp that allows a client to retrieve a file from a remote server re
    15·2 answers
  • Which of the following websites can help you learn about general career trends? A. Bureau of Labor Statistics B. Career Cruising
    6·1 answer
  • if you wanted to predict the value of the y variable when the x variable is 15, you would be _____ the data. correlating extrapo
    14·2 answers
  • Templates contain common layout and formatting that can save you time by not having to recreate documents from scratch. True or
    10·1 answer
  • Design a Ship class with the following members:
    13·1 answer
  • Which formula is a complex formula?<br> =D6/E10<br> =10-(A3-D13)<br> =C3+10+E3<br> =5+A1*B1
    12·2 answers
  • Accessing disk is much slower than accessing memory. As a result, many file systems have been designed with various optimization
    7·1 answer
  • Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program sh
    6·1 answer
  • U $ er Ideas for R 0 B 1 0 X?
    12·2 answers
  • you are a bank loan officer. carter has to come into your office and applied for a loan for a car.you ran his credit report, and
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!