---
# System prepended metadata

title: OS Project 2

---

# OS Project 2

### Divided into three parts:

## Part 1: System-call Tracing

- How to run Part 1 found in folder named Part1
  - Simply run make and it should create the .log as well as the .x files
  - Run make clean to remove the .log and .x files
- Collaborators: 
  - John Torres

## Part 2: Kernel Module
- How to run Part 2 found in folder named Part2
  - Run make which will create the mytimer.ko file
  - Run sudo insmod mytimer.ko in order to install the kernel module
    - Optionally run lsmod | grep mytimer to check if it was uploaded correctly
  - Run cat /proc/timer in order to see the current time the first iteration, then the current time with the elapsed time since the last call
  - Lastly you can remove the kernel module using: sudo rmmod mytimer
- Collaborators
  - Implemented Makefile: Wilfredo
  - Implemented elapsedTime function: Ricardo
  - Implemented Kernel Module Init/Exit & ProcRead/ProcOpen: John Torres

## Part 3: Elevator
- How to run Part 3 found in folder name Part3
    - Run sudo make -jn where n is the number of processors in your machine.
    - You will now have an elevator.ko file
        - `sudo insmod elevator.ko`
    - To check if the mod installed correctly use lsmod
    - Run the producer.c and consumer.c files
        - Compile producer.c into an executable file. 
            - `gcc producer.c -o pro.x`
        - Compile the consumer.c into an executable file.
            - `gcc consumer.c -o con.x`
    - Produce passenger with pro.x
        - `./pro.x n` here n represents the number of passengers to be queued
    - Run the con.x file to start
        - `./con.x --start`
    - Run the con.x file to stop
        - `./con.x --stop`
    - Once the user has completed testing simply remove the kernel module.
        - `sudo rmmod elevator`
    - Check if the elevator removed correctly
        - `lsmod`
- Known bugs
    - Having comments in elevator.c causes the elevator to not run properly, no comprehensible reason as to why
    - When we start after stopping the elevator it will skip the current floor that its on and not pick up passengers on that floor immediately but picks them up later.
- Description of code by function can be found in:
    - `function_descriptions.txt`
- Collaborators:
    - John Torres: 
        - `Implemented syscalls`
        - `Kernel Module Init/Exit`
        - `Issue Request Syscall`
        - `Kthread elevator_service`
    -  Wilfredo Huertas:
        -  `Unloading the Elevator`
        -  `Stop Elevator Sys Call`
        - `Print Elevator Function for Proc Read`
        -  `Implemented Proc Functions`
    - Ricardo Lasso de la Vega:
        -  `Start Elevator` 
        -  `Moving Floors Function`
        -  `Load Elevator`
        -  `Scan Algorithm Conception`
-  Used Live Share extension for VS Code to collaborate and contribute to the project.

