]>
wirehaze git hosting - ppos.git/blob - ppos/test/pingpong-scheduler.c
1 // PingPongOS - PingPong Operating System
2 // Prof. Carlos A. Maziero, DINF UFPR
3 // Versão 2.0 -- Junho de 2025
5 // ATENÇÃO: ESTE ARQUIVO NÃO DEVE SER ALTERADO;
6 // ALTERAÇÕES SERÃO DESCARTADAS NA CORREÇÃO.
8 // Teste do escalonador com prioridades dinâmicas
14 static struct task_t
*pang
, *peng
, *ping
, *pong
, *pung
;
19 printf("%s: inicio (prioridade %d)\n", (char *)arg
, sched_getprio(NULL
));
21 for (int i
= 0; i
< 10; i
++)
23 printf("%s: %d\n", (char *)arg
, i
);
26 printf("%s: fim\n", (char *)arg
);
30 // corpo da tarefa principal
31 void user_main(void *arg
)
33 printf("user: inicio\n");
36 pang
= task_create("pang", body
, "\tPang");
38 peng
= task_create("peng", body
, "\t\tPeng");
40 ping
= task_create("ping", body
, "\t\t\tPing");
42 pong
= task_create("pong", body
, "\t\t\t\tPong");
44 pung
= task_create("pung", body
, "\t\t\t\t\tPung");
48 sched_setprio(pang
, 0);
49 sched_setprio(peng
, 2);
50 sched_setprio(ping
, 4);
51 sched_setprio(pong
, 6);
52 sched_setprio(pung
, 8);
54 printf("user: fim\n");