Skip to content

Instantly share code, notes, and snippets.

\ -----------------------------------------------------------
\ Cooperative Multitasking
\ -----------------------------------------------------------
\ Configuration:
128 cells constant stackspace \ 128 stack elements for every task
\ Internal stucture of task memory:
\ 0: Pointer to next task
@jemo07
jemo07 / IPC_enhancements.md
Last active October 22, 2023 17:12
Removing IPC Traffic from Microkernels

Conceptual Stack-Based IPC Enhancement in Microkernel Architectures

In the realm of computer science, microkernels, exo-kernels, and Forth kernel designs represent the epitome of minimalist and efficient operating system architectures. These designs pivot around the core principle of simplifying the kernel's functionalities, relegating many traditional OS services to user space. As elegant as these architectures might seem, they're not without challenges, one of the most significant being the efficient handling of Inter-Process Communication (IPC) in a parallel or threaded execution environment.

Context switching, the process of storing and restoring the state of a process or thread so that execution can be resumed from the same point at a later time, is a foundational aspect of multi-tasking operating systems. However, in lightweight kernel designs, excessive context switching can quickly become a performance bottleneck. The quest for achieving high efficiency while reducing the overhead of context s

@jemo07
jemo07 / IsolatedAppForth.md
Created October 14, 2023 10:58
Conceptual Model for Isolated App Execution in Forth

Conceptual Model for Isolated App Execution in Forth

1. New App Creation:

  • newapp: Initiates the creation of a new app, allocating memory for a new dictionary via kalloc and assigning a thread.
  • Words defined post newapp and before endapp belong to the new app’s dictionary.
: newapp ( name -- )
    CREATE                 \ Create a new word in the main dictionary
 PGSIZE kalloc \ Allocate memory for the app's dictionary
@jemo07
jemo07 / MemoryParallelForth.md
Created October 14, 2023 10:57
Synchronized Memory Management System for a parallel Forth environment

Note: Synchronized Memory Management and Processing in Parallel Forth

Objective:

Develop an intertwined system for a parallel Forth environment that ensures simultaneous processing and isolated memory management for each app (dictionary).

Core Mechanisms:

  • kalloc: Allocates a page of physical memory, ensuring alignment to 4KiB.
  • kfree: Frees previously allocated physical memory page, returning it to the available pool.
C Code Snippet: kalloc and kfree
@jemo07
jemo07 / DataType_ForthVMStack.md
Last active October 13, 2023 21:18
Type Casting DataType in forth VM

Extended Notes on Implementing a Typed Stack in a Stack-Based VM Using C

1. Utilizing Void Pointers

  • Void Pointers: Non-type-specific pointers in C, requiring type-casting for dereferencing.
  • Application: Enables generic handling of various data types in data structures and functions.

2. DataType: Enumerating Possible Data Types

  • Define possible data types in an enumeration to create a type-tagging system.
typedef enum {
/* M O U S E */
/* */
/* Program: MOUSE */
/* */
/* Programmer: David G. Simpson */
/* Laurel, Maryland */
/* February 3, 2002 */
/* */
/* Language: C */
/* */
/*
MOUSE - A Language for Microcomputers (compiler)
as described by Peter Grogono in July 1979 BYTE Magazine
*/
#include <stdio.h>
enum tagtype { MACRO, PARAM, LOOP };
struct frame {
enum tagtype tag;
/*
MOUSE - A Language for Microcomputers (interpreter)
as described by Peter Grogono in July 1979 BYTE Magazine
*/
#include <stdio.h>
enum tagtype { MACRO, PARAM, LOOP };
struct frame {
enum tagtype tag;
/*
MOUSE - A Language for Microcomputers (interpreter)
as described by Peter Grogono in July 1979 BYTE Magazine
*/
#include <stdio.h>
enum tagtype { MACRO, PARAM, LOOP };
struct frame {
enum tagtype tag;

Forth Systems Performance Analysis

Introduction

Forth, a unique stack-based programming language, has seen numerous implementations over the years. Each implementation brings its distinct features and optimizations, resulting in a spectrum of performance characteristics. We analyzed several Forth systems to discern patterns and insights that might guide future developers or users in system selection or optimization.

The Dataset