Skip to content

Commit

Permalink
Some more scheduler cleanups:
Browse files Browse the repository at this point in the history
  * Split task control msg handling out into its own function for readability
  * Cleanup some comments
  * Move the transaction-start inside the task thread -- this way delayed-start transactions are less likely to get serialization conflict.
  * Add TaskConflictRetry message for tx serialization conflict results, and have the scheduler receive them, though they are still unhandled (panic).  (#13)
  * Move VM creation into the VM host, since *it* knows what kind of VM it needs.
  * Remove some redundant arguments/value-passing.
  * Break task's command handling out of the msg match and into its own function for readability
  • Loading branch information
rdaum committed Oct 8, 2023
1 parent f311a3c commit 4e7f53e
Show file tree
Hide file tree
Showing 5 changed files with 404 additions and 433 deletions.
12 changes: 2 additions & 10 deletions crates/kernel/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub mod vm_test_utils {
use crate::tasks::vm_host::{VMHost, VMHostResponse};
use crate::tasks::VerbCall;
use crate::vm::vm_execute::VmExecParams;
use crate::vm::VM;
use moor_values::model::world_state::WorldState;
use moor_values::var::Var;
use moor_values::SYSTEM_OBJECT;
Expand All @@ -43,16 +42,9 @@ pub mod vm_test_utils {
verb_name: &str,
args: Vec<Var>,
) -> Var {
let vm = VM::new();
let (scs_tx, _scs_rx) = tokio::sync::mpsc::unbounded_channel();
let mut vm_host = MooVmHost::new(
vm,
20,
90_000,
Duration::from_secs(5),
session.clone(),
scs_tx,
);
let mut vm_host =
MooVmHost::new(20, 90_000, Duration::from_secs(5), session.clone(), scs_tx);

let (sched_send, _) = tokio::sync::mpsc::unbounded_channel();
let _vm_exec_params = VmExecParams {
Expand Down
2 changes: 1 addition & 1 deletion crates/kernel/src/tasks/moo_vm_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ pub struct MooVmHost {

impl MooVmHost {
pub fn new(
vm: VM,
max_stack_depth: usize,
max_ticks: usize,
max_time: Duration,
sessions: Arc<dyn Session>,
scheduler_control_sender: UnboundedSender<(TaskId, SchedulerControlMsg)>,
) -> Self {
let vm = VM::new();
// Created in an initial suspended state.
Self {
vm,
Expand Down
Loading

0 comments on commit 4e7f53e

Please sign in to comment.