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 4234534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:22:10+00:00 2026-05-21T02:22:10+00:00

For academic purposes I’ve realized a C# library that implements computation with agents, thinking

  • 0

For academic purposes I’ve realized a C# library that implements “computation with agents”, thinking for example to what JADE does. With this library I can implement a distributed computation algorithm easily. Every agent is an object having a different thread implementing a part of the computation, while the object itself remains free to receive and dispatch messages.
These algorithms can run thousands agents (so threads), monitored by a super-agent that changes their status and synchronize them: I cannot create 10.000 threads and let them run all together, because PC could die…
So every agent has a changing status that I should draw on a GUI to let user realize what is happening during computation. And my agents can be created and killed during computation too, making it harder…
I thought to use a grid in which every cell is an agent, changing background color of every cell according to agent status, but I’m not sure how to “join” single agent to a cell (remember I cannot use an index, because agents number can change and some agent could be destroyed; I thought to create a Control for every new agent and place this Control in the GUI, so I can quickly create, place and destroy it when needed.
The big deal is the huge number of threads and the need to refresh GUI as quick as possible, because threads status change continuously and very quickly.
What can you suggest? What is the best way to accomplish my task?

UPDATE: I’m developing this library using Framework 2.0 because it MUST run under Linux too using Mono.

  • 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-21T02:22:11+00:00Added an answer on May 21, 2026 at 2:22 am

    Have a central synchronized hashmap that maps thread id -> GUI element.
    In this way the super-agent can do changes to the GUI, create new threads and atomically update the hashmap (e.g. this allows reusing GUI elements for new threads). This will obviously cause some read contention on the hashmap when the super-agent gets a lock to update it.

    edit: actually you can even get rid of the hashmap and just have an array because the maximum number of threads you can have is quite low (< 2^16), I guess. This would also get rid of the contention, because you could lock single array elements instead of the whole hashmap.

    edit2: It actually just occurred to me that you can get rid of everything. Just have a shared surface of 256×256 pixels (i.e. 2^16 pixels). Each pixel belongs to the thread whose threadID is equal to the pixel index. This way each thread only accesses its own pixel. Then create a custom control and have the OnPaint method blit the shared surface to the graphic surface.

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

Sidebar

Related Questions

This is more of an academic inquiry than a practical question. Are there any
As an academic/contrived task, I'd like to sort an indexed, 1-dimensional array so that
So this is a purely academic question, mostly as its been a while since
I’m writing some logic for academic purposes symbol source server. I have to check
EDIT: I'm not going to do this, I now realize how dangerous this can
For academic purposes, I am wondering if a parent method call should lead to
This question is purely academic, because I'd never dream of doing this in real
I know this is a rather academic question, but I wonder how one would
I'm currently doing an academic benchmark, TPC-H, and I have some big tables that
This is a bit more of an academic question. Indeed I am preparing for

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.