0% found this document useful (0 votes)
32 views6 pages

Print Queue Management System Overview

The Print Queue Management System project aims to efficiently manage print requests in shared network environments using a first-come, first-served scheduling policy. It is implemented with a graphical user interface in Visual Studio Code, utilizing C++ and the Simple DirectMedia Layer (SDL) for user interaction. The system successfully processes print requests while ensuring a user-friendly experience, with potential future enhancements suggested for improved functionality.

Uploaded by

karnsingh2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views6 pages

Print Queue Management System Overview

The Print Queue Management System project aims to efficiently manage print requests in shared network environments using a first-come, first-served scheduling policy. It is implemented with a graphical user interface in Visual Studio Code, utilizing C++ and the Simple DirectMedia Layer (SDL) for user interaction. The system successfully processes print requests while ensuring a user-friendly experience, with potential future enhancements suggested for improved functionality.

Uploaded by

karnsingh2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Project Report: Print Queue Management System

Project Title: Print Queue Management System

Team Members:

1. Himanshu Kumarsambhav (22BCG10046)

2. Aditya Saraswati(22BCG10163)

3. Karn Singh(22BCG10118)

4. Pratul singh(23BCE10290)

5. Sahil Gupta(22BCE10074)

6. Abhishek Pratap Singh Chauhan(22BCE10219)

Introduction

In shared network environments, managing print requests efficiently is crucial to ensure fair access
to printing resources. This project focuses on designing and implementing a print queue
management system using a graphical user interface (GUI) and Simple DirectMedia Layer (SDL) in
Visual Studio Code (VSCode). The system ensures that print requests are handled on a first-come,
first-served basis, preventing conflicts and improving user experience.

Objectives

1. Design an algorithm for managing print requests in a networked environment.

2. Implement the algorithm using GUI and SDL in VSCode.

3. Ensure that print requests are processed in a first-come, first-served manner.

4. Provide a user-friendly interface for users to submit and manage their print requests.

Tools and Technologies Used

 Programming Language: C++

 IDE: Visual Studio Code (VSCode)

 Libraries: Simple DirectMedia Layer (SDL), SDL_ttf for text rendering

 Version Control: Git

Algorithm Design

The algorithm for managing the print queue follows a first-come, first-served (FCFS) scheduling
policy. The steps involved in the algorithm are as follows:

1. Initialize Queue: Create an empty queue to store print requests.

2. Add Request: When a user submits a print request, add it to the end of the queue.

3. Process Request: When the printer is available, remove the request from the front of the
queue and send it to the printer.
4. Repeat: Continue processing requests in the order they were received until the queue is
empty.

Pseudocode

python

Copy code

class PrintQueue:

def __init__(self):

[Link] = []

def add_request(self, request):

[Link](request)

print(f"Added request: {request}")

def process_request(self):

if [Link]:

request = [Link](0)

print(f"Processing request: {request}")

else:

print("No requests to process")

print_queue = PrintQueue()

# Simulate adding and processing requests

print_queue.add_request("[Link]")

print_queue.add_request("[Link]")

print_queue.add_request("[Link]")

print_queue.process_request()

print_queue.process_request()

print_queue.process_request()

print_queue.process_request()
Implementation

The implementation involves creating a GUI using SDL to interact with users and manage the print
queue. Users can submit print requests through the GUI, and the system will process them in a FCFS
manner.

Setting Up the Environment

1. Install SDL: Install the SDL library and its dependencies.

2. Configure VSCode: Set up Visual Studio Code with the necessary extensions and
configurations for C++ development.

Code Implementation

Main Program

cpp

Copy code

#include <SDL.h>

#include <SDL_ttf.h>

#include <iostream>

#include <queue>

#include <string>

// Function declarations

void initializeSDL();

void createWindow();

void handleEvents();

void render();

void cleanup();

// Globals

SDL_Window* window = nullptr;

SDL_Renderer* renderer = nullptr;

std::queue<std::string> printQueue;

int main(int argc, char* argv[]) {

initializeSDL();
createWindow();

bool running = true;

while (running) {

handleEvents();

render();

SDL_Delay(100); // Delay to limit CPU usage

cleanup();

return 0;

void initializeSDL() {

if (SDL_Init(SDL_INIT_VIDEO) < 0) {

std::cerr << "SDL could not initialize! SDL_Error: " << SDL_GetError() << std::endl;

exit(1);

if (TTF_Init() == -1) {

std::cerr << "SDL_ttf could not initialize! SDL_ttf Error: " << TTF_GetError() << std::endl;

exit(1);

void createWindow() {

window = SDL_CreateWindow("Print Queue Management", SDL_WINDOWPOS_UNDEFINED,


SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);

if (!window) {

std::cerr << "Window could not be created! SDL_Error: " << SDL_GetError() << std::endl;

exit(1);
}

renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

if (!renderer) {

std::cerr << "Renderer could not be created! SDL_Error: " << SDL_GetError() << std::endl;

exit(1);

void handleEvents() {

SDL_Event e;

while (SDL_PollEvent(&e) != 0) {

if ([Link] == SDL_QUIT) {

exit(0);

} else if ([Link] == SDL_KEYDOWN) {

switch ([Link]) {

case SDLK_a:

[Link]("[Link]");

std::cout << "Added request: [Link]" << std::endl;

break;

case SDLK_p:

if (![Link]()) {

std::string request = [Link]();

[Link]();

std::cout << "Processing request: " << request << std::endl;

} else {

std::cout << "No requests to process" << std::endl;

break;

}
}

void render() {

SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);

SDL_RenderClear(renderer);

// Rendering code here

SDL_RenderPresent(renderer);

void cleanup() {

SDL_DestroyRenderer(renderer);

SDL_DestroyWindow(window);

TTF_Quit();

SDL_Quit();

Adding GUI Elements

To enhance user interaction, we can add buttons and text fields for submitting and viewing print
requests. This involves using SDL_ttf for rendering text and handling mouse events for button clicks.

Testing

The system was tested to ensure it correctly handles multiple print requests and processes them in
the correct order. Test cases included adding multiple requests, processing requests, and handling an
empty queue.

Conclusion

The Print Queue Management System successfully demonstrates the use of a FCFS scheduling policy
in a networked environment. The implementation using GUI and SDL in VSCode provides a user-
friendly interface for managing print requests. Future enhancements could include more advanced
features such as prioritization, user authentication, and detailed request tracking.

References

1. SDL Documentation

2. SDL_ttf Documentation

3. C++ Standard Library

You might also like