Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement loader interface and waiting on process #488

Merged
merged 16 commits into from
Sep 25, 2019

Conversation

roblabla
Copy link
Member

  • Loader now has an interface to spawn new processes at runtime.
  • We can also add Loader to wait until a process is killed.

@todo
Copy link

todo bot commented Sep 22, 2019

Use a better lock around thread_maternity.

Thread maternity currently uses a SpinLock. We should ideally use a scheduling mutex there.


// TODO: Use a better lock around thread_maternity.
// BODY: Thread maternity currently uses a SpinLock. We should ideally use a
// BODY: scheduling mutex there.
thread_maternity: Vec<Arc<ThreadStruct>>,
}
impl ProcessStateData {
/// Sets the state to the given new state, and signal the process, causing
/// any threads waiting on the process to get woken up.
fn set_state(&mut self, newstate: ProcessState) {
self.state = newstate;


This comment was generated by todo based on a TODO comment in 898433c in #488. cc @roblabla.

@todo
Copy link

todo bot commented Sep 22, 2019

Unify Handle/HandleRef behind a single trait.

The fact I have to do this makes me think there's really a problem in the handle/handleref design. Maybe there should be a trait unifying Handle/HandleRef, and `Process` and co should be generic on those? That would allow me to call the functions on "borrowed lifetime-erased" handles.
This trait could probably be AsRef or Borrow. Ideally the generic types would be an internal implementation details and we'd just expose "Process" and "ProcessBorrowed" types through typedef/newtypes. Needs a lot of thought.


// TODO: Unify Handle/HandleRef behind a single trait.
// BODY: The fact I have to do this makes me think there's really a
// BODY: problem in the handle/handleref design. Maybe there should be a
// BODY: trait unifying Handle/HandleRef, and `Process` and co should be
// BODY: generic on those? That would allow me to call the functions on
// BODY: "borrowed lifetime-erased" handles.
// BODY:
// BODY: This trait could probably be AsRef or Borrow. Ideally the
// BODY: generic types would be an internal implementation details
// BODY: and we'd just expose "Process" and "ProcessBorrowed" types
// BODY: through typedef/newtypes. Needs a lot of thought.


This comment was generated by todo based on a TODO comment in 898433c in #488. cc @roblabla.

@todo
Copy link

todo bot commented Sep 22, 2019

Return exit state.

// TODO: Return exit state.
return Ok(0);
}
}
}))
}
}
fn main() {
let fs = &*BOOT_FROM_FS;


This comment was generated by todo based on a TODO comment in 898433c in #488. cc @roblabla.

Copy link
Member

@marysaka marysaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This commit prepares for the signaling system of Processes. It moves
various variables that should be changed as a single atomic unit under
a single mutex. It also moves the ProcessState to libkern, since it will
become user-visible in a future commit.
Avoid deadlocks in Process::start due to the process's state being relocked
in Thread::start.
Process is now allowed in wait_synchronization. It gets signaled when
its ProcessState changes. The signaled state can be reset with
the reset_signal syscall.
Waits until the given pid has exited. launch_title now returns the pid.

Shell will now wait until the subprocess has waited before prompting.
@marysaka marysaka merged commit 16c2558 into sunriseos:master Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants