Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
OS_XV6
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9631059
OS_XV6
Commits
aad062e1
Commit
aad062e1
authored
5 years ago
by
Amir Hosein Kashani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3.4 before add system call
parent
ad0e0b5f
master
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
defs.h
defs.h
+1
-0
proc.c
proc.c
+19
-0
trap.c
trap.c
+1
-1
No files found.
defs.h
View file @
aad062e1
...
...
@@ -120,6 +120,7 @@ void userinit(void);
int
wait
(
void
);
void
wakeup
(
void
*
);
void
yield
(
void
);
void
clockCounter
(
void
);
// swtch.S
void
swtch
(
struct
context
**
,
struct
context
*
);
...
...
This diff is collapsed.
Click to expand it.
proc.c
View file @
aad062e1
...
...
@@ -271,6 +271,7 @@ exit(void)
// Jump into the scheduler, never to return.
curproc
->
state
=
ZOMBIE
;
curproc
->
timeHandeler
.
terminationTime
=
ticks
;
sched
();
panic
(
"zombie exit"
);
}
...
...
@@ -559,3 +560,21 @@ procdump(void)
cprintf
(
"
\n
"
);
}
}
void
clockCounter
(){
struct
proc
*
p
;
acquire
(
&
ptable
.
lock
);
for
(
p
=
ptable
.
proc
;
p
<
&
ptable
.
proc
[
NPROC
];
p
++
){
if
(
p
->
state
==
SLEEPING
){
p
->
timeHandeler
.
sleepingTime
++
;
}
else
if
(
p
->
state
==
RUNNABLE
){
p
->
timeHandeler
.
runningTime
++
;
}
else
if
(
p
->
state
==
RUNNING
){
p
->
timeHandeler
.
runningTime
++
;
}
}
release
(
&
ptable
.
lock
);
}
This diff is collapsed.
Click to expand it.
trap.c
View file @
aad062e1
...
...
@@ -37,7 +37,7 @@ idtinit(void)
void
trap
(
struct
trapframe
*
tf
)
{
clockCounter
();
if
(
tf
->
trapno
==
T_SYSCALL
){
if
(
myproc
()
->
killed
)
exit
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment