Skip to content

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.

License

Notifications You must be signed in to change notification settings

lrmulkayhee/javascript-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

    git clone https://github.com/yourusername/javascript-os.git
    cd javascript-os
  2. Install dependencies:

    npm install
  3. Start the operating system shell:

    node src/index.js
    1. Use the following commands in the shell:

    Memory Commands

    • 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.

    File Commands

    • 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.

    Process Commands

    • 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.

    Additional Commands

    Network Utilities

    • ping <address>: Ping a network address.
    • traceroute <address>: Perform a traceroute to a network address.
    • netstat: Display network statistics.

    Package Management

    • install <package>: Install a package.
    • uninstall <package>: Uninstall a package.
    • update <package>: Update a package.

    Backup and Restore

    • backup: Backup system data.
    • restore: Restore system data from a backup.

    User Management

    • addUser <username>: Add a new user.
    • deleteUser <username>: Delete a user.
    • listUsers: List all users.

    Automation Scripts

    • scheduleTask <task>: Schedule a task.
    • runTask <task>: 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 <sql>: Execute a SQL query on the database.

    Configuration Management

    • setConfig <key> <value>: Set a configuration key-value pair.
    • getConfig <key>: Get the value of a configuration key.

    Logging

    • viewLogs: View system logs.

    Task Management

    • listTasks: List all scheduled tasks.
    • cancelTask <taskId>: Cancel a scheduled task.

    Text Editing

    • editFile <filename>: Open a file in the text editor.

    Window Management

    • openWindow <app>: Open an application window.
    • closeWindow <app>: Close an application window.

    Inter-Process Communication

    • sendMessage <pid> <message>: Send a message to a process.

    Testing

    To run the unit tests:

    npm test

    To run specific tests:

    npm run test:unit
    npm run test:integration

    Benchmarks

    To run performance benchmarks:

    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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published