Skip to content

himadri75/priority-queue-task-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Smart Task Scheduler

Smart Task Scheduler is a Java-based web application that demonstrates the practical application of Data Structures and Algorithms using a real-world task scheduling problem.
The system intelligently schedules and executes tasks using a Priority Queue with a custom comparator, and is built using Java Servlets deployed on Apache Tomcat.


📌 Project Overview

The Smart Task Scheduler allows users to add tasks with multiple constraints such as priority, deadline, and duration.
Tasks are automatically ordered using a greedy scheduling strategy to ensure optimal execution order.

This project focuses on:

  • Core Java fundamentals
  • Algorithmic problem solving
  • Servlet lifecycle and backend web development
  • Manual deployment on Apache Tomcat

⚙️ Core Features

✅ Task Management

  • Add tasks with:
    • Task Name
    • Priority (1–5 scale, lower value = higher priority)
    • Duration
    • Deadline

✅ Intelligent Scheduling (Algorithm-Based)

Tasks are scheduled using a custom comparator based on:

  1. Priority (Primary criterion)
  2. Deadline (Earlier deadlines first)
  3. Duration (Shorter tasks first)

This ensures efficient and optimal scheduling decisions.

✅ Task Execution

  • Tasks are executed in the correct order by polling from a PriorityQueue
  • Time complexity: O(log n) per insertion/removal

🧠 Algorithm & Data Structure Used

  • Data Structure: PriorityQueue
  • Algorithm Strategy: Greedy Scheduling
  • Comparator Logic: Multi-criteria comparison (Priority → Deadline → Duration)

This demonstrates how DSA concepts can be applied to real backend systems.


🏗️ Architecture

The application follows the MVC (Model-View-Controller) design pattern:

  • Controller Layer
    • Java Servlets handle HTTP requests and responses
  • Service Layer
    • Business logic for task scheduling and execution
  • Model Layer
    • Task entity
  • Utility Layer
    • Custom TaskComparator and helper classes

🌐 Web Layer (Servlets)

  • AddTaskServlet – Add new tasks
  • ViewTasksServlet – View scheduled tasks
  • ExecuteTaskServlet – Execute tasks in optimal order

💾 Persistence Strategy

  • Uses in-memory storage via ServletContext
  • Demonstrates shared application state across multiple HTTP requests
  • No database used (intentional for algorithm-focused design)

🛠️ Technology Stack

  • Java (Core Java, Collections)
  • Java Servlets
  • Apache Tomcat (XAMPP)
  • PriorityQueue & Custom Comparator
  • HTML (basic views)

🚀 Deployment

  • Manually compiled Java classes using javac
  • Deployed on Apache Tomcat via XAMPP
  • Application runs on:
http://localhost:8080/SmartTaskScheduler  

🎯 Learning Outcomes

  • Hands-on experience with Java Servlets and Tomcat
  • Practical use of Data Structures & Algorithms
  • Understanding of servlet lifecycle and application context
  • Experience with manual compilation and deployment
  • Backend problem-solving using greedy strategies

📌 Future Enhancements

  • Database integration (MySQL)
  • Annotation-based servlets
  • WAR file packaging
  • Authentication and session handling

📄 License

This project is for educational and learning purposes.

About

Implemented a greedy task scheduling algorithm using Java PriorityQueue and custom Comparator to manage and execute tasks efficiently based on multiple constraints.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages