-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update syscall settickets, getpinfo; add a test program
- Loading branch information
1 parent
cf26159
commit c956041
Showing
6 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"files.associations": { | ||
"types.h": "c", | ||
"param.h": "c" | ||
"param.h": "c", | ||
"traps.h": "c", | ||
"defs.h": "c", | ||
"user.h": "c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "types.h" | ||
#include "user.h" | ||
|
||
int main() | ||
{ | ||
int pid1, pid2, pid3; | ||
printf(1, "Run 1 CPU to get best results\n"); | ||
printf(1, "Get ticks status via Ctrl+P(procdump())\n"); | ||
if ((pid1 = fork()) > 0) { | ||
if ((pid2 = fork()) > 0) { | ||
if ((pid3 = fork()) > 0) { | ||
struct pstat p; | ||
getpinfo(&p); | ||
for (int i = 0; i < NPROC; i++) { | ||
if (p.inuse[i]) { | ||
printf(1, "%d %d %d\n", p.tickets[i], p.pid[i], p.ticks[i]); | ||
} | ||
} | ||
exit(); | ||
} else if (pid3 == 0) { | ||
settickets(10); | ||
printf(1, "child3\n"); | ||
while (1) { | ||
} | ||
exit(); | ||
} | ||
} else if (pid2 == 0) { | ||
settickets(20); | ||
printf(1, "child2\n"); | ||
while (1) { | ||
} | ||
exit(); | ||
} | ||
} else if (pid1 == 0) { | ||
settickets(30); | ||
printf(1, "child1\n"); | ||
while (1) { | ||
} | ||
exit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ SYSCALL(sbrk) | |
SYSCALL(sleep) | ||
SYSCALL(uptime) | ||
SYSCALL(getreadcount) | ||
SYSCALL(settickets) | ||
SYSCALL(getpinfo) |