Repository navigation
process: Add global ProcessManager and per process fd_manager - #73
Open
liuchuang-vivo wants to merge 5 commits into
Open
liuchuang-vivo wants to merge 5 commits into
liuchuang-vivo wants to merge 5 commits into
Conversation
liuchuang-vivo
force-pushed
the
dev_process
branch
from
October 14, 2026 07:56
9ad8a57 to
25a5853
Compare
yyang0814
reviewed
Oct 14, 2026
| } | ||
|
|
||
| pub fn destroy_process(&self, pid: Pid) -> Option<Arc<Process>> { | ||
| self.table.remove(pid) |
Contributor
There was a problem hiding this comment.
If the process has child processes, will calling 'destroy_process' cause its child processes to become orphan processes?
Contributor
Author
There was a problem hiding this comment.
Handle orphan processes in the new commits.
yyang0814
reviewed
Oct 14, 2026
| pub struct Process { | ||
| pid: Pid, | ||
| // A weak reference to the parent process. | ||
| parent: Weak<Process>, | ||
| // The threads owned by this process. | ||
| threads: SpinLock<ThreadList>, | ||
| // This process's open-file table. | ||
| #[cfg(enable_vfs)] | ||
| fd_manager: SpinLock<FdManager>, |
Contributor
There was a problem hiding this comment.
The parent->child relationship is not recorded.
Contributor
Author
There was a problem hiding this comment.
Added in the following commits.
yyang0814
reviewed
Oct 14, 2026
|
|
||
| pub fn destroy_process(&self, pid: Pid) -> Option<Arc<Process>> { | ||
| self.table.remove(pid) | ||
| } |
Contributor
There was a problem hiding this comment.
destroy_process does not assert process.has_no_threads() and pid != ROOT_PID before destroy.
Contributor
Author
There was a problem hiding this comment.
Add ROOT_PID check.
Add ProcessState. When there are threads, the process change to zombie and wait for all threads finished. Then destroy the process.
liuchuang-vivo
force-pushed
the
dev_process
branch
from
October 19, 2026 03:02
25a5853 to
3122ae4
Compare
liuchuang-vivo
force-pushed
the
dev_process
branch
3 times, most recently
from
October 21, 2026 09:36
770245f to
ee9b959
Compare
liuchuang-vivo
force-pushed
the
dev_process
branch
from
October 21, 2026 10:02
ee9b959 to
7d0bbe0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A global ProcessManager to hold Arc refcount. And manage things like pid.
Also adapt the boot and create_thread().
Per process fd_manager records the files opened by each process.