This report contains the report, presentations, library and kernel source code done in our undergraduate project at IITK. There is also a working demo for the implementation in the directory ugp-demo
.
The work was a joint work with Harshit Bansal.
-
Detailed Weekwise documentation can be found here.
-
UGP Presentation and Report are present in
Report_Presentation
folder.
- Warning: The setup needs to be done on a Linux VM. Use a KVM etc to setup your virtual machine.
Perform these steps inside VM after booting into default kernel.
======================= To build kernel =======================
-
Open terminal.
-
Clone the repository.
$ git clone https://git.cse.iitk.ac.in/jayagupta/ugp-ii
- Install programs needed for kernel compilation (for ubuntu)
$ sudo apt-get update
$ sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
- Enter into linux source code directory
$ cd UGPII/linux-6.1.4/
- Generate configuration file
$ make defconfig
- Initiate compilation (Takes around 30 min to 1 hour to finish)
$ make -j4
- Install modules
$ sudo make modules_install
- Install kernel
$ sudo make install
==================== To show boot menu while booting=======================
-
If during booting, you want to pick a particular kernel to run, do the following operations. (Needs to be done only once)
-
Open grub file. You can use any editor to edit it. Needs sudo permission to edit.
$ sudo vi /etc/default/grub
- Make the following changes in the file
#GRUB_TIMEOUT_STYLE=hidden //Comment this line by adding ’#’ infront of it.
GRUB_TIMEOUT=30 //Change timeout value from 0 to 30 secs. Let boot menu be shown for 30 secs
- Run following command to apply the above changes
$ sudo update-grub
● Reboot
====================== verify the new kernel install====================
Note: You can use the following command to know the kernel version that got booted.
$ uname -a
cd UGP-II/modules
make clean
make
cd UGP-II
make clean
make
- Include the library
migrate.h
in the manager code.
#include "manager.h"
- Inorder to build the program, insert the following in
Makefile
inUGP-II
folder.
manager: $(SOURCE_DIR_NAME)/manager.c
$(CC) $(CFLAGS) -I$(INC) -o $(SOURCE_DIR_NAME)/manager $(SOURCE_DIR_NAME)/manager.c $(LIB_OBJ)/migrate.a
- Inorder to migrate a process P1 with
PID p1
in the global namespace to process P2 withPID p2
, use__migrate(source_pid, target_pid)
. This function will return the new global pid of the migrated process in the new namespace.
-
Build the kernel module.
-
Build the library code and ugp-demo.
cd UGP-II
make
- Launch the
pstree
to setup the process tree and then launch themanager
.
cd UGP-II/ugp-demo
# Terminal 1
sudo ./pstree
# Terminal 2
sudo ./manager <source_pid_of_migrating_process>