90 likes | 101 Views
This project explores different ways to remember infection traffic in computer and network performance models, including utilizing individual infected node variables and determining neighboring nodes. The simulation end time is determined based on the absence of future infection traffic. Simulation time is recorded using CPU time.
E N D
CDA6530: Performance Models of Computers and NetworksProject 3 Q&A TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA
m = 300; n =300; • Structure definition in Matlab: • Node=struct('status', zeros(m,n), 'infectTime', zeros(m,n), 'InfectOtherTime', zeros(m,n)); • Or you can define: • NodeState = zeros(m,n); • NodeInfectTime = zeros(m,n); • NodeInfectOtherTime = zeros(m,n);
Multiple Way to Remember Infection Traffic • Define a queue variable to remember: • Generated infection traffic source (or destination) • Active time (when the source passes the traffic to all its neighbors, or when a vulnerble node receives the traffic) • Quite complicated since the event queue is very dynamic
Multiple Way to Remember Infection Traffic (my approach) • Use each infected node variable to remember when its outgoing infection traffic reach its neighbors • NodeInfectOtherTime(i,j) save the time for infection traffic reaching the node(i,j)’s neighbors
How to determine neighboring nodes? • You don’t need the code to remember the topology since it is so regular • Node(a,b)’s 4 neighbors: • Upper node: (a-1,b), Down node: (a+1, b) • Left node: (a,b-1), right node: (a, b+1) • Make sure you check if any of the above 4 nodes are non-exist • For S2, you also need to check if the node is one of those 10 shortcut nodes • If yes, considering the 5th neighboring node
How to decide the simulation end time? • At current discrete time k, check all nodes: • If all (NodeInfectOtherTime(.,.) < k), then stop • It means there does not exist any future infection traffic anymore
Infection Activity from sending node angle • At current time t: • If the NodeState(j,k) == ‘infected’ • If the NodeInfectOtherTime(j,k) == t, %the node infection traffic reach its neighbors now! • Check all its neighbors to see if any neighbor is infected now, if the neighbor node(a, b) is infected now: • NodeState(a,b) = infected; • NodeInfectTime(a,b) = t; • generate Poisson distr. delay time x; • NodeInfectOtherTime(a,b) = x +t +1; • If NodeState(j,k) == ‘vulnerable’ • Do nothing
Two Actions for Every Infected Node • Act 1: when node(a,b) becomes infected at current discrete time t • Change its status: NodeState(a,b) = INFECTED; • Assign: • NodeInfectTime(a,b) = t; • x = PoissonGenerator(); • NodeInfectOtherTime(a,b) = t + x + 1; • Act 2: when an infected node delivers infection traffic to its neighbors • When? if (NodeState(a,b) == INFECTED && t == NodeInfectOtherTime(a,b) ) • Check each of its neighbor: • If neighbor node(c,d) is vulnerable and will be infected? • Run Act 1 for the node(c,d)
Record Your Simulation Time • startTime = cputime; • Run your simulation…. • simulateCPUTime = cputime – startTime;