Git Product home page Git Product logo

hzkernel's Introduction

The Hertzfeld Kernel

 ____________________
< Under Construction >
 --------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Work in Progress : Some documentation may reflect planned features.


:octocat: About the Hertzfeld Kernel

The Hertzfeld Kernel is a multitasking microkernel for JavaScript which enables concurrent & time-shared execution of multiple functions. Userspace programs can be scheduled cooperatively and/or preemptively.

To implement voluntary preemptive multitasking, which is a hybrid of both cooperative and preemptive multitasking, Hertzfeld optionally pre-processes userspace source code using the HertzScript compiler.

Overview of Features

A wide variety of configurations are available for multiple use cases.

Processes & Threading

All processes in Hertzfeld are executed within one or more instances of a Threader class. The Threader class encapsulates most process-specific behaviors, and performs interoperability functions between them, a scheduler class instance, and the kernel. Threaders may be nested inside processes directly to implement prototypal process groups with their own scheduling policies. The kernel instantiates a single top-level Threader by default, in which all processes and nested sub-Threaders are executed.

There are several scheduler classes to choose from:

  • Completely Fair Scheduler
  • Brain Fuck Scheduler
  • Background
  • Batch
  • Round Robin
  • User-Supplied Scheduler

Context switching may take place at three specific points during the execution of a user process:

  • System Calls
  • Control Points
  • User-Supplied Yields

At any one of these points, the kernel may invoke the scheduler and/or delegate control to another process, eventually returning control back to a process at the same point; or the kernel may do nothing, and allow the process to continue executing.

System Calls

System calls primarily interact with the kernel's top-level Threader instance. Hertzfeld implements system calls via the yield expression and a System Call Interface (SCI) library. The SCI library is composed of simple Object factories, the return values of which may be yielded as system calls.

Calls to the kernel are yielded like so:

// Waits for 10 seconds before resuming
yield Kernel.SCI.TIME_WAIT(10000);
console.log("This gets logged after 10 seconds!");

System calls may also be written directly, rather than using the SCI library:

yield {"TIME_WAIT", [10000]};
console.log("This gets logged after 10 seconds!");

Kernel Standard Library

Hertzfeld includes a standard kernel library which contains the reusable and user-friendly components of the kernel.

Available modules include:

  • EventBus
  • MessageBus
  • Threader
  • CoreScheduler & Extenders

Kernel Modules

In addition to the kernel library, Hertzfeld includes a number of imported libraries and modules.


๐Ÿ‘จ About the Hertzfeld Name

Andy Hertzfeld (after whom this project is named) is an American computer scientist, inventor, and "software wizard". He was a member of the original Apple Macintosh development team during the 1980s, where became a primary architect of the original Macintosh System Software. Among his more recent escapades, Andy helped to create the Nautilus file manager for GNOME, helped the Open Source Applications Foundation promote open source software, and was also the key designer of the Circles user interface in Google+.

hzkernel's People

Contributors

floofies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hzkernel's Issues

Curious question

Hi,

This is terrific.

I'm just wondering why you've opted to use generators instead of worker threads and shared memory with the Atomics API (https://hacks.mozilla.org/2016/05/a-taste-of-javascripts-new-parallel-primitives/)

You can do everything with worker threads and shared memory that you're doing with generators but use all CPU cores.

Are you aware of any disadvantages?

EDIT:

The scenario the encloses the question above is having a realtime dashboard based on IMGUI (immediate mode graphics) pattern and using 2D Canvas or WebGL context for drawing. In this scenario, we can have workers sharing a virtual canvas (shared 2D array representing pixels) and each worker is in charge of updating a virtual widget on that canvas. On the main UI thread, we read from that 2D array and draw on canvas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.