Skip to content

samit-gupta/smart-task-scheduler-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

🚀 Smart Task Scheduler (Java)

A scalable, console-based Java task scheduler that demonstrates priority-based scheduling, concurrency control, and performance monitoring using core Java libraries.

This project focuses on systems-level thinking rather than UI, making it suitable for backend, systems, and internship-level interviews.


📌 Overview

The Smart Task Scheduler is designed to manage and execute tasks based on priority and deadlines.
It simulates how real-world schedulers handle multiple jobs efficiently while balancing throughput, latency, and resource utilization.

The project emphasizes:

  • Scheduling algorithms
  • Java concurrency
  • Performance metrics
  • Clean system design

✨ Key Features

🧠 Priority-Based Scheduling

  • Tasks are assigned priorities (e.g., HIGH, MEDIUM, LOW)
  • Higher-priority tasks are executed before lower-priority ones
  • Internally uses a PriorityQueue with a custom comparator

⚙️ Concurrent Task Execution

  • Tasks are executed concurrently using a fixed-size thread pool
  • Prevents uncontrolled thread creation
  • Demonstrates real-world resource management

📊 Execution Metrics & Monitoring

For each task:

  • Start time
  • End time
  • Execution duration
  • Execution status (SUCCESS / FAILED)

Aggregate metrics:

  • Average execution time
  • Total tasks executed
  • Scheduler throughput

🛑 Graceful Shutdown

  • Scheduler completes running tasks before shutting down
  • New tasks are safely rejected after shutdown begins
  • Prevents resource leaks and inconsistent states

🧩 System Design

Core Components

  • Task

    • Encapsulates task metadata
    • Stores priority, execution logic, and timing data
  • Scheduler

    • Manages task queue
    • Controls concurrency using thread pools
    • Collects execution metrics
  • Main

    • Demonstrates scheduler usage
    • Submits sample tasks
    • Displays execution logs and metrics

🧪 Scheduling & Performance Insights

  • Priority Scheduling

    • Improves response time for critical tasks
    • Can lead to starvation if not managed carefully
  • Concurrency Trade-offs

    • Larger thread pools increase throughput
    • Smaller pools reduce contention and overhead
  • Throughput vs Latency

    • Optimizing for throughput may increase individual task latency
    • Scheduler design balances both based on workload

These trade-offs are documented and observable through execution logs.


🛠️ Tech Stack

  • Java (Core)
  • Java Collections Framework
  • Java Concurrency Utilities (ExecutorService, PriorityQueue)

No external libraries or frameworks are used.


▶️ How to Run

git clone https://github.com/samit-gupta/smart-task-scheduler-java
javac src/*.java
java src.Main

🎯 Learning Outcomes

  • Gained practical understanding of task scheduling algorithms and their real-world implications
  • Learned to design priority-based systems using core Java data structures
  • Hands-on experience with Java concurrency primitives and thread pool management
  • Implemented execution metrics and monitoring to analyze system performance
  • Improved skills in clean object-oriented design and separation of concerns
  • Developed intuition around throughput vs latency trade-offs in concurrent systems

👤 Author

Samit Gupta
B.Tech Computer Science and Engineering


🏆 Why This Project Matters

This project demonstrates core computer science fundamentals that are directly applicable to backend and systems engineering roles.

Instead of relying on frameworks or UI-heavy implementations, it focuses on:

  • Scheduling theory
  • Concurrency control
  • Performance instrumentation
  • System reliability

These concepts are commonly evaluated in internship and entry-level software engineering interviews, making this project both educational and interview-relevant.

About

Console-based Java application to manage and schedule tasks by priority and deadline

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages