27 lines
451 B
C
27 lines
451 B
C
#include "userlib/syscall.h"
|
|
#include "userlib/libnachos.h"
|
|
|
|
void thread1() {
|
|
for(int i = 0; i < 10; i++)
|
|
{
|
|
n_printf("Hello from th1\n");
|
|
}
|
|
}
|
|
|
|
void thread2() {
|
|
for(int i = 0; i < 10; i++)
|
|
{
|
|
n_printf("Hello from th2\n");
|
|
}
|
|
}
|
|
|
|
|
|
int main() {
|
|
ThreadId th1 = threadCreate("thread 1", thread1);
|
|
ThreadId th2 = threadCreate("thread 2", thread2);
|
|
Join(th1);
|
|
Join(th2);
|
|
Shutdown();
|
|
return 0;
|
|
}
|