summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-03 10:03:55 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-08-03 10:03:55 +0100
commit9c07b4640a226f8070d4de0f8cd8f119d7754aa8 (patch)
tree4c15cf5f4130967e7e0a520d86418dd76d919250 /docs
parent01a31ff876b0b33eec412a2cc5778aad7af7c334 (diff)
feat: update papers.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'docs')
-rw-r--r--docs/tex/binary_mutex.tex16
-rw-r--r--docs/tex/coreprocessscheduler.tex139
-rw-r--r--docs/tex/cps_arch.tex81
3 files changed, 146 insertions, 90 deletions
diff --git a/docs/tex/binary_mutex.tex b/docs/tex/binary_mutex.tex
index 5902cefc..4e61eb65 100644
--- a/docs/tex/binary_mutex.tex
+++ b/docs/tex/binary_mutex.tex
@@ -1,7 +1,7 @@
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
-\title{The BinaryMutex Pattern}
+\title{BinaryMutex}
\author{Amlal El Mahrouss}
\date{\today}
@@ -9,15 +9,11 @@
\maketitle
-\section{Context}
+\section{Abstract}
-The BinaryMutex is a core component of NeKernel (NeKernel/VMKernel) based systems.
+{The BinaryMutex is a core component of NeKernel (NeKernel/VMKernel) based systems. The pattern excludes other acquirers to own the USER\_PROCESS that is currently being hold. Thus the acquiree is the USER\_PROCESS itself}
-The pattern excludes other acquirers to own the USER\_PROCESS that is currently being hold.
-
-Thus the acquiree is the USER\_PROCESS itself
-
-\section{Use Cases}
+\section{Use Case \#1: Process lock for atomic data retrival}
\begin{verbatim}
BinaryMutex mux;
@@ -26,7 +22,9 @@ mux.Lock(process);
// Say we want to interact with the process itself on this thread,
we can then make sure that no race condition happens by using:
constexpr auto kSecondsMax = 5;
-mux.WaitForProcess(kSecondsMax);
+mux.WaitForProcess(kSecondsMax);
+
+process.DoFoo();
\end{verbatim}
\section{Implementation}
diff --git a/docs/tex/coreprocessscheduler.tex b/docs/tex/coreprocessscheduler.tex
new file mode 100644
index 00000000..60f2b8cd
--- /dev/null
+++ b/docs/tex/coreprocessscheduler.tex
@@ -0,0 +1,139 @@
+\documentclass{article}
+\usepackage{graphicx} % Required for inserting images
+\usepackage{hyperref}
+
+\title{CoreProcessScheduler}
+\author{Amlal El Mahrouss}
+\date{\today}
+
+\begin{document}
+
+\maketitle
+
+\section{Abstract}
+
+{The CoreProcessScheduler governs how the scheduling backend and policy of the kernel works, It is the common gateway for schedulers inside NeKernel based systems.}
+
+\section{Overview}
+
+{The CoreProcessScheduler (now referred as CPS) serves as the intermediate foundal between the scheduler backend and kernel.} {It takes care of process life-cycle management, team-based process grouping, and affinity-based CPU based allocation to mention the least.}
+
+\section{The Affinity System}
+
+{Processes are given CPU time affinity hints using an affinity kind type, these hints help the scheduler run or adjust the current process.}
+
+\subsection{Sample Code \#1}
+
+{The following sample is C++ code.} {The smaller the value, the more critical the process.}
+
+\begin{verbatim}
+enum class AffinityKind : Int32 {
+ kRealTime = 100,
+ kVeryHigh = 150,
+ kHigh = 200,
+ kStandard = 1000,
+ kLowUsage = 1500,
+ kVeryLowUsage = 2000,
+};
+\end{verbatim}
+
+\section{The Team System}
+
+{The team system holds process metadata for the backend scheduler to run on. It holds methods and fields for backend specific operations.} {One implementation of such team is the UserProcessTeam object inside NeKernel.}
+
+\subsection{Sample Code \#2}
+
+{The following sample is used to hold team metadata.} {This is part of the NeKernel source tree.}
+
+\begin{verbatim}
+class UserProcessTeam final {
+ public:
+ explicit UserProcessTeam();
+ ~UserProcessTeam() = default;
+
+ NE_COPY_DEFAULT(UserProcessTeam)
+
+ Array<USER_PROCESS, kSchedProcessLimitPerTeam>& AsArray();
+ Ref<USER_PROCESS>& AsRef();
+ ProcessID& Id() noexcept;
+
+ public:
+ USER_PROCESS_ARRAY mProcessList;
+ USER_PROCESS_REF mCurrentProcess;
+ ProcessID mTeamId{0};
+ ProcessID mProcessCur{0};
+};
+
+\end{verbatim}
+
+\section{The Process Image System}
+
+{The process image container is a design pattern made to contain process data and metadata, its purpose comes from the lack of mainstream operating systems of such ability to hold metadata.}
+
+\newline{}
+
+{This approach helps separate concerns and give modularity to the system, as the image and process structure are not mixed together.}
+
+\subsection{Sample Code \#3}
+
+{The following sample is a C++ container used to hold process data and metadata.} {This is part of the NeKernel source tree.}
+
+\begin{verbatim}
+struct PROCESS_IMAGE final {
+ explicit PROCESS_IMAGE() = default;
+
+ private:
+ friend USER_PROCESS;
+ friend KERNEL_TASK;
+
+ friend class UserProcessScheduler;
+
+ ImagePtr fCode;
+ ImagePtr fBlob;
+
+ public:
+ Bool HasCode() const { return this->fCode != nullptr; }
+
+ Bool HasImage() const { return this->fBlob != nullptr; }
+
+ ErrorOr<ImagePtr> LeakImage() {
+ if (this->fCode) {
+ return ErrorOr<ImagePtr>{this->fCode};
+ }
+
+ return ErrorOr<ImagePtr>{kErrorInvalidData};
+ }
+
+ ErrorOr<ImagePtr> LeakBlob() {
+ if (this->fBlob) {
+ return ErrorOr<ImagePtr>{this->fBlob};
+ }
+
+ return ErrorOr<ImagePtr>{kErrorInvalidData};
+ }
+};
+
+\end{verbatim}
+
+\section{Conclusion}
+
+{The CoreProcessScheduler is a piece of systems design with robust design and useful cases, although useful in desktop/server cases, It may not be suited for every other tasks.}
+
+{And while one scheduler backend (such as the UserProcessScheduler) takes care of user process scheduling and fairness, the CoreProcessScheduler takes care of the foundation for those systems.}
+
+\section{References}
+
+{Here are the reference material on this paper:}
+
+{NeKernel}: \href{https://github.com/nekernel-org/nekernel}{NeKernel}
+
+{CoreProcessScheduler}: \href{https://github.com/nekernel-org/nekernel/blob/dev/dev/kernel/KernelKit/CoreProcessScheduler.h}{CoreProcessScheduler}
+
+\section{Hyperlinks}
+
+{NeKernel.org}: \href{https://nekernel.org}{NeKernel.org}
+\newline
+\newline
+{SNU Systems}: \href{https://snu.systems}{SNU.Systems}
+
+\end{document}
diff --git a/docs/tex/cps_arch.tex b/docs/tex/cps_arch.tex
deleted file mode 100644
index 328a0f1b..00000000
--- a/docs/tex/cps_arch.tex
+++ /dev/null
@@ -1,81 +0,0 @@
-\documentclass{article}
-\usepackage{graphicx} % Required for inserting images
-\usepackage{hyperref}
-
-\title{The CoreProcessScheduler (CPS) architecture}
-\author{Amlal El Mahrouss}
-\date{\today}
-
-\begin{document}
-
-\maketitle
-
-\section{Introduction}
-
-{The CoreProcessScheduler is a concept of NeKernel based systems governs how the scheduling backend, and policy of the kernel works, it is the common gateway for schedulers inside NeKernel.}
-
-\section{Overview}
-
-{The CoreProcessScheduler (now referred as CPS) serves as the intermediate foundal between the scheduler backend and kernel.} {It takes care of process life-cycle management, team-based process grouping, and affinity-based CPU based allocation to mention the least.}
-
-\section{The Affinity System}
-
-{Processes are given CPU time affinity hints using an affinity kind type, these hints help the scheduler run or adjust the current process.}
-
-\subsection{Sample Code}
-
-{The following sample is C++ code.} {The smaller the value, the more critical the process.}
-
-\begin{verbatim}
-enum class AffinityKind : Int32 {
- kRealTime = 100,
- kVeryHigh = 150,
- kHigh = 200,
- kStandard = 1000,
- kLowUsage = 1500,
- kVeryLowUsage = 2000,
-};
-\end{verbatim}
-
-\section{The Team System}
-
-{The team container has process metadata for the backend to run on. It holds methods and fields for backend specific operations.} {One implementation of such team is the UserProcessTeam object inside NeKernel.}
-
-\subsection{Sample Code}
-
-{The following sample is C++ code.} {This is the UserProcessTeam from NeKernel}
-
-\begin{verbatim}
-class UserProcessTeam final {
- public:
- explicit UserProcessTeam();
- ~UserProcessTeam() = default;
-
- NE_COPY_DEFAULT(UserProcessTeam)
-
- Array<USER_PROCESS, kSchedProcessLimitPerTeam>& AsArray();
- Ref<USER_PROCESS>& AsRef();
- ProcessID& Id() noexcept;
-
- public:
- USER_PROCESS_ARRAY mProcessList;
- USER_PROCESS_REF mCurrentProcess;
- ProcessID mTeamId{0};
- ProcessID mProcessCur{0};
-};
-
-\end{verbatim}
-
-\section{Conclusion}
-
-{Meanwhile the scheduler backend (such as the UserProcessScheduler) takes care of user process scheduling and fairness, the CPS architecture itself is the foundation for those systems (such as KernelTaskScheduler, or HardwareThreadScheduler)}
-
-\section{Links}
-
-{NeKernel.org}: \href{https://nekernel.org}{NeKernel.org}
-\newline
-{NeKernel}: \href{https://github.com/nekernel-org/nekernel}{NeKernel}
-\newline
-{SNU Systems}: \href{https://snu.systems}{SNU.Systems}
-
-\end{document}