summaryrefslogtreecommitdiffhomepage
path: root/source/wg02/paper.tex
blob: 4f49ab5c4e7fb2656078376942114d8a5554941e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
% AUTHOR: Amlal El Mahrouss
% PURPOSE: WG02: Methodology for Process and Image Computation.

\documentclass[11pt, a4paper]{article}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[margin=0.5in,top=1in,bottom=1in]{geometry}

\title{Methodology for Process and Image Computation.}
\author{Amlal El Mahrouss\\amlal@nekernel.org}
\date{December 2025\\Last Edited: January 2026}

\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}

\bf \maketitle

\begin{center}
	\rule[0.01cm]{17cm}{0.01cm}
\end{center}

\abstract
{CoreProcessScheduler governs how the scheduling backend and policy of the system works, It is the common gateway for schedulers inside NeKernel based systems.}

\begin{center}
	\rule[1cm]{17cm}{0.01cm}
\end{center}

\section{I: Introduction.}

{CoreProcessScheduler (now referred as CPS) serves as the foundation between the scheduler backend and system.} {It takes care of process life-cycle management, team-based process grouping, and affinity-based CPU based allocation to mention the least.}

\subsection{II: 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{Illustration: The Affinity Kind.}

{The following sample is C++ code.} {The smaller the value, the more critical the process.}

\begin{lstlisting}
enum struct AffinityKind : Int32 {
  kRealTime     = 100,
  kVeryHigh     = 150,
  kHigh         = 200,
  kStandard     = 1000,
  kLowUsage     = 1500,
  kVeryLowUsage = 2000,
};
\end{lstlisting}

\subsection{III: The Team Domain 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{Illustration: Team System.}

{The following sample is used to hold team metadata.} {This is part of the NeKernel source tree.}

\begin{lstlisting}
class UserProcessTeam final {
 public:
  explicit UserProcessTeam();
  ~UserProcessTeam() = default;

  NE_COPY_DEFAULT(UserProcessTeam)

  Array<UserProcess, kSchedProcessLimitPerTeam>& AsArray();
  Ref<UserProcess>&                              AsRef();
  ProcessID&                                      Id() noexcept;

 public:
  UserProcessArray mProcessList;
  UserProcessRef   mCurrentProcess;
  ProcessID          mTeamId{0};
  ProcessID          mProcessCur{0};
};
\end{lstlisting}

\subsection{IV: The Process Image System}

{The `ProcessImage' container is a system designed to contain process data, and metadata, its purpose comes from the need to separate data and code. Such usage is useful for validation and vettability.} {This approach helps separate concerns and give modularity to the system, as the image and process structure are not mixed together.}

\subsection{Illustration: Process Image System.}

{The following sample is a container used to hold process data and metadata.} {This is part of the NeKernel source tree.}

\begin{lstlisting}
using ImagePtr = VoidPtr;

struct ProcessImage final {
  explicit ProcessImage() = default;

 private:
  friend UserProcess;
  friend KernelTask;

  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};
    }
  }

  ErrorOr<ImagePtr> LeakBlob() {
    if (this->fBlob) {
      return ErrorOr<ImagePtr>{this->fBlob};
    }
  }
};
\end{lstlisting}

\section{V: Conclusion.}

{The CPS is a system with provable domains and separation of computation, it governs how a Process Domain shall compute its child processes, it does not provide the algorithms.} {Which is why, one scheduler backend (such as the UserProcessScheduler) takes care of user process scheduling and fairness.}

\section{References}

\begin{enumerate}
    \item CoreProcessScheduler.h (2025), \href{https://github.com/nekernel-org/nekernel/blob/develop/src/kernel/KernelKit/CoreProcessScheduler.h}{github.com}
    
    \item NeKernel.org (2025), \href{https://nekernel.org/nekernel}{nekernel.org}
    \item Scheduling: Introduction (2012), \href{https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-sched.pdf}{pages.cs.wisc.edu}
    
    \item  Processor Affinity, Multiple CPU Scheduling (2003), \href{https://www.tmurgent.com/WhitePapers/ProcessorAffinity.pdf}{tmurgent.com}
    
    \item El Mahrouss, A. (2026). Methodology for Freestanding Development.\\ Zenodo. https://doi.org/10.5281/zenodo.18362425
    
    \item El Mahrouss, A. (2026). The Execution Semantics: On Axioms, Domains, and Authority. (v1.0.0). Zenodo. https://doi.org/10.5281/zenodo.18362375
\end{enumerate}

\end{document}