]>
wirehaze git hosting - ppos.git/blob - ppos/test/pingpong-contab.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 da contabilização com tarefas de prioridades iguais
14 #define WORKLOAD 40000
16 static struct task_t
*pang
, *peng
, *ping
, *pong
, *pung
;
18 // simula um processamento pesado
23 for (int i
= 0; i
< n
; i
++)
24 for (int j
= 0; j
< n
; j
++)
32 printf("%5d ms: %s inicia\n", systime(), (char *)arg
);
34 printf("%5d ms: %s termina\n", systime(), (char *)arg
);
38 // corpo da tarefa principal
39 void user_main(void *arg
)
41 printf("user: inicio\n");
44 pang
= task_create("pang", body
, "\tPang");
46 peng
= task_create("peng", body
, "\t\tPeng");
48 ping
= task_create("ping", body
, "\t\t\tPing");
50 pong
= task_create("pong", body
, "\t\t\t\tPong");
52 pung
= task_create("pung", body
, "\t\t\t\t\tPung");
55 printf("user: fim\n");