{"id":27273310,"url":"https://github.com/joe-degs/software-machines","last_synced_at":"2026-05-06T22:01:57.183Z","repository":{"id":114399017,"uuid":"371706856","full_name":"Joe-Degs/software-machines","owner":"Joe-Degs","description":"Data structures and algorithms used in building software machines.","archived":false,"fork":false,"pushed_at":"2021-06-02T16:45:13.000Z","size":1157,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T09:19:18.665Z","etag":null,"topics":["algorithms","c","data-structures","golang","heap","linux","low-level","machines","memory-models","virtual-machines","virtualization","von-neumann-model"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Joe-Degs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-28T13:18:02.000Z","updated_at":"2021-08-05T13:08:43.000Z","dependencies_parsed_at":"2023-04-03T17:47:34.617Z","dependency_job_id":null,"html_url":"https://github.com/Joe-Degs/software-machines","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joe-Degs%2Fsoftware-machines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joe-Degs%2Fsoftware-machines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joe-Degs%2Fsoftware-machines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joe-Degs%2Fsoftware-machines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Joe-Degs","download_url":"https://codeload.github.com/Joe-Degs/software-machines/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248418701,"owners_count":21100193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","c","data-structures","golang","heap","linux","low-level","machines","memory-models","virtual-machines","virtualization","von-neumann-model"],"created_at":"2025-04-11T14:25:40.581Z","updated_at":"2026-05-06T22:01:57.085Z","avatar_url":"https://github.com/Joe-Degs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Implementing Machines in Software\nThis is a code along of Eleanor McHugh's talk on building components of virtual\nmachines in software(how vms are built). Basically abstract virtual machines. I do not really know anything about stuff like this, but reading and listening to stuff about the intricate\nparts of machines always fascinates me, so i'm trying out some of the code to\nunderstand more of it and how all this things work.\n\nThe codes are in c and go, go I am a little bit comfortable with but c i do not\nknow anything about. But because go is close to c i feel like i know some things\nabout it. So i'm testing the c code too.\n\nLets start with the components of computer machines;\n\n### Memory(Heap and Stack)\nThere are few models of memory around. Most, i have not heard of before. One\ni actually know is the Von-Neumann memory model but, turns out there is a bunch\nof models around. The basic function of the memory is storing data and\ninstructions. It is sometimes used for protection too.\n- __Von Neumannn model__:\nThis one is just like an array. One big contigous chunk of addressable space,\nseparated/partitioned so we have different parts of the chunk for stack, heap\nanbd the rest. The basic one everybody who hasnt taken a computer science course\non the subject knows about. \n- __Harvard model__:\nSeparate ROM and RAM, this means instructions and data are not stored in the\nsame contigous chunk of memory. This potentially prevents buffer overruns\nattacks. so code will be stored in the ROM and data in the RAM.\n- __Forth model__:\nComplex model with two diffent stacks, not really a standard heap but some\nlookup map. And some other complicated details\n- __Hybrid model__:\nThis one combines both forth and von neumann model to create a more\ncomplicated model that probably has more than two stacks.\n#### Heap\n- the heap is word aligned, byte addressable chunk of contigous memory. It is\n  basically the same accross all the memory models. And the implementation in go\nmight not be that different the implementation in c\n#### Stack\n- The stack is a slightly different beast, depending on the memory model, it\n  might be trivial to implement. The implementation will be of the type linux\nprocesses use.\n- There are a few types of stacks. We have the `spaghetti/cactus stack` and the\n  `array stack`(regular linux process stack)\n- The stack is a fixed array of memory, can be grown and shrinked and has\n  a program counter that is an offset into the array.\n- Whereas the array stack is just one contigous chunk, the cactus/spaghetti\n  stack is list of memory cells linked together, basically a linked list. It is\na functional data type especially if you make it immutable.\n#### Maps\n- maps are basically just key value pairs. This is the holy grail of\n  datastructures. If you in the computer programming business, every turn you\ntake you will hear somebody talking about hash maps, lookup tables, hash tables\netc which are all maps. In distributed computing we have consistent hashing\nalgorithms which use maps too. So yeah its a great deal for me, finally getting\nto play with map implementations is a great deal for me.\n- __Implementation Details__:\nThere are three basic aspects to maps.\n1. where the (key, value) pairs are stored. this can be done using __associative arrays__\n2. a way to search for (key, value) pairs.basically i nice search algorithm will\n   do\n3. a map interface to be able to *set* and *get* (key, value) pairs easily. most\n   people use __buckets__\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoe-degs%2Fsoftware-machines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoe-degs%2Fsoftware-machines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoe-degs%2Fsoftware-machines/lists"}