5F8 Os Lab Project
5F8 Os Lab Project
ProjectReporton
STUDENT DATABASE SYSTEM
Submitted for partial fulfilment of the requirements for the award of the degree of
UGC Autonomous
AccreditedbyNBA&NAACA+
Dhulapally,Secunde
rabad-500100 www.smec.ac.in
St.MARTIN'SENGINEERINGCOLLEGE
UGC Autonomous
AccreditedbyNBA&NAACA+
Dhulapally,Secunderabad-500100 www.smec.ac.in
DECLARATION
The satisfaction and euphoria that accompanies the successful completion of any task
would be incomplete without the mention of the people who made it possible and
whose encouragement and guidance have crowded our efforts with success. First and
foremost, we would like to express our deep sense of gratitude and indebtedness to our
College Management for their kind support and permission to use the facilities
available in the Institute.
We especially would like to express our deep sense of gratitude and indebtedness to
Dr. P. SANTOSH KUMAR PATRA, Group Director, St. Martin’s
Engineering College Dhulapally, for permitting us to undertake this project. We wish
to record our profound gratitude to Dr. M. SREENIVAS RAO,
Principal, St. Martin’s Engineering College, for his motivation and encouragement.
We are also thankful to DR.K.SRINIVAS, Head of the Department, Computer
Science And Engineering(AI&ML),St .Martin’s Engineering College, Dhulapally,
Secunderabad, for his support and guidance throughout our
project.Wewouldliketoexpressoursinceregratitudeandindebtednesstoourproject
supervisor MR.K.NAGARAJU ,Assistant Professor, Departmentm of Computer
Science And Engineering(AI&ML), St. Martins Engineering College, Dhulapally, for
his support and guidance throughout our project. Finally, we express
thankstoallthosewhohavehelpedussuccessfullycompletingthisproject.
Furthermore, we would like to thank our family and friends for their moral support
and encouragement. We express thanks to all those who have helped us in
successfully completing the project.
ABSTRACT
5
INTRODUCTION
6
SYSTEMANALYSIS
Objective Definition:
Functional Requirements:
User Interface: Design a user-friendly interface for configuring
simulation parameters, selecting algorithms, and visualizing
results.
Algorithm Implementation: Implement FIFO, LRU, LFU, and
optimal page replacement algorithms.
Simulation Engine: Develop a simulation engine to execute
algorithms on user-defined inputs (memory size, page sequence).
Visualization: Display simulation results through interactive
graphs, histograms, and statistics.
7
Customization: Allow users to customize simulation settings, adjust
algorithm parameters, and experiment with alternative strategies.
NonFunctional Requirements:
ALGORITHM
1. Initialize Student Database:
8
Define the maximum number of students (MAX_STUDENTS).
Declare a structure struct Student with fields for student ID,
name, and GPA.
Declare an array students to store student records.
2. Display Menu:
Create a function displayMenu to print a menu with options for:
Adding a student
Displaying all students
Searching for a student
Exiting the program
3. Add Student:
Create a function addStudent that takes the array of students and the
current student count as parameters.
Check if the current student count is less than MAX_STUDENTS.
If true, prompt the user to enter the student ID, name, and GPA.
Add the new student to the array and increment the student count.
Display a success message if the student is added; otherwise,
indicate that the database is full.
4. Display All Students:
Create a function displayAllStudents that takes the array of students
and the current student count as parameters.
Check if there are students in the database.
If true, loop through the array and print the details of each student
(ID, name, GPA).
9
If false, display a message indicating an empty database.
5. Search for a Student:
Create a function searchStudent that takes the array of students, the
current student count, and the search ID as parameters. Loop
through the array to find a student with a matching ID. If found,
display the details of the student; otherwise, indicate that the student
was not found.
6.Save Data to File:
Create a function saveDataToFile that takes the array of students
and the current student count as parameters.
Open a binary file ("students.dat") for writing.
Write the student records to the file. Close
the file.
7.Load Data from File:
Create a function loadDataFromFile that takes the array of students
and a pointer to the current student count as parameters.
Open the binary file ("students.dat") for reading.
Read student records from the file into the array.
Close the file.
8.Main Function:
Declare variables for the menu choice, search ID, and loop control.
Initialize the array of students and the student count.
Load data from the file on program start.
10
Implement a do-while loop to display the menu, get the user's
choice, and execute the corresponding function.
Continue looping until the user chooses to exit.
Save data to the file before exiting.
9.End Algorithm.
11
SOURCE CODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Define the maximum number of students
#define MAX_STUDENTS 50
// Structure to represent a student
struct Student { int id; char
name[50];
float gpa;
};
// Function to display the menu void
displayMenu() {
printf("\nStudent Database System\n");
printf("1. Add Student\n"); printf("2.
Display All Students\n"); printf("3.
Search for a Student\n"); printf("4.
Exit\n"); printf("Enter your choice: ");
}
// Function to add a student to the database
void addStudent(struct Student students[], int *studentCount)
{ if (*studentCount < MAX_STUDENTS) { struct Student
newStudent;
printf("Enter Student ID: ");
scanf("%d", &newStudent.id);
printf("Enter Student Name: "); scanf(" %
[^\n]s", newStudent.name); printf("Enter
GPA: "); scanf("%f",
&newStudent.gpa); students[*studentCount]
= newStudent;
1
0
(*studentCount)++; printf("Student
added successfully.\n"); } else {
printf("Database is full. Cannot add more students.\n"); } }
// Function to display all students
void displayAllStudents(struct Student students[], int studentCount) {
if (studentCount > 0) { printf("\nStudent Database:\n"); for (int i =
0; i < studentCount; i++) {
printf("ID: %d, Name: %s, GPA: %.2f\n", students[i].id,
students[i].name, students[i].gpa);
} }
else {
printf("No students in the database.\n");
}
}
// Function to search for a student by ID
void searchStudent(struct Student students[], int studentCount, int
searchID) { int found = 0; for (int i = 0; i < studentCount; i++) { if
(students[i].id == searchID) { printf("\nStudent found:\n");
printf("ID: %d, Name: %s, GPA: %.2f\n", students[i].id,
students[i].name, students[i].gpa); found = 1; break;
} } if (!found) printf("\
nStudent not found.\n");
}
// Function to save student data to a file
void saveDataToFile(struct Student students[], int studentCount)
{ FILE *file = fopen("students.dat", "wb"); if (file != NULL) {
fwrite(students, sizeof(struct Student), studentCount, file);
fclose(file); } else { printf("Error
opening file for writing.\n");
}
}
// Function to load student data from a file
1
1
void loadDataFromFile(struct Student students[], int *studentCount) {
FILE *file = fopen("students.dat", "rb"); if (file != NULL) {
fread(students, sizeof(struct Student), MAX_STUDENTS,
file); fclose(file); } else { printf("No previous data found.\n");
}
} int main()
{
struct Student students[MAX_STUDENTS];
int studentCount = 0;
// Load data from file on program start
loadDataFromFile(students, &studentCount);
int choice; do { displayMenu();
scanf("%d", &choice); switch (choice)
{ case 1:
addStudent(students, &studentCount); break; case
2: displayAllStudents(students, studentCount);
break; case 3:
printf("Enter Student ID to search: "); int
searchID; scanf("%d",
&searchID); searchStudent(students, studentCount,
searchID); break;
case 4:
// Save data to file before exiting
saveDataToFile(students, studentCount);
printf("Exiting the program.\n")
1
2
}
1
3
SYSTEMTESTING
System testing for the Page Replacement Algorithm Simulator involves verifying
that the software meets its requirements, functions as expected, and delivers
accurate results. Below are different types of tests that can be performed:
Unit Testing:
Test individual components and modules of the simulator, such as the
implementation of each page replacement algorithm, simulation engine, and
visualization tools.
Verify that each unit behaves correctly and produces the expected output for
various inputs.
Use testing frameworks like JUnit (for Java) or pytest (for Python) to automate unit
tests.
Integration Testing:
Test the interaction and integration between different modules of the simulator.
Ensure that components work together seamlessly, including the user interface,
algorithm implementations, simulation engine, and visualization tools.
Verify that data is passed correctly between modules and that communication flows
smoothly.
Functional Testing:
Validate that the simulator fulfills its functional requirements as outlined in the
system analysis.
Test various aspects of the user interface, including parameter configuration,
algorithm selection, simulation execution, and result visualization.
Verify that the simulator accurately simulates page replacement algorithms and
produces correct results for different input scenarios.
Performance Testing:
Assess the performance and efficiency of the simulator under different workloads
and input sizes.
4
Measure simulation execution time, memory usage, and resource consumption for
large datasets and complex scenarios.
15 Usability Testing:
Evaluate the user experience and usability of the simulator from the perspective of
end-users.
Conduct usability tests to assess the intuitiveness of the user interface, ease of
navigation, and clarity of instructions.
Gather feedback from users to identify areas for improvement and refinement.
Compatibility Testing:
Test the simulator on different operating systems, browsers (if web-based), or
platforms to ensure compatibility.
Verify that the simulator functions correctly across various environments and
configurations.
Address any compatibility issues or platform-specific bugs that arise during testing.
Regression Testing:
Continuously perform regression testing to ensure that new features or bug fixes do
not introduce unintended changes or break existing functionality.
Re-run previous test cases and verify that the simulator behaves consistently and
maintains its functionality across software updates.
By conducting thorough system testing across these different areas, the Page
Replacement Algorithm Simulator can be validated to meet its requirements,
deliver accurate results, and provide a reliable and user-friendly experience.
5
OUTPUT
6
7
SYSTEM REQUIREMENTS
8
Software Requirements:
Compatibility with different operating system (Windows, Linux, MacOS).
A graphical user interface(GUI) to facilitate input and output. Support for
different page sizes and frame sizes. Option to simulate Belady’s anomaly.
Option to save and load simulation scenarios. Performance metrics for
each algorithm.
Web-based Requirements (if applicable)
Ensure compatibility with any additional software dependencies or third-
party tools required for specific functionalities (e.g., database management
systems, simulation libraries).
9
CONCLUSION
User Permissions:
The user running the simulator may require appropriate permissions to install
10
The Student Database System (SDS) presents a pragmatic solution for
educational institutions seeking an efficient and user-friendly approach to
managing student records.
Through a systematic analysis of user requirements, thoughtful design choices,
and comprehensive system testing, SDS has demonstrated its reliability and
functionality.
The system's menu-driven interface facilitates intuitive user interactions, making it
accessible for administrators and staff.
The core functionalities of SDS, including adding students, displaying
comprehensive lists, and searching for specific students, address the essential
needs of student data management. The integration of binary file I/O ensures
data persistence, allowing for seamless transitions between program runs and
enhancing the reliability of the system.
In conclusion, the Student Database System stands as a testament to the
successful integration of simplicity and functionality in student data
management. As educational institutions evolve, SDS provides a strong
foundation for efficient and organized handling of student records,
contributing to the overall effectiveness of administrative processes. The
ongoing commitment to improvement and adaptability positions SDS as a
valuable tool for educational institutions navigating the challenges of student
data management.
FUTURE ENHANCEMENT
11
Future enhancements for the Student Database System (SDS) aim to elevate its
functionality, scalability, and user experience to meet the evolving needs of
educational institutions. Here are potential improvements:
1. Dynamic Data Structures:
Implement dynamic data structures, such as linked lists or trees, to replace the
fixedsize array. This enhancement would allow the system to handle a variable
number of students more efficiently, adapting to the dynamic nature of student
databases in larger institutions.
2. Real-time Collaboration:
Introduce features that enable real-time collaboration, allowing multiple
administrators to work concurrently on the database. This enhancement would
enhance efficiency and streamline administrative tasks, especially in institutions
with a distributed administrative structure.
3. Role-Based Access Control (RBAC):
Enhance security by implementing a Role-Based Access Control system. Assign
different roles to administrators with varying levels of access to functionalities.
For example, distinguish between regular administrators and super-administrators
with broader permissions.
4. Automated Backups and Recovery: Implement an automated backup and
recovery system to safeguard student data.
Regularly scheduled backups and a straightforward recovery process would
minimize the risk of data loss due to unexpected events or system failures.
5. Customizable Reporting Module:
Develop a customizable reporting module that allows administrators to generate
tailored reports based on specific criteria. This could include options for filtering
data, choosing report formats, and exporting reports for further analysis.
25
6. Data Import/Export Functionality:
12
Enable the system to import and export data in standard formats (e.g., CSV, Excel).
This feature would facilitate seamless data exchange with other systems and
simplify the process of migrating data into or out of the SDS.
7. Mobile Accessibility:
Develop a mobile-friendly version or a dedicated mobile application for SDS. This
enhancement would provide administrators with the flexibility to manage student
data on-the-go, enhancing accessibility and responsiveness.
8. Machine Learning Integration:
Explore the integration of machine learning algorithms for predictive analytics.
This could assist administrators in identifying patterns, predicting student
performance trends, and making data-driven decisions to improve overall
educational outcomes.
9. Multilingual Support:
Incorporate multilingual support to make SDS accessible to users from diverse
linguistic backgrounds. This would enhance the system's usability and cater to
educational institutions operating in multilingual environments.
10.REFERENCES
BOOKS:
13
"Operating System Concepts" by Abraham Silberschatz, Peter B. Galvin, and
Greg Gagne.
ONLINERESOURCES:
OperatingSystems:ThreeEasyPieces.
OSDev.org.
MIT OpenCourseWare - Operating System Engineering.
14