Exemplo n.º 1
0
/*** Initialize the Run ***/
void
RUN()
{
int  _edge_condition[2];

  /* Attribute Value(s) Passed to this Event */

  /* state changes */
  ECONBASE=1;
  ECONBAG=3;
  ECONTIX=2;
  FCBASE=1;
  FCBAG=2;
  FCTIX=1;
  SERVER[0]=ECONES[0];
  SERVER[1]=FCES[0];
  ECONGS=ECONES[0];
  FCGS=FCES[0];
  TIMEIDX=0;
  PASTOTAL=DISK(DATA.DAT,0);
  PASCOUNT=0;

  /* Evaluate edge conditions now so that they will*/
  /* not be changed by preemptive event execution  */
  _edge_condition[0] = ( 1==1 );
  _edge_condition[1] = ( 1==1 );

  /* schedule future events */
  if (_edge_condition[0])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + 0;
    event_type = ARRIVE_event;
    event_priority = 5;
    schedule_event();
    }

  if (_edge_condition[1])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + 0;
    event_type = SETSRVR_event;
    event_priority = 5;
    schedule_event();
    }

}
Exemplo n.º 2
0
static Device *Devices[DEV_MAX];
static int numDevs;

#define	DEVICE_ENTRY(type, name, descr, max)    { type, name, descr, max }

#define	DISK(name, descr, max)                                          \
	DEVICE_ENTRY(DEVICE_TYPE_DISK, name, descr, max)

static struct _devname {
    DeviceType type;
    char *name;
    char *description;
    int max;
} device_names[] = {
    DISK("da%d",	"SCSI disk device",		16),
    DISK("ad%d",	"ATA/IDE disk device",		16),
    DISK("ar%d",	"ATA/IDE RAID device",		16),
    DISK("afd%d",	"ATAPI/IDE floppy device",	4),
    DISK("mlxd%d",	"Mylex RAID disk",		4),
    DISK("amrd%d",	"AMI MegaRAID drive",		4),
    DISK("idad%d",	"Compaq RAID array",		4),
    DISK("twed%d",	"3ware ATA RAID array",		4),
    DISK("aacd%d",	"Adaptec FSA RAID array",	4),
    DISK("ipsd%d",	"IBM ServeRAID RAID array",	4),
    DISK("mfid%d",	"LSI MegaRAID SAS array",	4),
    { 0, NULL, NULL, 0 },
};

Device *
new_device(char *name)
Exemplo n.º 3
0
/*** Customers Arrive. The are first class customers with certain probability ,PERCFC. They enter the queue and the transient attributes are tracked ***/
void
ARRIVE()
{
int  _edge_condition[4];


  /* state changes */
  R=RND;
  TRACK=(R<PERCFC);
  ENT[0]=DISK(DATA.DAT,0);
  ENT[1]=DISK(DATA.DAT,0);
  ENT[2]=DISK(DATA.DAT,0);
  ENT[3]=DISK(DATA.DAT,0);
  ENT[4]=DISK(DATA.DAT,0);
  QUEUE[TRACK]=QUEUE[TRACK]+PUT(FIF,TRACK);
  PASCOUNT=PASCOUNT+1;

  /* Evaluate edge conditions now so that they will*/
  /* not be changed by preemptive event execution  */
  _edge_condition[0] = ( PASCOUNT<PASTOTAL );
  _edge_condition[1] = ( QUEUE[0]>0&&SERVER[0]>0 );
  _edge_condition[2] = ( QUEUE[1]>0&&SERVER[1]>0 );
  _edge_condition[3] = ( QUEUE[0]==1&&QUEUE[1]==0&&SERVER[0]==0&&SERVER[1]>0 );

  /* schedule future events */
  if (_edge_condition[0])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + ENT[1]-CLK;
    event_type = ARRIVE_event;
    event_priority = 5;
    schedule_event();
    }

  if (_edge_condition[1])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + 0;
    event_type = STEE_event;
    event_priority = 2;
    schedule_event();
    }

  if (_edge_condition[2])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + 0;
    event_type = STFCFC_event;
    event_priority = 1;
    schedule_event();
    }

  if (_edge_condition[3])
    {
    for ( t_index=3; t_index<maxatr; t_index++) transfer[t_index] = 0.0;
    event_time = current_time + 0;
    event_type = STFCE_event;
    event_priority = 3;
    schedule_event();
    }

}