Fifo and Lifo Queue Simulator
Fifo and Lifo Queue Simulator
Fifo and Lifo Queue Simulator
SIMULATOR
BEng (Hons) Software Engineering Top-up
Module: Advanced operating system
Date of submission – 21/08/2024
Word Count - 968
1
1. Project Overview
In this project, a bash scripting-based command-line interface (CLI) system is to be created. The
main goal here is to develop a fundamental level of simulation capability that will permit the user
to authenticate and administer simulation data and perform FIFO and LIFO simulations. The idea
of breaking the project into scripts is beautiful, as each script is responsible for certain
functionality therefore the system is rather flexible, and the changes can be easily introduced.
Table of Contents
1. Project Overview
………………………………………………………………………………………2
2. Introduction
…………………………………………………………………………………………….3
3. User Management
…………………………………………………………………………………….4
4. Main Menu
……………………………………………………………………………………………...
6
5. FIFO and LIFO ..
……………………………………………………………………………………..…7
6. Conclusion
………………………………………………………………………………………….
….9
7. Reference
………………………………………………………………………………………………
.9
2
2. Introduction
This project embodies a basic and easy-to-understand line command-based system that has all
functionalities involved for the management of users and simulation data along with the
simulations based on FIFO and LIFO. The system is implemented utilizing bash scripting to
supervise tasks that ought to be conducted to manage a small-scale simulation environment.
The basic functionalities that can be considered to be the foundation of this project are user
authentication, an admin panel for managing users, loading/simulation data, and FIFO and LIFO
simulations. All of these are written in bash scripts that are independent of each other such that
one can be run without the rest.
Authenticate Users: Input controls: Pay attention to ensuring that the system’s usage is restricted
to the rightful abilities.
Manage Users: Allow grant to make changes such as: creating new accounts, removing accounts,
and/or making changes to the user’s account.
Load/Create Simulation Data: Offer the facility to either get back details that were created by
simulations at some other time or create details by simulations as the case is required.
Simulate Data Processing: Use the processes of FIFO and LIFO data structures to mimic how
data could be in various situations.
Log and Analyze System Usage: This is important so that the usage of the system can be
evaluated and monitored, especially in terms of the interactions of the user.
This project is a good example of using basic techniques of bash scripting showing the
relationship between the various scripts where the system is made of. The scripts are
intentionally non-procedural, easy, and easy to write, with no addition of UI or any other extra
overhead and making use of habitually used commands like using ls for file manipulation, input
from the user, and so on. Through this project, one can learn the concept of process management,
3
how a website user is authenticated, or even simulate data structures on basic levels.
In sum, this project brings a first approach on the Bash Scripting application on a Linux setup,
giving a practical approach to how Bash script can be used for managing and updating tasks on a
Linux system through a project like this.
3. User Management
An admin manages user management functionality shell script. This script allows the
admin to perform create, delete, and update users. Username, password, and PIN (Text
file with the user details stored such as UPP ) db.
Create Users: This script asks the administrator for a username, password, and
SECURITY CODE. This validates the input to have a username and password with 5
alphanumeric characters and a PIN as a 3 digit. Having indicated all of the above details,
they add more information on their UPPs. db file.
Delete Users: The administrator can delete a user: (enter username and pin) The script
will confirm before removing the targets and also delete from UPP entry. db file.
Password Updates: Admin and users are both able to update the password after PIN
verification The script checks if the new password is written twice before changing to
UPP. db file.
User Login
The login. Find the section where this shell script handles user authentication. The user is then
asked to provide their username and password, which UPP verifies. db file. If credentials are OK,
then only the user goes to the main screen.
4
5
4. Main Menu
The menu. sh script mainly shows the interface where the user can choose to fake the FIFO or
the LIFO queues or to leave the system. When an option is chosen, the simulation script of the
chosen option is fifo_simulation.sh or lifo_simulation.sh is run. Upon the completion of the
simulation, the user will be directed to the main menu.
6
5. FIFO and LIFO Simulations
The FIFO and LIFO simulations are handled by separate scripts: The FIFO and LIFO
simulations are handled by separate scripts:
FIFO Simulation: The fifo_simulation. It is a script that initiates and executes a preprogrammed
list of data on a first-in/first-out basis. A FIFO process takes data in the queue and processes it,
starting with the first data that was input to the queue.
7
LIFO Simulation: The lifo_simulation. As the name suggests each sh script, it processes the same
queue of data on a last-in-first-out basis. It operates on the queue on the last in first out LIFO
basis; that is, it processes the last items that are added to the queue first.
Activity Logging
This script tracks the username and what type of action is being performed ( login, simulation)
with a timestamp in a based Usage file. db. These can help to create user activity or system
usage-based reporting.
8
Additional Admin Features
For other additional features e.g. for administrative to generate a report on the User activity:
Total Time user logs in: Admin server can request the total amount of time a User logged into the
System. Knowing the Top Simulator Used: Here admin can gather info like the top simulator
used by individual users and in general. User Ranking- You get a list of users in Leather who use
the most their library piece, not your system.
5. Conclusion
A set of scripts that satisfy the LOB for basic users authenticated user management and
simple logger queue simulator. The system is meant to be user-friendly while providing
some security in that only those provided with a password can access the simulations and
9
manage users. Use different scripts for a new script based on the functionalities, this
makes your work and code modular & easier to manage.
6. Reference
Cooper, M., 2008. Bash Guide for Beginners. Available at:
https://tldp.org/LDP/Bash-Beginners-Guide/html/ [Accessed 20 August 2024].
The Linux Documentation Project, 2024. Shell Scripting Tutorial. Available at:
https://linuxcommand.org/lc3_writing_shell_scripts.php [Accessed 20 August
2024].
Bailey, J., 2019. Managing Users with Bash Scripts. Available at:
https://www.digitalocean.com/community/tutorials [Accessed 20 August
2024].
Jang, M., 2017. Writing and Reading Files in Bash. Available at:
https://opensource.com/article/19/12/getting-started-bash [Accessed 20
August 2024].
10
11