Skip to main content

A lightweight Python library for simulating classic Operating System algorithms like CPU scheduling and page replacement.

Project description

LOGORYTHEM

A lightweight Python library for simulating classic Operating System (OS) algorithms — including CPU scheduling and page replacement.

This project is designed as a clean, importable library for academic and research use, allowing you to easily run and compare different OS algorithms.


Features

logorythem includes two primary modules:

CPU Scheduling (scheduling)

Simulates process scheduling algorithms and calculates:

  • Waiting Time
  • Turnaround Time
  • Completion Time

Available algorithms:

  • First-Come, First-Served (FCFS)
  • Round Robin (RR)
  • Shortest Job First (SJF) – Non-Preemptive
  • Shortest Remaining Time First (SRTF) – Preemptive SJF

Page Replacement (page_replacement)

Simulates memory management algorithms and computes:

  • Total Page Faults
  • Page Replacement Sequence

Available algorithms:

  • First-In, First-Out (FIFO)
  • Least Recently Used (LRU)
  • Optimal (OPT)

Installation

logorythem is available on PyPI. Install it using:

pip install logorythem

Quick Usage

Example – Round Robin Scheduling

from logorythem import scheduling

processes = [
    {"pid": "P1", "arrival": 0, "burst": 5},
    {"pid": "P2", "arrival": 1, "burst": 3},
    {"pid": "P3", "arrival": 2, "burst": 8},
]

result = scheduling.round_robin(processes, quantum=2)
print(result)

Example – LRU Page Replacement

from logorythem import page_replacement

reference = [7, 0, 1, 2, 0, 3, 0, 4, 2, 3]
faults = page_replacement.lru(reference, frames=3)
print("Total Page Faults:", faults)

Why Use LOGORYTHEM?

Feature Description
Modular Each algorithm is a standalone function
Educational Ideal for learning OS concepts like CPU scheduling and memory management
Lightweight Simple design, minimal dependencies
Extensible Easy to add or modify algorithms

Project Structure

logorythem/
├── src/
│   ├── page_replacement/
│   │   ├── __init__.py
│   │   ├── fifo.py
│   │   ├── lru.py
│   │   └── opt.py
│   ├── scheduling/
│   │   ├── __init__.py
│   │   ├── fcfs.py
│   │   ├── round_robin.py
│   │   ├── sjf_non_preemptive.py
│   │   └── sjf_preemptive.py
├── LICENSE
├── pyproject.toml
└── README.md


License

Licensed under the MIT License. You are free to use, modify, and distribute this project for learning and research purposes.


Author

Ammaar Abdul Rehman Bakshi Diploma in Computer Engineering Anjuman-e-Islam Abdul Razzak Kalsekar Polytechnic LinkedIn: linkedin.com/in/ammaar-ic


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logorythem-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logorythem-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file logorythem-0.1.1.tar.gz.

File metadata

  • Download URL: logorythem-0.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for logorythem-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4786610e14d0457a11c10edb23c2ce1804e7999e141e6a8867a872c57159304
MD5 c8800c87c8b4cc818db9bc908df2640f
BLAKE2b-256 ebf8524ce3b51da150141111b816901c628d7ce84ca2b0ebeb1729052ba720f0

See more details on using hashes here.

File details

Details for the file logorythem-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logorythem-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for logorythem-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90d064a7ec6ca6341431f7e44a7b29e5a9fbdd795ced10499b98ef7b2f395739
MD5 e49ca5e538bee138df7410bd87e606a9
BLAKE2b-256 5cc6b8c916aa5a589a78349b488f82137b97b1570154d40761f6839c08ee518f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page