Example SPAK code for simulating execution of a task set:
  struct task_set *ts;
  int feas;
  
  max_resp = 1000000;
  ts = create_task_set (18, 10, 500, 0,
  "audsley93_t3", 
  1000, 0, 0, 0,
  "Tindell92_restricted");
  //                       C       T      D  J  B  name
  new_simple_task (ts,  3500, 200000,  5000, 0, 0, "t1");
  new_simple_task (ts,  2000,  25000, 25000, 0, 0, "t2");
  new_simple_task (ts,  5000,  25000, 25000, 0, 0, "t3");
  new_simple_task (ts,  1000,  40000, 40000, 0, 0, "t4");
  new_simple_task (ts,  9000,  50000, 50000, 0, 0, "t5");
  new_simple_task (ts,  5000,  50000, 50000, 0, 0, "t6");
  new_simple_task (ts,  8000,  59000, 59000, 0, 0, "t7");
  new_simple_task (ts, 12000,  80000, 80000, 0, 0, "t8");
  new_simple_task (ts,  2000,  80000, 80000, 0, 0, "t9");
  make_all_preemptible (ts);
  set_priorities (ts, DM);
  feas = feasible (ts, TRUE);
  print_task_set (ts);
  if (feas == num_tasks (ts)) {
    printf ("task set is feasible\n");
  } else {
    printf ("task set is not feasible\n");
  }
  simulate (ts, 100000000, "sim_output.txt", 0.0, NULL, NULL);
Back to the main SPAK page.