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

  • SEARCH
  • Home
  • 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 6380935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:19:54+00:00 2026-05-25T02:19:54+00:00

I would like to simulate a distributed system and how machines do their works,

  • 0

I would like to simulate a distributed system and how machines do their works, the topology adopted is a centralized one, I have many little systems in which each sub systems adopts this topology, I mean I suppose that my distributed system constitutes of many centralized systems.
I have created a simple discrete event simulator, which simulates the work in side One centralized system, the code is like:

public class SimuleOnesystem { 
// a set of parameters
class Arrival{// here we simulate the arrival of works to a server
 // the code..
}
class Service{// here we simulate the services  }
class Departure{// means that the work is well done
 }
}

My question is, how could I multithreaded this code, I mean I would like to execute for example 5 Centralized systems at the same time in which each system has its own simulation clock, eventList and so on, and these systems can communicate between each other in term of sending and receiving request and executing jobs etc…

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-05-25T02:19:54+00:00Added an answer on May 25, 2026 at 2:19 am

    Besides the introduction of threads, as already pointed out in the other answers, your comment to ring bearer’s answer is true: you have to take care of the event list and the simulation clock.

    As far as I can see it, your example is a fairly typical discrete-event simulation. Trying to parallelize those, even just across threads, i.e. in a single address space (executed by the same JVM on a single machine, which may have multiple cores etc.), is not quite trivial. I would suggest you start with reading some introductory material on the matter (I would recommend this book).

    Your basic problem is that you cannot prevent some threads of executing faster than others (e.g. because they have to handle less load), and hence their local clocks may advance into the simulated ‘future’. If one of the other threads, i.e. a thread that is lagging behind, now issues a new event/message that would have to be processed by one thread that is advanced too far in time, everything will break (or fail quietly and be invalid). Think of opening your mailbox today and receiving a message from last year, to which you also should have responded immediately…

    Algorithms that prevent such situations from happening are called synchronization algorithms. There are basically two flavors of those: optimistic methods allows such straggler events (messages from the past) to happen, but detect them and clean up any inconsistencies if necessary. In your case, though, it seems advisable to look at conservative algorithms first, which avoid such methods altogether. They are (usually) easier to implement, but only work well if there are certain delays between the sender of an event and the time the event has to be executed (e.g. see this classical paper for details, or this more recent one detailing a Java-based simulation system that uses conservative synchronization).
    If you have a synchronization algorithm in place, it will also manage your local simulation time clocks.

    As implementing these algorithms is rather time-consuming, you may also consider to use some Java-based simulation framework or library that already provides the methods (it’s a well-known problem).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link like this: <a href=www.example.com> I would like to simulate the
I am rendering textured quads from an orthographic perspective and would like to simulate
I would like to have a reference for the pros and cons of using
Using VS2008, we would like to simulate a file that has a size of
I don't know what exactly this feature is, but I would like to simulate
I would like to safely be able to simulate open with O_CREAT | O_WRONLY
I would like to build a simulation engine which can simulate a soccer (association
I have developed a site that has urls to other sites. I would like
How to redirect program flow to a controller action. I would like to simulate
I have a list of objects and I would like to access the objects

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.