Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:29:22+00:00 2026-06-05T09:29:22+00:00

I have to do an exercise for a parallel computing course. I used MPJ

  • 0

I have to do an exercise for a parallel computing course. I used MPJ Express to distribute tasks to several processes (in my case 5 processes). I solved all the sub tasks, which are working fine. Now I want to implement a simple user dialog so that my professor can choose which subtask he wants to run, like “please enter ‘1’ if you want to run assignment 1. I used following code to read input from the console:

 InputStreamReader isr = new InputStreamReader(System.in);
                BufferedReader br = new BufferedReader(isr);
                System.out.println("Enter a number between 1 and 4");
                String s = br.readLine();

Since I have to run the application using a .bat file which runs my application with 5 instances (for each process one instance), the console input can’t be “mapped” to a specific process. So my application just keeps hanging when waiting for user input.

Does anyone has a solution how I could overcome this problem?
Many thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:29:24+00:00Added an answer on June 5, 2026 at 9:29 am

    Why don’t you implement some kind of protocol over the Scatter operation to distribute your user’s input: for example treat received message from parent process as a pair : (command code, command data). Handle at least two command codes in your child processes:

    1. for handling user input : check if current process ID is the same as requested execution by user – and if it is – execute operation;
    2. for receiving data distributed at start of your application.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a code like this, which is solved by me following a exercise
I have a simple exercise where I call a Thread and subsequently the run()
During my university exercise I have come across strange behaviour of a variable. /*
I have been busy with a exercise where I need to compare a winning
i have to crawl last.fm for users (university exercise). I'm new to python and
I am writing a huffman implementation in Python as a learning exercise. I have
In XCode 4.2, I have some logic tests that I want to exercise against
I have a function (exercise 10.11 in Thompson's The Craft of Functional Programming )
people. For a academic exercise i have to implement a program in c for
I have to solve an exercise using awk. Basically I need to retrieve from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.