%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PAPER FOR:                                                                %%
%% https://locos.codeberg.page/loco2024/                                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% The first command in your LaTeX source must be the \documentclass
%% command.
%%
%% For submission and review of your manuscript please change the
%% command to \documentclass[manuscript, screen, review]{acmart}.
%%
%% When submitting camera ready or to TAPS, please change the command
%% to \documentclass[sigconf]{acmart} or whichever template is required
%% for your publication.
%%
%%
\documentclass[sigconf]{acmart}

%% For Unix quotes
\usepackage{epigraph}
\setlength{\epigraphrule}{0pt}

%% \BibTeX command to typeset BibTeX logo in the docs
\AtBeginDocument{%
  \providecommand\BibTeX{{%
    Bib\TeX}}}

%% Rights management information.  This information is sent to you
%% when you complete the rights form.  These commands have SAMPLE
%% values in them; it is your responsibility as an author to replace
%% the commands and values with those provided to you when you
%% complete the rights form.
\setcopyright{none}
\copyrightyear{2024}
\acmYear{2024}
\acmDOI{}

%% These commands are for a PROCEEDINGS abstract or paper.
\acmConference[LOCO '24]{1st International Workshop on Low Carbon
Computing}{December 05, 2024}{Glasgow, Scotland, United Kingdom }
%%
%%  Uncomment \acmBooktitle if the title of the proceedings is different
%%  from ``Proceedings of ...''!
%%
%%\acmBooktitle{Woodstock '18: ACM Symposium on Neural Gaze Detection,
%%  June 03--05, 2018, Woodstock, NY}
\setcopyright{none}
\settopmatter{printacmref=false}
\acmDOI{}
\acmISBN{}


%% Submission ID.
%% Use this when submitting an article to a sponsored event. You'll
%% receive a unique submission ID from the organizers
%% of the event, and this ID should be used as the parameter to this command.
%%\acmSubmissionID{123-A56-BU3}

%% For managing citations, it is recommended to use bibliography
%% files in BibTeX format.
%%
%% You can then either use BibTeX with the ACM-Reference-Format style,
%% or BibLaTeX with the acmnumeric or acmauthoryear sytles, that include
%% support for advanced citation of software artefact from the
%% biblatex-software package, also separately available on CTAN.
%%
%% Look at the sample-*-biblatex.tex files for templates showcasing
%% the biblatex styles.
%%

%%
%% The majority of ACM publications use numbered citations and
%% references.  The command \citestyle{authoryear} switches to the
%% "author year" style.
%%
%% If you are preparing content for an event
%% sponsored by ACM SIGGRAPH, you must use the "author year" style of
%% citations and references.
%% Uncommenting
%% the next command will enable that style.
%%\citestyle{acmauthoryear}

%% Easy way to write code inline
\newcommand{\code}{\texttt}

%% end of the preamble, start of the body of the document source.
\begin{document}

%% The "title" command has an optional parameter,
%% allowing the author to define a "short title" to be used in page headers.
\title{A computing system that embraces the language}

%%
%% The "author" command and its associated commands are used to define
%% the authors and their affiliations.
%% Of note is the shared affiliation of the first two authors, and the
%% "authornote" and "authornotemark" commands
%% used to denote shared contribution to the research.
\author{Ekaitz Zárraga Río}
%% \authornote{Both authors contributed equally to this research.}
\email{ekaitz@elenq.tech}
%% \affiliation{%
%%   \institution{Institute for Clarity in Documentation}
%%   \city{Dublin}
%%   \state{Ohio}
%%   \country{USA}
%% }

%%
%% By default, the full list of authors will be used in the page
%% headers. Often, this list is too long, and will overlap
%% other information printed in the page headers. This command allows
%% the author to define a more concise list
%% of authors' names for this purpose.
\renewcommand{\shortauthors}{Zárraga Río E.}

%% The abstract is a short summary of the work to be presented in the
%% article.
\begin{abstract}
%% TODO
  Computing, as any other field, evolved from the previous work on the matter.
  During its development huge advancements have been done in many areas but
  only some are in use today, due to the inertia industry already had, which
  forced some sort of retrocompatibility. In this document a new computing
  platform is presented, one that makes use of some of the ideas that did not
  reach the mainstream and uses our current computing capabilities in order to
  achieve a personal computing device that embraces the programming language.
\end{abstract}

%% Document outline:
%% - Motivation: Simplification as a mean for more efficient computing and
%%   a more accessible manufacture. Modern computing systems are so complex
%%   that they require very good manufacturing to deal with the excessive
%%   computing waste.
%%   Also, maintenance should be reduced as much as possible, even leaving it
%%   in the hands of the user, as Oberon would, reducing the impact of the
%%   repairs, upgrades, and computing infrastructure needed for simple tasks.
%% - Kernels, Unix
%% - Interpreters
%%    - Shells
%%    - Are interpreters a kernel?
%% - Removing layers instead of adding layers
%%    - Unikernels: Good idea but miss the target.

%% Keywords. The author(s) should pick words that accurately describe
%% the work being presented. Separate the keywords with commas.
\keywords{Operating Systems, Programming Languages, Interpreters}
%% A "teaser" image appears between the author and affiliation
%% information and the body of the document, and typically spans the
%% page.
%% \begin{teaserfigure}
%%   \includegraphics[width=\textwidth]{sampleteaser}
%%   \caption{Seattle Mariners at Spring Training, 2010.}
%%   \Description{Enjoying the baseball game from the third-base
%%   seats. Ichiro Suzuki preparing to bat.}
%%   \label{fig:teaser}
%% \end{teaserfigure}

%% Dates for the article
%% \received{20 February 2007}
%% \received[revised]{12 March 2009}
%% \received[accepted]{5 June 2009}


%% This command processes the author and affiliation and title
%% information and builds the first part of the formatted document.
\maketitle

\section{Context}

%% We need to understand context ...
  All engineering decisions are taken in a context and those that are adopted
  by any industry are oftentimes driven by previous decisions taken in the same
  subject. Specifically, the computing industry, arguably due to its rapid
  emergence, has been heavily influenced by previous technology and
  \textit{backwards compatibility}. Reviewing the most influential ideas of
  computing one can obtain valuable information to be able to criticise current
  computing systems and propose pioneering alternatives.

\subsection{Von Neumann model}
  The von Neummann model introduced in 1945 proposes a general purpose device
  consisting of a \textit{Central Processing Unit} (CPU) and a \textit{Store}.
  The \textit{Store} is often implemented as a \textit{Random Access Memory}
  (RAM or, simply, \textit{memory}), which stores data in bytes, each of them
  with an \textit{address}, in a tabulated fashion.

  In the von Neumann model the data and the program are both written to and
  read from the \textit{Store}. This arrangement had carried criticism over the
  years but it is also a fundamental part of how modern Operating Systems work.

