Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonrad/femtoassembler
https://github.com/jonrad/femtoassembler
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jonrad/femtoassembler
- Owner: jonrad
- Created: 2019-12-14T20:00:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T14:01:34.000Z (almost 2 years ago)
- Last Synced: 2024-10-17T21:45:19.537Z (21 days ago)
- Language: JavaScript
- Size: 6.17 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# femtoassembler
We've seen the benefits of [femto-management](https://vimeo.com/95529846) over micro-management. So why are we still using micro-services?
Microservices are a bust. They fail on every axis of comparison. They're not liberating enough. They're not confining enough. They're not loose enough. They're not tight enough.
For those looking to jump from mega-fund to peta-fund, the answer is femto-services.
Stop using a single CPU to run your applications. With the femtoassembler you can have each instruction run on a different node. Notice that you're application is calling ADD more than other instructions? Increase the replicas to the ADD instruction nodes!
### Demo
Below gif shows an example run of calculating fib of 10 using an 8 bit integer values (Registers only, no need to use actual memory other than for the cpu instructions). The left pane is the result from skaffold, the next pane is the stdout of the cpu node, followed by 4 instruction nodes that I found interesting, followed by the actual command to run the command. The result is in hex:
![8 Bit Fib(10)](examples/fib8bit.gif)# Running
### Mac with Minikube
* Create a new cluster:
```minikube start -p assembler```
* Set the context for kubectl to the new cluster:
```kubectl config set-context assembler```
* Set your docker environment to the new minikube context:
```eval $(minikube docker-env -p assembler)```
* Optional: I had to kill my `dnsmasq` to get my minikube to be able to access the network properly (Why...?):
```sudo killall dnsmasq```
* Start skaffold:
```./start_skaffold.sh```
* Profit!?
* To run examples, open a new terminal and run:
```
$ eval $(minikube docker-env -p assembler)
$ cd examples
$ ./run.sh
root@examples:/usr/src/app# node run.js helloworld.asm #Hello world in HEX
[
'48', '65', '6c', '6c',
'6f', '20', '57', '6f',
'72', '6c', '64', '21',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00'
]
root@examples:/usr/src/app# node run.js fib8bit.asm #fib(10) in HEX, 8 bit (Only uses a single byte of memory)
[
'59', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00'
]
root@examples:/usr/src/app# node run.js fib.asm #fib(42) in HEX, using 32 bit big endian notation
[
'19', 'd6', '99', 'a5',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00',
'00', '00', '00', '00'
]
```# Architecture
* Memory - Stores 256 bytes of data, which should be enough for anyone.
* CPU - Runs the instructions based on what's in memory
* Assembler Line Parser - Parses a single instruction line (such as `MOV A, B`) and returns the machine code representation
* Assembler - Takes the assembler instructions, sends to the line parsers and puts it all together into memory
* Executor - Runs the code in memory
* add-reg-to-reg - Example instruction node. Takes a single instruction and updates the state of the execution# Tools used
Most of the javascript assembler and executor code is borrowed from https://github.com/Schweigi/assembler-simulator, I just ripped it apart using a combination of bash, perl and scripts written in node.
* Neovim: https://neovim.io/
* Skaffold: https://skaffold.dev/
* Stern: https://github.com/wercker/stern