diff options
Diffstat (limited to 'dev/zka/src/UserProcessScheduler.cc')
| -rw-r--r-- | dev/zka/src/UserProcessScheduler.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/dev/zka/src/UserProcessScheduler.cc b/dev/zka/src/UserProcessScheduler.cc index bbe644dc..0081367a 100644 --- a/dev/zka/src/UserProcessScheduler.cc +++ b/dev/zka/src/UserProcessScheduler.cc @@ -423,6 +423,12 @@ namespace Kernel SizeT process_index = 0; //! we store this guy to tell the scheduler how many //! things we have scheduled. + if (mTeam.mProcessAmount < 1) + { + kcout << "UserProcessScheduler::Run(): This team doesn't have any process!\r"; + return 0; + } + for (; process_index < mTeam.AsArray().Capacity(); ++process_index) { auto& process = mTeam.AsArray()[process_index]; @@ -430,9 +436,6 @@ namespace Kernel //! check if process needs to be scheduled. if (UserProcessHelper::CanBeScheduled(process)) { - // Set current process header. - this->CurrentProcess() = process; - process.PTime = static_cast<Int32>(process.Affinity); UserProcessScheduler::The().CurrentProcess().Leak().Status = ProcessStatusKind::kFrozen; @@ -440,6 +443,9 @@ namespace Kernel kcout << "Switch to '" << process.Name << "'.\r"; + // Set current process header. + this->CurrentProcess() = process; + // tell helper to find a core to schedule on. if (!UserProcessHelper::Switch(process.Image, &process.StackReserve[process.StackSize - 1], process.StackFrame, process.ProcessId)) @@ -494,6 +500,10 @@ namespace Kernel process.Status == ProcessStatusKind::kDead) return No; + if (process.Status == ProcessStatusKind::kStarting && + process.Image) + return Yes; + if (!process.Image && process.Kind == UserProcess::kExectuableKind) return No; |
