{"id":16734909,"url":"https://github.com/vopaaz/file-allocation-simulator","last_synced_at":"2026-05-17T21:08:13.164Z","repository":{"id":106209690,"uuid":"194392609","full_name":"Vopaaz/File-Allocation-Simulator","owner":"Vopaaz","description":"A file allocation simulator. Course Project Additional Option for Computer System Architechture, Professor Mao, Tsinghua SEM.","archived":false,"fork":false,"pushed_at":"2019-07-01T11:36:37.000Z","size":12431,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-22T09:51:46.110Z","etag":null,"topics":["electron","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vopaaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-06-29T10:22:06.000Z","updated_at":"2022-02-16T17:07:36.000Z","dependencies_parsed_at":"2023-03-17T03:46:33.153Z","dependency_job_id":null,"html_url":"https://github.com/Vopaaz/File-Allocation-Simulator","commit_stats":{"total_commits":49,"total_committers":1,"mean_commits":49.0,"dds":0.0,"last_synced_commit":"379987b5b90a731b6c6973b90667f82aff87d8b5"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vopaaz%2FFile-Allocation-Simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vopaaz%2FFile-Allocation-Simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vopaaz%2FFile-Allocation-Simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vopaaz%2FFile-Allocation-Simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vopaaz","download_url":"https://codeload.github.com/Vopaaz/File-Allocation-Simulator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790944,"owners_count":20348378,"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":["electron","javascript"],"created_at":"2024-10-13T00:04:16.358Z","updated_at":"2026-05-17T21:08:08.117Z","avatar_url":"https://github.com/Vopaaz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Allocation Simulator\n\nA file allocation simulator.\n\nIt's the course project (Additional Option) for Computer System Architechture, Professor Mao, Tsinghua SEM.\n\n- [File Allocation Simulator](#File-Allocation-Simulator)\n  - [Background](#Background)\n  - [Running](#Running)\n    - [From Packaged Distribution](#From-Packaged-Distribution)\n    - [From Source Code](#From-Source-Code)\n      - [Prerequisites](#Prerequisites)\n      - [Install dependencies](#Install-dependencies)\n      - [Run](#Run)\n  - [Application Instruction](#Application-Instruction)\n    - [Command Data File](#Command-Data-File)\n      - [General](#General)\n      - [Operation codes](#Operation-codes)\n      - [Data File Generator](#Data-File-Generator)\n    - [Main Page](#Main-Page)\n    - [Simulation Page](#Simulation-Page)\n      - [File Information Table](#File-Information-Table)\n        - [In Contiguous Simulation](#In-Contiguous-Simulation)\n        - [In Linked Simulation](#In-Linked-Simulation)\n        - [In Indexed Simulation](#In-Indexed-Simulation)\n  - [Known Problems](#Known-Problems)\n  - [External Resources Used in the Project](#External-Resources-Used-in-the-Project)\n\n\n## Background\n\n\"File allocation\" refers to the allocation methods described in Chapter 12.4 of *Operating System Concepts, Ninth Edition* by Abraham Silberschatz, Peter Baer Galvin and Greg Gagne.\n\nThe three allocation methods are:\n\n- Contiguous Allocation\n- Linked Allocation\n- Indexed Allocation\n\nSome assumptions in this simulator are:\n\n- FAT is not used for linked allocation. The pointers are assumed to be in the file blocks instead.\n- Combined scheme is not used for indexed allocation, i.e there is only direct blocks.\n\n\n## Running\n\n### From Packaged Distribution\n\n[Download the release](https://github.com/Vopaaz/File-Allocation-Simulator/releases) and unzip the zip file. Then run `file-allocation-simulator.exe`.\n\nThe only supported platform is Windows 10 x64.\n\n### From Source Code\n\n#### Prerequisites\n\n- Node.js\n- npm\n\n#### Install dependencies\n\n```bash\n$ npm install\n```\n\n#### Run\n\n```bash\n$ npm start\n```\n\n## Application Instruction\n\n### Command Data File\n\n#### General\n\nThe command data file must be a csv-like formatted text file, with four columns and any numbers of rows.\n\nThe meaning of each columns are:\n\n| Directory | File Name | Blocks or # of the blocks | Operation code |\n| --------- | --------- | ------------------------- | -------------- |\n\n- The separator should be `,` and it should not present at the end of each row.\n- The spaces within the cell, which makes the source data file easier to read, is allowed.\n- Directory must starts with `root`\n- Multi-level directory should be separated by `/`\n- Operation code must be `C`, `R`, `W` or `D`, which will be explained in the following section\n\nHere is an example of a valid instruction file:\n\n```text\nroot, file_1, 6, C\nroot, file_1, 2, R\nroot/sub, file_2, 3, C\nroot/sub, file_2, 1, W\nroot, file_1, 6, D\n```\n\nYou can find more of them at [the test folder](https://github.com/Vopaaz/File-Allocation-Simulator/tree/master/test/assets).\n\n\n#### Operation codes\n\n- `C` stands for create.\n\nA file, located in `Directory` named `File Name` taking up `Blocks` number of blocks will be created.\n\n- `R` stands for read.\n\nThe No. `Blocks` block of file `File Name` which locates in `Directory` will be read.\n\n\n- `W` stands for write.\n\nThe No. `Blocks` block of file `File Name` which locates in `Directory` will be written.\n\n- `D` stands for delete.\n\nThe file `File Name` which locates in `Directory` will be deleted. Note that the `Block` field in this command will be **ignored** according to the instruction of Prof. Mao. The **whole** file will be deleted whatever the `Block` field is, instead of deleting only the No. `Block` block.\n\n#### Data File Generator\n\nA very simple python script was provided to generate random data file for testing.\n\n- Environment: `Python 3.7`\n- Dependencies: `pandas`, you can install by `pip install pandas`\n\nRunning:\n\n```bash\n$ python test/scripts/generate.py NUMBER\n```\n\n- Argument `NUMBER` is the number of instructions generated.\n- It should either be an integer greater than 1, or omitted, where the script will generate 20 instructions.\n\nThe instruction file will be created at `test/assets/random-tests`, named with current time.\n\n### Main Page\n\n![Main Page](doc-img/main.png)\n\nOn main page, you can click the first three buttons to open a simulation window, or click the `Documentation` button, which will direct you to the [github page of this README](https://github.com/Vopaaz/File-Allocation-Simulator/blob/master/README.md).\n\n### Simulation Page\n\n![Simulation Page](doc-img/simulation.png)\n\nThe left part in the simulation page is the file blocks. The white ones are empty and the colored ones are full, either storing a file/directory or is a index block in the indexed allocation simulation. If one file takes up several blocks, these blocks will have the same color.\n\nWhen a block is being read, its number will become blinking white `R!`. When a block is being written, its number will become blinking `W!`.\n\nThere are also three buttons at the bottom-left. `Step` will execute one instruction. `Auto` will automatically execute the instructions every 2 seconds. And the auto-execution will stop after you click it again. `Select Data File` will ask you to choose the source command file, which was discussed [above](#Command-Data-File).\n\nNote that the `Auto` button is the only \"on-off\" switch to the auto execution. That is, if you clicked `Auto`, finished one simulation, and uses the `Select Data File` to open another simulation. The second simulation **will automatically start**, unless you click the `Auto` button again.\n\nThe right part will display the necessary information.\n\n- `Instructions` lists the instructions in the data file.\n- `File Information Table` part will be discussed in the next section.\n- `Messages` tells you the detailed process of the execution of the command.\n\n#### File Information Table\n\nThe `File Information Table` part in the simulation page displays various information.\n\n#####  In Contiguous Simulation\n\nThe columns of the table will be:\n\n| File | Start | Length |\n| ---- | ----- | ------ |\n\nEach stands for: File Name, No. of the starting Block, length of the file.\n\nIf there is multi-level directory, then certain blocks will be used to save the sub-directory.\n\nYou can click that block to see the file information table contained in that block. And you can click the title `File Information Table` to get back to the main directory table.\n\n![Contiguous Table](doc-img/contiguous.gif)\n\n#####  In Linked Simulation\n\nThe name will be changed to `File Information Table or Block Pointer`. It displays both the directory table and the file pointer.\n\nInitially, the colums of the table will be:\n\n| File | Start | End |\n| ---- | ----- | --- |\n\nEach stands for the file name, the start block and the end block.\n\nYou can also click a block containing a sub-directory to see its directory table.\n\nIf you click a block containing a part of the file, the table will display its pointer information. The columns will be:\n\n| File | Next |\n| ---- | ---- |\n\nHere `Next` stands for the next block of this file.\n\nYou can return to the main directory by clicking `File Information Table or Block Pointer` as well.\n\n![Linked Table](doc-img/linked.gif)\n\n\n##### In Indexed Simulation\n\nThe name will be changed to `File Information Table or Index Block`. It displays both the directory table and the index block.\n\nInitially, the colums of the table will be:\n\n| File | Index Block |\n| ---- | ----------- |\n\nEach stands for the file name, and its index block.\n\nYou can also click a block containing a sub-directory to see its directory table.\n\nIf you click an index block, the table will display the contained index information. The columns will be:\n\n| Index |\n| ----- |\n\nHere `Index` stands for the block locations of this file.\n\nYou can return to the main directory by clicking `File Information Table or Index Block` as well.\n\n![Indexed Table](doc-img/indexed.gif)\n\n\n## Known Problems\n\n1. This application does not have good resolution adaptation and monitor-size adaption. On different devices, the display may differ, and even prevent from normal using. You can try to set different resolution on your monitor but I do not guarantee the effect.\n2. If you click the `Step` button too fast, the `R!` or `W!` words may stay on the panel rather than returning back to the block number.\n\n\n## External Resources Used in the Project\n\n- The project is built with [electron](https://github.com/electron/electron).\n- [Electron-forge](https://github.com/electron-userland/electron-forge) initialized the boilerplate and package the distributable.\n- Table Style is derived from [codepen.io](https://codepen.io/alexerlandsson/pen/mPWgpO?editors=0110), and was slightly modified.\n- Button Style is built with [css3 button generator](https://www.css3buttongenerator.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvopaaz%2Ffile-allocation-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvopaaz%2Ffile-allocation-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvopaaz%2Ffile-allocation-simulator/lists"}