Beispiel #1
0
int main(){
  // here we get 2 contexts for foo with bg=0 and bg=1:
  // foo(0); bg = 1; foo(0);
  RETURN_CODE_TYPE r;
  PROCESS_ID_TYPE pi1, pi2;
  SEMAPHORE_ID_TYPE sem_id_local;
  PROCESS_ATTRIBUTE_TYPE p1, p2;
  LAP_Se_CreateSemaphore("my_mutex",1,1,0,&sem_id_local,&r);
  LAP_Se_GetSemaphoreId("my_mutex",&sem_id,&r);
  F59(p1.NAME, (T1 *)"proc1");
  /*p1.NAME = "proc1";*/
  p1.ENTRY_POINT = (void *) &P1;
  p1.BASE_PRIORITY = 10;
  p1.PERIOD = 600;
  p1.TIME_CAPACITY = 600;
  p2.NAME = "proc2";
  p2.ENTRY_POINT = (void *) &P2;
  p2.BASE_PRIORITY = 10;
  p2.PERIOD = 600;
  p2.TIME_CAPACITY = 600;
  LAP_Se_CreateProcess(&p1,&pi1,&r);
  LAP_Se_CreateProcess(&p2,&pi2,&r);
  LAP_Se_Start(pi1,&r);
  LAP_Se_Start(pi2,&r);
  LAP_Se_SetPartitionMode(NORMAL,&r);
  while(1) {
    g2 = g2 - 1;  // RACE!
  }
  return 0;
}
Beispiel #2
0
int main(){
 RETURN_CODE_TYPE r;
 PROCESS_ID_TYPE pi1,pi2;
 PROCESS_ATTRIBUTE_TYPE p1,p2;
 p1.ENTRY_POINT = (void *) &P1;
 p1.BASE_PRIORITY = 10;
 LAP_Se_CreateProcess(&p1,&pi1,&r);
 LAP_Se_Start(pi1,&r);
 LAP_Se_SetPartitionMode(NORMAL,&r);
 return 0;
}
Beispiel #3
0
int main(){
  RETURN_CODE_TYPE r;
  PROCESS_ID_TYPE pi1, pi2;
  SEMAPHORE_ID_TYPE sem_id_local;
  PROCESS_ATTRIBUTE_TYPE p1, p2;
  LAP_Se_CreateSemaphore("my_mutex",1,1,0,&sem_id_local,&r);
  LAP_Se_GetSemaphoreId("my_mutex",&sem_id,&r);
  p1.NAME = "proc1";
  p1.ENTRY_POINT = (void *) &P1;
  p1.BASE_PRIORITY = 10;
  p1.PERIOD = 600;
  p1.TIME_CAPACITY = 600;
  p2.NAME = "proc2";
  p2.ENTRY_POINT = (void *) &P2;
  p2.BASE_PRIORITY = 20;
  p2.PERIOD = 600;
  p2.TIME_CAPACITY = 600;
  LAP_Se_CreateProcess(&p1,&pi1,&r);
  LAP_Se_CreateProcess(&p2,&pi2,&r);
  LAP_Se_Start(pi1,&r);
  LAP_Se_Start(pi2,&r);
  LAP_Se_SetPartitionMode(NORMAL,&r);
  return 0;
}