The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
stf.c
Go to the documentation of this file.
1 
35 #include <arch/thread.h>
36 #include <core/core.h>
37 #include <queues/queues.h>
38 #include <scheduler/scheduler.h>
39 #include <scheduler/process.h>
40 #include <gvt/gvt.h>
41 #include <mm/mm.h>
42 
54 {
55  struct lp_struct *next_lp = NULL;
56  simtime_t evt_time, next_time = INFTY;
57 
58  foreach_bound_lp(lp) {
59  // If waiting for synch, don't take into account the LP
60  if (is_blocked_state(lp->state)) {
61  continue;
62  }
63  // If the LP is in READY_FOR_SYNCH it has to handle the same ECS message
64  if (lp->state == LP_STATE_READY_FOR_SYNCH) {
65  // The LP handles the suspended event as the next event
66  evt_time = lvt(lp);
67  } else {
68  // Compute the next event's timestamp.
69  evt_time = next_event_timestamp(lp);
70  }
71 
72  if (evt_time < next_time && evt_time < INFTY) {
73  next_time = evt_time;
74  next_lp = lp;
75  }
76  }
77 
78  return next_lp;
79 }
#define lvt(lp)
Definition: process.h:168
simtime_t next_event_timestamp(struct lp_struct *lp)
Definition: queues.c:62
Message queueing subsystem.
struct lp_struct * smallest_timestamp_first(void)
O(n) scheduler.
Definition: stf.c:53
Core ROOT-Sim functionalities.
The ROOT-Sim scheduler main module header.
Generic thread management facilities.
#define INFTY
Infinite timestamp: this is the highest timestamp in a simulation run.
Definition: ROOT-Sim.h:58
double simtime_t
This defines the type with whom timestamps are represented.
Definition: ROOT-Sim.h:55
Memory Manager main header.
LP control blocks.
Global Virtual Time.