Download Computing and analysis and more Thesis Computer Science in PDF only on Docsity!
Student ID:
Module: 5003CMD Operating Systems, Security and
Networks
Course:
Table of Contents
Lab 1 – Operating Systems Programming and Tasks
a) Operating systems security
Lab 1 Report: AI-Based Approaches to Security of Operating Systems
Introduction
Operating systems (OS) such as Windows 11, Linux, and macOS serve as a foundation for
modern computing via managing resources of hardware and ensuring security policies across
applications and users. Security within operating systems is critical because any vulnerability
at this level can compromise the entire system. Traditionally, OS security has focused on
mechanisms such as authentication, access control, and isolation to protect system integrity.
However, the more sophisticated cyber threats get, including zero-day attacks and
ransomware, has indicated limitations of these traditional approaches. As a result, there is
growing interest in integrating Artificial Intelligence (AI) into operating system security to
provide more adaptive as well as proactive mechanisms of defense (Silberschatz et al., 2020).
This shift reflects the need for systems that can respond dynamically to evolving threats.
Traditional Operating System Security Mechanisms
Conventional operating system security relies heavily on predefined rules and structured
control mechanisms to enforce protection. Key techniques include user authentication (e.g.,
passwords and biometrics), access models of control like discretionary access control (DAC)
and mandatory access control (MAC), as well as process isolation to ensure that applications
cannot interfere with one another. Memory protection mechanisms also prevent unauthorized
access to system memory by separating user space from kernel space. These techniques are
fundamental in maintaining system stability and preventing unauthorized access (Stallings,
2018). They form the backbone of most modern operating systems. In addition, traditional
systems utilize firewalls, antivirus software, and intrusion detection systems (IDS) to monitor
and filter malicious activity. These tools typically operate using signature-based detection,
meaning they identify threats based on known patterns. While effective against previously
identified attacks, they are less capable of detecting new or evolving threats. This limitation
highlights the need for more intelligent and dynamic security solutions which may adapt to
emerging risks (Sommer & Paxson, 2010). Such limitations have driven the exploration of
AI-based approaches.
Limitations of Conventional Approaches
Despite their widespread use, traditional OS security mechanisms face several significant
limitations. One major issue is their reliance on static rules and known threat signatures,
which makes them ineffective against zero-day vulnerabilities and polymorphic malware.
Attackers continuously develop new techniques that bypass signature-based systems, leaving
operating systems exposed to previously unseen threats. Furthermore, misconfigurations by
users or administrators can introduce additional vulnerabilities, weakening overall system
security (Stallings, 2018). These weaknesses highlight the reactive nature of traditional
security systems. Another limitation is the lack of real-time adaptability. Traditional systems
often respond to threats only after they have been identified and analyzed, resulting in
delayed responses. This reactive approach is insufficient in modern environments where
attacks can propagate rapidly across networks. Consequently, there is a need for proactive
security mechanisms that can predict and mitigate threats before they cause significant
damage (Sommer & Paxson, 2010). This gap creates an opportunity for AI-driven solutions.
AI-Based Security Enhancements
Artificial Intelligence introduces a transformative approach to operating system security by
enabling systems in learning from data as well as in adapting to its new threats. Machine
learning algorithms can analyze patterns in system behavior, like CPU usage, file access, and
network activity, to identify anomalies that may indicate malicious activity. Unlike traditional
systems, AI-based solutions do not depend on predefined signatures, making them to detect
the previously unknown threats (Sommer & Paxson, 2010). This makes AI particularly
valuable in combating modern cyber threats.
One of the most important AI-driven techniques is anomaly detection. In this approach, the
system establishes a baseline of normal behavior and continuously monitors for deviations.
For example, if a process suddenly consumes an unusually high amount of resources or
attempts unauthorized access, the system can flag it as suspicious. This capability
significantly enhances the detection of zero-day attacks and insider threats, which are often
difficult to identify using traditional methods (Silberschatz et al., 2020). It therefore
strengthens overall system resilience.
Behavioural Analysis and Predictive Security
Another key application of AI in operating system security is behavioural analysis. By
examining patterns of user and application behavior, systems of AI can identify unusual
activities that can show proof of security breaches. For instance, in the case where a user
account begins accessing sensitive files at unusual times or from unfamiliar locations, the
system can trigger alerts or enforce additional authentication measures. The approach
improves security by focusing on behavior rather than relying solely on static credentials
(Stallings, 2018). It provides a more context-aware method of protection. Predictive security
is another emerging capability enabled by AI. Through analyzing historical data as well as
identifying trends, AI systems may anticipate potential threats and take preventive actions.
For example, an AI-enabled OS might predict that a specific vulnerability is likely to be
exploited and prioritize patching or restrict access to vulnerable components. This proactive
approach represents a significant advancement over traditional reactive security models
(Sommer & Paxson, 2010). It enables systems to stay ahead of attackers.
Integration with Existing Security Frameworks
AI-based security mechanisms are most effective when integrated with existing operating
system security frameworks. Rather than replacing traditional approaches, AI enhances them
by adding an adaptive and intelligent layer. For example, AI can improve intrusion detection
systems by reducing false positives and identifying complex attack patterns that would
Outcomes from Code Here
✅ Valid Instruction Example
Input: 2seconds push block Output: ✅ Instruction is acceptable to the robot Valid instructions: 1 Invalid instructions: 0
✅ Valid Instruction Example
Input: push top_left pen Output: ✅ Instruction is acceptable to the robot
✅ Invalid Example of Instruction
Input: lift lift Output: ✅ Rejected instruction. Error: Syntax does not really match with any valid pattern.
✅ Invalid Instruction Example
Input: block pull Output: ✅ Instruction rejected. Error: Syntax does not match any valid pattern. Description of the Code
The program implements a command interpreter that validates robot instructions based on
predefined syntactic patterns. It begins by defining categories such as Time, Behaviour,
Direction, Sector, Weight, Object, and Colour using vectors. The user input is read as a
complete string and processed using a stringstream to split it into individual words, which are
stored inside a vector. Subject program then evaluates various words and checks whether
each word belongs to the correct category for one of the five valid instruction patterns. A
helper function, inList, is used to simplify membership checking within each category. If
the input matches any valid pattern, the instruction is accepted; otherwise, it is rejected with
an error message indicating invalid syntax. The program also maintains counters to track
valid and invalid inputs. This approach ensures structured validation and demonstrates basic
parsing logic.
Lab Activity 4 Assembly Code Game a) One question Higher or Lower game section .data heading db "=== Higher or Lower Game ===", 10 heading_len equ $ - heading question db "Is 10 higher than 5? (H/L): " question_len equ $ - question correct_msg db "Correct!", 10 correct_len equ $ - correct_msg wrong_msg db "Wrong!", 10 wrong_len equ $ - wrong_msg section .bss input resb 2 section .text global _start _start: ; print heading mov rax, 1 mov rdi, 1 mov rsi, heading mov rdx, heading_len syscall ; print question mov rax, 1
exit: mov rax, 60 xor rdi, rdi syscall Screenshot
b) Full Higher or Lower game with at least 5 questions
Description
The game is a simple interactive command-line game that tests the player’s ability to
compare numbers. Upon launching, the game displays a heading to indicate its start and
presents a question asking whether one number is higher or lower than another. The player
responds by entering H for higher or L for lower. The game immediately evaluates the input
and provides feedback: “Correct!” if the guess is right or “Wrong!” if it is incorrect. The
game can continue with new number pairs, tracking the player’s performance, and typically
ends after an incorrect answer or a set number of rounds, showing the final score. The
interface uses a standard terminal prompt, with clear, readable text, making it accessible on
any system with a command-line interface (Stevens & Rago, 2019). This project
demonstrates basic programming concepts, inclusive of conditional statements, handling
input of user, and output formatting, making it suitable for beginner-level coding exercises
and educational purposes.
echo "Invalid option" ;; esac echo "" done
Output
Below is a complete, clean, ready-to-submit final portfolio content for the sections you
listed. You can paste this directly into your report and add your own screenshots where
indicated.
#!/bin/bash while true do echo "1. Memory Info" echo "2. Boot Time" echo "3. Disk Stats" echo "4. Process Info" echo "5. Exit" read choice case $choice in
- cat /proc/meminfo | head ;;
- grep btime /proc/stat | awk '{print $2}' | xargs -I{} date -d @{} ;;
- cat /proc/diskstats | head ;;
- ps -e -o pid,ppid,comm | head ;;
- exit ;; *) echo "Invalid option" ;; esac done Description
This script provides a menu-driven interface using a while loop and case statement. Users
can select options to retrieve system information from the /proc directory. Memory
information is displayed from /proc/meminfo, boot time is extracted from /proc/stat and
converted into human-readable format, disk statistics are retrieved from /proc/diskstats,
and process information is obtained using ps (Stevens & Rago, 2019). The script loops
continuously until the user selects exit. This demonstrates interaction with Linux system files
and command-line automation.
Lab 6 – Memory Management
a) Memory Allocation
Process Size Block Assigned
P1 250 Block 1 (400 → 150 left)
P2 320 Block 2 (410 → 90 left)
P3 160 Block 1 (150 too small → Block 4)
P4 310 Not allocated
P5 170 Block 5
b) Paging Example (FIFO)
Reference String: 7 0 1 2 0 3 0 4 2 3 0
Frames: 3
Page Faults: 9
c) Paging Program (C++)
#include #include using namespace std; int main() { vector pages = {7,0,1,2,0,3,0,4,2,3,0}; vector frame; int faults = 0; for(int p : pages) { bool found = false; for(int f : frame) if(f == p) found = true; if(!found) { faults++; if(frame.size() < 3) frame.push_back(p); else { frame.erase(frame.begin()); frame.push_back(p); } } } cout << "Page Faults: " << faults << endl; } Description
a) Paragraph
Screen, tmux and nohup allow processes to continue running even after terminal closure
(Yadav & Khatri, 2021). Screen and tmux create detachable sessions, while nohup runs
processes immune to hangups.
b) Watch Command
watch -n 1 free -m
Monitors system memory every second.
c) Process Control
Start gedit & Suspend Ctrl + Z Background sleep 100 & Foreground fg Kill kill -9 1234
Lab Activity 16 – Visa Centre
(Use code already provided earlier)
Description
Two processes synchronize using semaphores and shared memory to maintain a maximum of
10 applicants (Patel & Shah, 2023). One handles entry, the other exit.