Implement deferred ready thread insertion
This commit is contained in:
@@ -55,6 +55,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/ke/kthread.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/kthread.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/kubsan.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/kubsan.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/runlevel.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/runlevel.cc
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/ke/schedule.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/semphore.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/semphore.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/shdata.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/shdata.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/ke/spinlock.cc
|
${XTOSKRNL_SOURCE_DIR}/ke/spinlock.cc
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <ke/kubsan.hh>
|
#include <ke/kubsan.hh>
|
||||||
#include <ke/proc.hh>
|
#include <ke/proc.hh>
|
||||||
#include <ke/runlevel.hh>
|
#include <ke/runlevel.hh>
|
||||||
|
#include <ke/schedule.hh>
|
||||||
#include <ke/semphore.hh>
|
#include <ke/semphore.hh>
|
||||||
#include <ke/shdata.hh>
|
#include <ke/shdata.hh>
|
||||||
#include <ke/spinlock.hh>
|
#include <ke/spinlock.hh>
|
||||||
|
|||||||
25
xtoskrnl/includes/ke/schedule.hh
Normal file
25
xtoskrnl/includes/ke/schedule.hh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/includes/ke/schedule.hh
|
||||||
|
* DESCRIPTION: XT Kernel Thread Scheduler
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTOSKRNL_KE_SCHEDULE_HH
|
||||||
|
#define __XTOSKRNL_KE_SCHEDULE_HH
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* Kernel Library */
|
||||||
|
namespace KE
|
||||||
|
{
|
||||||
|
class Scheduler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTFASTCALL VOID InsertDeferredReadyList(IN PKTHREAD Thread);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __XTOSKRNL_KE_SCHEDULE_HH */
|
||||||
37
xtoskrnl/ke/schedule.cc
Normal file
37
xtoskrnl/ke/schedule.cc
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/ke/schedule.cc
|
||||||
|
* DESCRIPTION: XT Kernel Thread Scheduler
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts a thread into the current processor's deferred ready list.
|
||||||
|
*
|
||||||
|
* @param Thread
|
||||||
|
* Supplies a pointer to the thread being deferred.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
KE::Scheduler::InsertDeferredReadyList(IN PKTHREAD Thread)
|
||||||
|
{
|
||||||
|
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
||||||
|
|
||||||
|
/* Retrieve the Processor Control Block (PRCB) for the executing core */
|
||||||
|
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
||||||
|
|
||||||
|
/* Tag the thread with the current CPU and update its scheduling state */
|
||||||
|
Thread->DeferredProcessor = Prcb->CpuNumber;
|
||||||
|
Thread->State = DeferredReady;
|
||||||
|
|
||||||
|
/* Insert the thread into the deferred ready list */
|
||||||
|
RTL::LifoQueue::PushEntryList(&Prcb->DeferredReadyListHead, &Thread->SwapListEntry);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user