PKUOS - Pintos
Pintos source browser for PKU Operating System course
page-parallel.c
Go to the documentation of this file.
1/** Runs 4 child-linear processes at once. */
2
3#include <syscall.h>
4#include "tests/lib.h"
5#include "tests/main.h"
6
7#define CHILD_CNT 4
8
9void
11{
12 pid_t children[CHILD_CNT];
13 int i;
14
15 for (i = 0; i < CHILD_CNT; i++)
16 CHECK ((children[i] = exec ("child-linear")) != -1,
17 "exec \"child-linear\"");
18
19 for (i = 0; i < CHILD_CNT; i++)
20 CHECK (wait (children[i]) == 0x42, "wait for child %d", i);
21}
static void wait(struct intq *q, struct thread **waiter)
pid_t exec(const char *file)
Definition: syscall.c:79
int pid_t
Process identifier.
Definition: syscall.h:8
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
Definition: lib.h:29
void test_main(void)
tests/main.h
Definition: page-parallel.c:10
#define CHILD_CNT
Runs 4 child-linear processes at once.
Definition: page-parallel.c:7