\subsection{Unix's heritage}
\epigraph{
  Applicants must also have extensive knowledge of Unix, although they should
  have sufficiently good programming taste to not consider this an achievement.
}{\textit{-- Hal Abelson}}

  Since its inception, Unix was a huge innovation in Operating Systems market.
  Its main features include \textit{multitasking} and \textit{multi-user}
  support, a programming interface, \textit{files as abstractions} for devices
  and other objects and a powerful \textit{shell} that facilitates program
  composition.

\subsubsection{The Kernel}
  In the Unix model, the Kernel, the core of the Operating System, is
  responsible for managing the hardware resources. For that job, it uses
  several concepts that systems designers and programmers are familiarized with
  and are discouraged to change. Those include \textit{virtual memory},
  \textit{processes}, \textit{shared-memory threads}, \textit{hierarchical
  filesystems} and \textit{system calls}.

\subsubsection{The Shell}\label{shell}
  The shell is run as a userspace program that has the hability to launch other
  programs using an outdated fork+exec mechanism that encourages memory
  overshoot\cite{fork:Baumann}.
  The shell in Unix systems is optimized for text processing as, in McIlroy's
  words, \textit{"text streams [are] the universal interface"}
  \cite{QuarterCenturyUnix:Salus}.

%\subsubsection{Userspace programs}
%
%  Programs are loaded in and given access to \textit{virtual memory}, and they
%  can only run a subset of the CPU instructions of the machine, the
%  \textit{unprivileged} set. For restricted operations, programs need to call
%  the \textit{Kernel} using a \textit{system-call} that can be accepted or
%  rejected by the latter, according to some rules for \textit{permissions} or
%  resource availability. In order to achieve multitasking, many programs can be
%  loaded in memory (\textit{processes}) simultaneously and the \textit{Kernel}
%  \textit{schedules} which of the them will run at a given moment in time and
%  pauses the rest accordingly.
%
%
%  \paragraph{Concurrency}
%  If programs need to operate concurrently they can create many
%  \textit{processes} or use \textit{threads}. A \textit{thread} is a
%  lightweight version of a \textit{process} that shares the memory with the
%  \textit{process} that created it. Resource sharing in a concurrent system has
%  many security and reliability implications, and has proven to be a difficult
%  subject for computer programmers over the years
%  \cite{Threads:Lee}.
%
%
%\subsubsection{Interpreters}
%  Interpreters, like one in the \textit{shell}, are a fundamental part of
%  modern day programming. Interpreters are run as userspace programs, acting as
%  a \textit{host} for the program they interpret. The interpreter effectively
%  hides the details of the Operating System, often even implementing a virtual
%  machine for that job, in order to provide \textit{portability} and
%  \textit{usability} to the programmers. That is why the most used and demanded
%  programming languages nowadays are interpreted \cite{PLCommunity:Tambad}.

%  Unix was marketed as a system for multiple languages / supports many
%  languages via interpreters that ease the development experience. Describe how
%  they work and why they are useful
%  Interpreters are programs that run in userspace

\subsection{Computer hardware}
  Computer processors, often marketed as "\textit{general purpose}", are based
  on the von Neumann model\cite{LiberateFromVonNeumann:Backus}, a CPU and a
  Store that is, and designed for running an Operating System on them. They
  clearly separate \textit{privileged}, reserved for the kernel, and
  \textit{unprivileged} instructions, that any userspace program can use, in
  order to facilitate \textit{system-calls} and \textit{interrupt} and
  \textit{virtual memory} control.

  Contrary to what one could expect, most of the improvements in the processor
  architectures come from specialization for the said case, and not from
  generalization.

  Modern processors are heavily optimized for Operating Systems that follow the
  Unix model (including MS Windows), and a memory layout that resembles that of
  a \textit{C-like} program, which also comes from the days of Unix
  \cite{GeneralPurposeProcessor:Chisnall}, reducing the chance for other
  paradigms to succeed.


\section{Embracing the language}

  If a computing system aims to embrace the language, it needs to make a proper
  analysis of what a programming language is and how people make use of the
  programming facilities that computing systems provide.

  From the perspective of Operating System and Programming Language
  implementations, there is a duplication of work. Embracing a language does
  not only eliminate the duplication but opens a new opportunity for
  interesting optimizations to flourish. \cite{MIMOSA:Yvon}

\subsection{Choosing Scheme}
  The \textit{Lisp} family of languages have proven to be flexible and powerful
  for system design \cite{LispMachine:Greenblatt} and particularly
  \textit{Scheme} has a long history of research in language and CPU design
  (lambda papers).

  \textit{Scheme} is a simple language, with a minimal standard, but that
  enables a huge level of abstraction thanks to its minimal but powerful core
  concepts which are also present in mainstream programming languages today
  (Python, JavaScript) reducing the friction with seasoned programmers.

  The nature of the Lisp family of languages also makes them suitable as file
  formats (sxml) for storage and configuration files, writing DSLs (language
  oriented programming), or extending the language (GOOPS, WISP) to the users'
  needs (Typed Racket, Kawa). This eliminates the need to rely on unstructured
  text \ref{shell}.

  This makes \textit{Scheme} and its possible extensions a good choice to
  please \textit{vernacular programmers}\cite{MythsPL:Shaw}, that comprehend a
  good compromise between available technical literacy from the user side and a
  wide audience to benefit.

\subsection{Research opportunities in the OS}

  The reduction of the kernel to a kernel-interpreter eliminates the
  duplication of tasks, while also allowing to use higher level concepts in a
  lower-level structure, like the operating system. \textit{System calls}
  become \textit{function calls}.

\subsubsection{Managed memory}
  Virtual memory is an attempt to isolate programs from each other but it is a
  leaky abstraction that can be exploited\cite{SpectreMeltdown:HillMasters}.
  Removing direct access to memory, replacing it with managed memory, removes
  the need of virtual memory.

\subsubsection{No threads/processes but tasks}
  Unix-style parallelism, reinforced by modern \textit{multi-core} CPU design,
  focuses on the implementation rather than the usage. Browser-like task design
  based on Coroutines/Generators/Asynchronous calls. No shared-memory threads,
  as they are hard to reason about\cite{Threads:Lee}.

\subsubsection{Capability based security "lambda-style"}
  Reduces the amount of permission issues inherited from von Neumann style and
  Unix. No \textit{user} support. [3L]

\subsubsection{Filesystem}
  This allows for new paradigms in Filesystem design.


\subsection{Research opportunities in the Hardware}
  Attempts have been done to run Scheme in a bare-metal environment
  \cite{MIMOSA:Yvon} [LOKO], but none of them approached the problem of a CPU
  that is heavily optimized for a software model that has other underlying
  concepts.

  Once the language is chosen and the structure of the kernel is well-defined,
  many optimizations can be applied to the underlying hardware, the same way it
  is done nowadays, but with different goals.

\subsubsection{Optimization for tree structures}
  \textit{Scheme} is based (not only that, the language itself is a list) in
  the \textit{cons cell}, similar to a \textit{linked-list} node, and the data
  structures that can be created from it (\textit{lists} and \textit{trees}).
  Optimizing the CPU for that case, with fast lookups and \code{car} and
  \code{cdr} operations hugely impacts in its performance. This can also affect
  the memory, but as it is managed, the user would never notice any difference.

\subsubsection{CPU as a reducer}
  \textit{Scheme} supports many paradigms but the basis of the language is the
  expression reduction, not like imperative language, where the basis is the
  \textit{statement}. This opens the door for optimizations like those applied
  in current \textit{Scheme} interpreters but in a hardware level. [REDUCER
  CPUs]

\subsubsection{Hardware garbage collection}
  When the whole system uses managed memory, the Garbage Collection,
  \textit{GC}, can be pushed down in the stack. Oberon's GC is in the kernel,
  but we could push it down to the hardware.

\subsubsection{FPGA}
  Focusing on personal computing can be a extremely powerful way to explore
  optimization and simplification of computing systems to the point they can be
  run in custom unoptimized CPUs implemented in FPGAs \cite{Oberon:Wirth}.

  For our case, a FPGA facilitates the testing and the evaluation of the
  impacts of the proposed optimizations. If a Hardware Description Language,
  \textit{HDL}, is provided with the system and the Operating System is able to
  program the FPGA, the whole system can be updated together, improving the OS
  and the needed hardware at the same time. A \textit{rollback}[GUIX/NIX]
  mechanism could always recover the state of both hardware and software as if
  they were the same thing.

  The FPGAs are more power hungry and not as fast as ASICs but
  the reduction of complexity proposed in this paper should be enough for
  personal computing. Also, letting the user configure the CPU from the
  computer itself reduces the need for constant upgrades, uses commodity
  hardware instead of very specialized devices and reduces the chance of a
  supply chain attack in many levels \cite{riscvSelfHostingComputer:Somlo}.


\section{Conclusion}

  There have been several attempts to use Scheme in bare-metal, and make
  Lisp/FP machines.

  Choosing an FPGA and a simplified approach opens for many optimization
  options where novel research ideas can be express due to the language
  oriented design of Scheme. This research can be applied in other languages
  that use similar constructs (FP languages, but also Python and JS).

  Extending the reach of the language enriches the relationship the user has
  with the computer. If the selected language is powerful in terms of the level
  of abstraction it can provide, it could become the only tool a user needs for
  every single administration task, including hardware upgrade or optimization.

  Embracing the language is embracing the person in charge of the computer.

\clearpage

%% The acknowledgments section is defined using the "acks" environment
%% (and NOT an unnumbered section). This ensures the proper
%% identification of the section in the article metadata, and the
%% consistent spelling of the heading.
%% \begin{acks}
%% To Robert, for the bagels and explaining CMYK and color spaces.
%% \end{acks}


%% The next two lines define the bibliography style to be used, and
%% the bibliography file.
\bibliographystyle{ACM-Reference-Format}
\bibliography{../../bibliography}


%% If your work has an appendix, this is the place to put it.
%% \appendix


\end{document}
\endinput
