An open API service indexing awesome lists of open source software.

https://github.com/lrmulkayhee/javascript-os

JavaScript OS is a comprehensive operating system simulation written in JavaScript. It provides a wide range of functionalities including process management, memory management, file system operations, and more.
https://github.com/lrmulkayhee/javascript-os

benchmark commands javascript operating-system operating-system-learning os simulation testing

Last synced: 12 months ago
JSON representation

JavaScript OS is a comprehensive operating system simulation written in JavaScript. It provides a wide range of functionalities including process management, memory management, file system operations, and more.

Awesome Lists containing this project

README

          

# JavaScript OS
JavaScript OS is a comprehensive operating system simulation written in JavaScript. It provides a wide range of functionalities including process management, memory management, file system operations, and more.

## Features

- **Process Management**: Create, run, and terminate processes.
- **Memory Management**: Load, store, and manipulate data in memory.
- **File System**: Create, read, write, and delete files.
- **Network Utilities**: Perform network operations like ping, traceroute, and netstat.
- **Package Management**: Install, uninstall, and update packages.
- **Backup and Restore**: Backup and restore system data.
- **User Management**: Add, delete, and list users.
- **Automation Scripts**: Schedule and run tasks automatically.
- **Logging**: Comprehensive logging for system operations.
- **Configuration Management**: Manage system configurations.
- **Shell Interface**: Interactive shell for executing commands.
- **Virtual File System**: Simulate a file system for the OS.
- **Task Management**: Manage and schedule tasks.
- **Text Editing**: Basic text editor functionality.
- **Window Management**: Manage application windows.
- **Inter-Process Communication**: Facilitate communication between processes.
- **Web Server**: Built-in web server for handling HTTP requests.
- **Database Management**: Manage and interact with databases.
- **Performance Benchmarks**: Benchmark various system components.
- **Testing**: Unit and integration tests for system components.

## Directory Structure
```
project/
├── fs/ # File system root
├── src/
│ ├── index.js # Entry point
│ ├── WebServer.js
│ ├── commands/ # Command modules
│ │ ├── file-management/
│ │ │ ├── FileCommands.js
│ │ ├── system-monitoring/
│ │ │ ├── MemoryCommands.js
│ │ ├── process-management/
│ │ │ ├── ProcessCommands.js
│ ├── os/ # Operating system core
│ │ ├── OperatingSystem.js
│ │ ├── Process.js
│ │ ├── cli.js
│ │ ├── configManager.js
│ │ ├── database.js
│ │ ├── fileManager.js
│ │ ├── fileSystem.js
│ │ ├── IPC.js
│ │ ├── Logger.js
│ │ ├── MemoryManager.js
│ │ ├── Network.js
│ │ ├── PackageManager.js
│ │ ├── ProcessScheduler.js
│ │ ├── Shell.js
│ │ ├── TaskManager.js
│ │ ├── TextEditor.js
│ │ ├── UserManager.js
│ │ ├── VirtualFileSystem.js
│ │ ├── WindowManager.js
│ ├── network-utilities/
│ │ ├── ping.js
│ │ ├── traceroute.js
│ │ ├── netstat.js
│ ├── package-management/
│ │ ├── install.js
│ │ ├── uninstall.js
│ │ ├── update.js
│ ├── backup-restore/
│ │ ├── backup.js
│ │ ├── restore.js
│ ├── user-management/
│ │ ├── add-user.js
│ │ ├── delete-user.js
│ │ ├── list-users.js
│ ├── automation-scripts/
│ │ ├── schedule-task.js
│ │ ├── run-task.js
├── test/ # Test directory
│ ├── unit/
│ │ ├── backup.test.js
│ │ ├── cli.test.js
│ │ ├── configManager.test.js
│ │ ├── database.test.js
│ │ ├── FileCommands.test.js
│ │ ├── fileManager.test.js
│ │ ├── install.test.js
│ │ ├── logger.test.js
│ │ ├── MemoryCommands.test.js
│ │ ├── netstat.test.js
│ │ ├── packageManager.test.js
│ │ ├── ping.test.js
│ │ ├── ProcessCommands.test.js
│ │ ├── restore.test.js
│ │ ├── shell.test.js
│ │ ├── taskManager.test.js
│ │ ├── textEditor.test.js
│ │ ├── traceroute.test.js
│ │ ├── uninstall.test.js
│ │ ├── update.test.js
│ │ ├── userManager.test.js
│ │ ├── webServer.test.js
│ │ ├── windowManager.test.js
│ ├── integration/
│ │ ├── OperatingSystem.test.js
│ ├── checklist/
│ │ ├── functionality-checklist.md
│ │ ├── performance-checklist.md
│ ├── benchmarks/
│ │ ├── backup-restore-benchmark.js
│ │ ├── cli-benchmark.js
│ │ ├── config-manager-benchmark.js
│ │ ├── database-benchmark.js
│ │ ├── file-operations-benchmark.js
│ │ ├── logger-benchmark.js
│ │ ├── memory-benchmark.js
│ │ ├── network-benchmark.js
│ │ ├── package-management-benchmark.js
│ │ ├── process-benchmark.js
│ │ ├── shell-benchmark.js
│ │ ├── task-manager-benchmark.js
│ │ ├── user-management-benchmark.js
│ │ ├── web-server-benchmark.js
│ │ ├── window-manager-benchmark.js
├── .gitignore
├── package.json
├── package-lock.json
├── README.md
```

## Installation

1. Clone the repository:
```sh
git clone https://github.com/yourusername/javascript-os.git
cd javascript-os
```

2. Install dependencies:
```sh
npm install
```

3. Start the operating system shell:
```sh
node src/index.js
```

4. Use the following commands in the shell:

### Memory Commands

- `load `: Load a value into the accumulator.
- `store

`: Store the accumulator value at the specified memory address.
- `add `: Add a value to the accumulator.
- `sub `: Subtract a value from the accumulator.
- `mul `: Multiply the accumulator by a value.
- `div `: Divide the accumulator by a value.
- `print`: Print the value of the accumulator.
- `clear`: Clear the accumulator.

### File Commands

- `createFile `: Create a new file.
- `readFile `: Read the contents of a file.
- `writeFile `: Write content to a file.
- `deleteFile `: Delete a file.

### Process Commands

- `createProcess `: Create a new process with a list of instructions.
- `runProcess `: Run a process by its PID.
- `terminateProcess `: Terminate a process by its PID.

## Additional Commands

### Network Utilities

- `ping

`: Ping a network address.
- `traceroute
`: Perform a traceroute to a network address.
- `netstat`: Display network statistics.

### Package Management

- `install `: Install a package.
- `uninstall `: Uninstall a package.
- `update `: Update a package.

### Backup and Restore

- `backup`: Backup system data.
- `restore`: Restore system data from a backup.

### User Management

- `addUser `: Add a new user.
- `deleteUser `: Delete a user.
- `listUsers`: List all users.

### Automation Scripts

- `scheduleTask `: Schedule a task.
- `runTask `: Run a scheduled task.

### Shell Interface

- `help`: Display available commands.
- `exit`: Exit the shell.

### Web Server

- `startServer`: Start the built-in web server.
- `stopServer`: Stop the built-in web server.

### Database Management

- `query `: Execute a SQL query on the database.

### Configuration Management

- `setConfig `: Set a configuration key-value pair.
- `getConfig `: Get the value of a configuration key.

### Logging

- `viewLogs`: View system logs.

### Task Management

- `listTasks`: List all scheduled tasks.
- `cancelTask `: Cancel a scheduled task.

### Text Editing

- `editFile `: Open a file in the text editor.

### Window Management

- `openWindow `: Open an application window.
- `closeWindow `: Close an application window.

### Inter-Process Communication

- `sendMessage `: Send a message to a process.

## Testing

To run the unit tests:
```sh
npm test
```

To run specific tests:
```sh
npm run test:unit
npm run test:integration
```

## Benchmarks

To run performance benchmarks:
```sh
npm run benchmark
```

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License. See the LICENSE file for details.