Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

help regarding java code for x-y routing algorithm  RSS feed

shiv sharma
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everbody i am not able to solve this particular problem.I want to write a code for this in java:

(i) Write a simulator in java for a 10 X 10mesh structure. The simulator includes three major data structure: Message, channel and switch. Each Message contains a pair of integers for source and a pair of integers for destination. Each Channel contains a single message buffer. A Switch is constructed with a pair of integers for its label and four pairs of input and output channels.

Each Switch is simulated by a thread that implements an X-Y routing algorithm. It repeatedly checks its input channels, store and forward incoming messages to appropriate outgoing channels.

Assume Switch (0,0) is sending out different messages to randomly selected destinations. When a message arrives its destination, it is removed by the destination switch.

Write a test program that inputs the number of messages K that are to be sent by switch (0,0). On receiving a message each switch needs to print out the following information in a line:

SwitchID, MessageID, Message Destination, Message Incoming Channel, Outgoing Channel.

If the message is not supposed to go through the current switch according to your routing algorithm, then print an error message.

(ii) Simulate each switch by a group of threads: one thread to take messages from each incoming channel and put them in a central pool and a main thread implements the routing algorithm. Assume the message pool is of size 4. You need to design a test case to show the benefit of multithread switches in comparison with single-thread switches.

->>can anybody give me a java code for x-y routing algorithm.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!