A Python-based operating system process management emulator designed to simulate core OS functionalities such as process creation, suspension, termination, and state transitions. The project features a graphical user interface (GUI) to monitor and manage processes dynamically.
- ⚙️ Process Creation: Add multiple processes with different execution times and priorities.
- 🛑 Process Suspension and Resumption: Manage CPU cores, where processes can be suspended if the cores are fully occupied.
- 🖥️ Graphical User Interface (GUI): A user-friendly interface to visualize and manage the processes in real-time.
- 🔄 Process States: Processes transition through various states (Ready, Running, Blocked, Blocked Suspended, Ready Suspended, Terminated) based on system resources and user actions.
- 🚫 Process Termination: Terminate processes manually or upon completion.
- 🧟 System Freeze ("Kill"): Simulate a system freeze where all processes are halted and the GUI becomes unresponsive, emulating the "Zombie" state.
Follow these steps to set up the project on your local machine.
- Python 3.9.7 installed on your system (developed and tested with Python 3.9.7).
- Virtual environment (optional but recommended) to manage dependencies.
-
Clone the repository to your local machine:
git clone https://github.com/Cabrera07/OsEmulator.git cd OsEmulator -
Set up a virtual environment (recommended):
python3 -m venv venv
-
Activate the virtual environment:
-
On macOS/Linux:
source venv/bin/activate -
On Windows:
venv\Scripts\activate
-
-
Install the project dependencies listed in the requirements.txt file:
pip install -r requirements.txt
-
Run the program:
python main.py
Once the emulator is running, use the GUI to perform the following actions:
- ➕ Add Processes: Input details for process priority and CPU Cores, then add processes to the system.
▶️ Start: Begin executing processes. The number of simultaneous processes is based on the CPU cores selected.- ⏸️ Stop: Pause all running processes.
- 🔄 Suspend: Processes exceeding the available cores will be suspended until resources are freed.
- 🗑️ Terminate: Manually terminate any process that is running or suspended.
- ☠️ Kill (Zombie State): Simulate a system freeze where all processes stop and no further actions can be performed until restarted.
OSemulator/
├── images/
│ └── mockup.png # The mockup image.
├── gui.py # Handles the graphical user interface.
├── main.py # Entry point of the emulator.
├── os_simulator.py # Core logic for simulating OS functionalities.
├── process.py # Defines the process structure and states.
├── .gitignore # Specifies which files Git should ignore.
├── README.md # Project documentation.
├── requirements.txt # List of dependencies (if any).
└── venv/ # Virtual environment directory.gui.py: Contains the code for managing the graphical user interface.main.py: The main entry point that runs the entire emulator.os_simulator.py: Contains the logic for managing CPU cores, process scheduling, and state transitions.process.py: Defines the structure and attributes of each process, as well as the transitions between different process - states.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (
git switch -c feature-branch). - Make your changes and commit them (
git commit -m 'Added new feature'). - Push to your branch (
git push origin feature-branch). - Open a pull request to the main branch.
