diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-06 11:25:13 -0500 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-06 11:27:24 -0500 |
| commit | bbccd217b5e9ad1dec7664f7ae058d179768c9e0 (patch) | |
| tree | 4435d2bda44ecb1eabec38fc89da20ac3bbfc7d5 | |
| parent | 039eac88ef5b08cfc57c58292aed030ab442d0f4 (diff) | |
chore: new version of papers WG01 and WG02.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | CITATION.cff | 2 | ||||
| -rw-r--r-- | draft/wg01/wg01.tex (renamed from draft/wg01/cpp_kernel_dev.tex) | 60 | ||||
| -rw-r--r-- | draft/wg02/wg02.tex (renamed from draft/wg02/cpp_cps.tex) | 62 |
3 files changed, 95 insertions, 29 deletions
diff --git a/CITATION.cff b/CITATION.cff index 6d91165..f6cf25f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ cff-version: 1.2.0 -title: NeKernel WG Papers. (Kernel C++) +title: NeKernel WG Papers. (Kernel C++, and CPS.) message: The NeKernel WG Papers. type: software authors: diff --git a/draft/wg01/cpp_kernel_dev.tex b/draft/wg01/wg01.tex index 71afb7d..f116cb8 100644 --- a/draft/wg01/cpp_kernel_dev.tex +++ b/draft/wg01/wg01.tex @@ -1,15 +1,44 @@ -\documentclass{article} +% AUTHOR: Amlal El Mahrouss +% PURPOSE: WG01: Kernel C++ + +\documentclass[11pt, a4paper]{article} \usepackage{graphicx} \usepackage{listings} +\usepackage{xcolor} +\usepackage{hyperref} -\lstset { % - language=C++ -} +\definecolor{codegray}{gray}{0.95} +\definecolor{codeblue}{rgb}{0.1,0.1,0.8} +\definecolor{codegreen}{rgb}{0,0.6,0} +\definecolor{codepurple}{rgb}{0.58,0,0.82} -\title{WG01: C++ for Kernel Development} +\title{WG01: Kernel C++} \author{Amlal El Mahrouss\\NeKernel.org} \date{\today} +\lstset{ + language=C++, + backgroundcolor=\color{codegray}, + basicstyle=\footnotesize\ttfamily, + keywordstyle=\color{codeblue}\bfseries, + commentstyle=\color{codegreen}, + stringstyle=\color{codepurple}, + numbers=left, + numberstyle=\tiny\color{gray}, + stepnumber=1, + numbersep=5pt, + breaklines=true, + breakatwhitespace=false, + frame=single, + rulecolor=\color{black}, + captionpos=b, + keepspaces=true, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2 +} + \begin{document} \maketitle @@ -31,7 +60,7 @@ A C++ Kernel may instead make use of compile-time features of C++ alongside a ti \subsection{Part Two: Constexpr and Friends} { -One may avoid v-tables and runtime dependent features as much as possible. \\ +\textit{One may avoid V-tables or runtime dependent features when possible.} While focusing instead on meta-programming and compile-time features offered by C++. For example one may use templates to implement a scheduling policy algorithm. \\ One example of such implementation may be: \\ @@ -59,8 +88,7 @@ struct MemoryTree final { }; \end{lstlisting} -As you can see these two structures -leverages the `constexpr' keyword to make sure +As you see, two structures leverages the `constexpr' keyword to make sure no bugs or panic occur at runtime because of a misuse of a system resource. \\ Which is why the constexpr keyword is very powerful here, we avoid the many pitfalls of writing (and hoping) that the C version will be well-thought enough so that we can catch such bugs later. @@ -79,9 +107,11 @@ The following example shows how powerful C++ can be when combining it with Devic /// @brief This concept requires the driver /// to be IDriverBase compliant. +constexpr auto kInvalidType = 0; + template <typename T> concept IsValidDriver = requires(T a) { - { a.IsActive() && a.Type() > 0 }; + { a.IsActive() && a.Type() > kInvalidType }; }; /// @brief Consteval helper to detect @@ -128,7 +158,7 @@ int main() { } \end{lstlisting} -\subsection{Addressing V-Tables in a C++ Kernel.} +\section{Addressing V-Tables in a C++ Kernel.} Now the problem with kernel development is that we want to avoid such feature as much as possible, and we'd do that by following the Prong on Inheritance: @@ -145,20 +175,20 @@ Consider the following questions: When 2/3 of those questions fail, you should consider finding another solution to your problem, as it surely has an equivalent without V-Tables. -\section{Final Words and Conclusion} +\section{Conclusion} { We can now conclude that C++ in Kernel Development is indeed possible under strict conditions of C++ Development. \\ Breaking those conditions would lead to system quirks and instability. A reference implementation of this paper exists, It's called NeKernel.org, available under the same internet address. \\ -I am looking forward to any questions or inquiries at: amlal@nekernel.org \\\\Yours truly, \\ -Amlal El Mahrouss +I am looking forward to any questions or inquiries at: amlal@nekernel.org. } \section{References} { \begin{itemize} - \item[EKA2:] https://en.wikipedia.org/wiki/EKA2 - \item[NeKernel.org:] https://nekernel.org + \item[EKA2:] \href{https://en.wikipedia.org/wiki/EKA2}{Link} + \item[NeKernel.org:] \href{https://nekernel.org}{Link} + \item[Virtual Method Tables:] \href{https://en.wikipedia.org/wiki/Virtual_method_table}{Link} \end{itemize} } diff --git a/draft/wg02/cpp_cps.tex b/draft/wg02/wg02.tex index ad55331..b34f233 100644 --- a/draft/wg02/cpp_cps.tex +++ b/draft/wg02/wg02.tex @@ -1,11 +1,44 @@ -\documentclass{article} +% AUTHOR: Amlal El Mahrouss +% PURPOSE: WG02: CoreProcessScheduler + +\documentclass[11pt, a4paper]{article} \usepackage{graphicx} +\usepackage{listings} +\usepackage{xcolor} \usepackage{hyperref} \title{WG02: The CoreProcessScheduler} \author{Amlal El Mahrouss\\NeKernel.org} \date{\today} +\definecolor{codegray}{gray}{0.95} +\definecolor{codeblue}{rgb}{0.1,0.1,0.8} +\definecolor{codegreen}{rgb}{0,0.6,0} +\definecolor{codepurple}{rgb}{0.58,0,0.82} + +\lstset{ + language=C++, + backgroundcolor=\color{codegray}, + basicstyle=\footnotesize\ttfamily, + keywordstyle=\color{codeblue}\bfseries, + commentstyle=\color{codegreen}, + stringstyle=\color{codepurple}, + numbers=left, + numberstyle=\tiny\color{gray}, + stepnumber=1, + numbersep=5pt, + breaklines=true, + breakatwhitespace=false, + frame=single, + rulecolor=\color{black}, + captionpos=b, + keepspaces=true, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2 +} + \begin{document} \maketitle @@ -16,7 +49,7 @@ \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.} +{The CoreProcessScheduler (now referred as CPS) serves as the foundation 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} @@ -26,7 +59,7 @@ {The following sample is C++ code.} {The smaller the value, the more critical the process.} -\begin{verbatim} +\begin{lstlisting} enum class AffinityKind : Int32 { kRealTime = 100, kVeryHigh = 150, @@ -35,7 +68,7 @@ enum class AffinityKind : Int32 { kLowUsage = 1500, kVeryLowUsage = 2000, }; -\end{verbatim} +\end{lstlisting} \section{The Team System} @@ -45,7 +78,7 @@ enum class AffinityKind : Int32 { {The following sample is used to hold team metadata.} {This is part of the NeKernel source tree.} -\begin{verbatim} +\begin{lstlisting} class UserProcessTeam final { public: explicit UserProcessTeam(); @@ -63,8 +96,7 @@ class UserProcessTeam final { ProcessID mTeamId{0}; ProcessID mProcessCur{0}; }; - -\end{verbatim} +\end{lstlisting} \section{The Process Image System} @@ -76,7 +108,7 @@ class UserProcessTeam final { {The following sample is a C++ container used to hold process data and metadata.} {This is part of the NeKernel source tree.} -\begin{verbatim} +\begin{lstlisting} using ImagePtr = void*; struct PROCESS_IMAGE final { @@ -112,8 +144,7 @@ struct PROCESS_IMAGE final { return ErrorOr<ImagePtr>{kErrorInvalidData}; } }; - -\end{verbatim} +\end{lstlisting} \section{Conclusion} @@ -123,8 +154,13 @@ struct PROCESS_IMAGE final { \section{References} -{NeKernel}: \href{https://github.com/nekernel-org/nekernel}{NeKernel} - -{CoreProcessScheduler}: \href{https://github.com/nekernel-org/nekernel/blob/develop/src/kernel/KernelKit/CoreProcessScheduler.h}{CoreProcessScheduler} +{ +\begin{itemize} + \item[CoreProcessScheduler:] \href{https://github.com/nekernel-org/nekernel/blob/develop/src/kernel/KernelKit/CoreProcessScheduler.h}{Link} + \item[NeKernel.org:] \href{https://nekernel.org/nekernel}{Link} + \item[Round Robin (OSTEP):] \href{https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-sched.pdf}{Link} + \item[Processor Affinity:] \href{https://www.tmurgent.com/WhitePapers/ProcessorAffinity.pdf}{Link} +\end{itemize} +} \end{document}
\ No newline at end of file |
