Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Vinnakota
CSEP551
Commits
18432ed5
Commit
18432ed5
authored
18 years ago
by
rtm
Browse files
Options
Downloads
Patches
Plain Diff
nits
parent
7a37578e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Notes
+2
-2
2 additions, 2 deletions
Notes
proc.c
+5
-9
5 additions, 9 deletions
proc.c
proc.h
+3
-4
3 additions, 4 deletions
proc.h
with
10 additions
and
15 deletions
Notes
+
2
−
2
View file @
18432ed5
...
...
@@ -101,7 +101,6 @@ test: one process unlinks a file while another links to it
test: one process opens a file while another deletes it
test: deadlock d/.. vs ../d, two processes.
test: dup() shared fd->off
test: sbrk
test: does echo foo > x truncate x?
sh: support pipes? leave it for the class?
...
...
@@ -119,4 +118,5 @@ echo foo > bar should truncate bar
but O_TRUNC should
make it work on one cpu
make it work on amsterdam
make it work on a real machine
release before acquire at end of sleep?
This diff is collapsed.
Click to expand it.
proc.c
+
5
−
9
View file @
18432ed5
...
...
@@ -38,8 +38,6 @@ setupsegs(struct proc *p)
c
->
ts
.
esp0
=
0xffffffff
;
}
// XXX it may be wrong to modify the current segment table!
c
->
gdt
[
0
]
=
SEG_NULL
;
c
->
gdt
[
SEG_KCODE
]
=
SEG
(
STA_X
|
STA_R
,
0
,
0x100000
+
64
*
1024
,
0
);
// xxx
c
->
gdt
[
SEG_KDATA
]
=
SEG
(
STA_W
,
0
,
0xffffffff
,
0
);
...
...
@@ -96,7 +94,7 @@ copyproc(struct proc* p)
np
->
ppid
=
p
->
pid
;
release
(
&
proc_table_lock
);
// Copy
process image
memory.
// Copy
user
memory.
np
->
sz
=
p
->
sz
;
np
->
mem
=
kalloc
(
np
->
sz
);
if
(
np
->
mem
==
0
){
...
...
@@ -214,18 +212,16 @@ sched(void)
void
yield
(
void
)
{
struct
proc
*
p
;
struct
proc
*
p
=
curproc
[
cpu
()]
;
if
((
p
=
curproc
[
cpu
()])
==
0
||
curproc
[
cpu
()]
->
state
!=
RUNNING
)
panic
(
"yield"
);
acquire
(
&
proc_table_lock
);
p
->
state
=
RUNNABLE
;
sched
();
release
(
&
proc_table_lock
);
}
// A
process
's very first scheduling by scheduler()
// will longjmp here
to do the first jump in
to user space.
// A
fork child
's very first scheduling by scheduler()
// will longjmp here
. "return"
to user space.
void
forkret
(
void
)
{
...
...
@@ -371,7 +367,7 @@ proc_wait(void)
acquire
(
&
proc_table_lock
);
for
(;;){
// Scan through table looking zombie children.
// Scan through table looking
for
zombie children.
havekids
=
0
;
for
(
i
=
0
;
i
<
NPROC
;
i
++
){
p
=
&
proc
[
i
];
...
...
This diff is collapsed.
Click to expand it.
proc.h
+
3
−
4
View file @
18432ed5
...
...
@@ -36,9 +36,9 @@ struct jmpbuf {
enum
proc_state
{
UNUSED
,
EMBRYO
,
SLEEPING
,
RUNNABLE
,
RUNNING
,
ZOMBIE
};
struct
proc
{
char
*
mem
;
// start of process's
physical memory
uint
sz
;
// total size of mem, including kernel stack
char
*
kstack
;
// kernel stack
, separate from mem so it doesn't move
char
*
mem
;
// start of process's
memory (a kernel address)
uint
sz
;
// user memory size
char
*
kstack
;
// kernel stack
enum
proc_state
state
;
int
pid
;
int
ppid
;
...
...
@@ -52,7 +52,6 @@ struct proc{
extern
struct
proc
proc
[];
extern
struct
proc
*
curproc
[
NCPU
];
// can be NULL if no proc running.
// XXX move curproc into cpu structure?
#define MPSTACK 512
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment