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.
- 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.
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
-
Clone the repository:
git clone https://github.com/yourusername/javascript-os.git cd javascript-os
-
Install dependencies:
npm install
-
Start the operating system shell:
node src/index.js
- Use the following commands in the shell:
load <value>
: Load a value into the accumulator.store <address>
: Store the accumulator value at the specified memory address.add <value>
: Add a value to the accumulator.sub <value>
: Subtract a value from the accumulator.mul <value>
: Multiply the accumulator by a value.div <value>
: Divide the accumulator by a value.print
: Print the value of the accumulator.clear
: Clear the accumulator.
createFile <filename>
: Create a new file.readFile <filename>
: Read the contents of a file.writeFile <filename> <content>
: Write content to a file.deleteFile <filename>
: Delete a file.
createProcess <instructions>
: Create a new process with a list of instructions.runProcess <pid>
: Run a process by its PID.terminateProcess <pid>
: Terminate a process by its PID.
ping <address>
: Ping a network address.traceroute <address>
: Perform a traceroute to a network address.netstat
: Display network statistics.
install <package>
: Install a package.uninstall <package>
: Uninstall a package.update <package>
: Update a package.
backup
: Backup system data.restore
: Restore system data from a backup.
addUser <username>
: Add a new user.deleteUser <username>
: Delete a user.listUsers
: List all users.
scheduleTask <task>
: Schedule a task.runTask <task>
: Run a scheduled task.
help
: Display available commands.exit
: Exit the shell.
startServer
: Start the built-in web server.stopServer
: Stop the built-in web server.
query <sql>
: Execute a SQL query on the database.
setConfig <key> <value>
: Set a configuration key-value pair.getConfig <key>
: Get the value of a configuration key.
viewLogs
: View system logs.
listTasks
: List all scheduled tasks.cancelTask <taskId>
: Cancel a scheduled task.
editFile <filename>
: Open a file in the text editor.
openWindow <app>
: Open an application window.closeWindow <app>
: Close an application window.
sendMessage <pid> <message>
: Send a message to a process.
To run the unit tests:
npm test
To run specific tests:
npm run test:unit npm run test:integration
To run performance benchmarks:
npm run benchmark
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.