By modifying Linux 0.11 system files, add a simple system call
On Ubuntu20.04.1 virtual machine, using Bochs to run Linux0.11 compiled image files to compile Linux0.11 requires a 32-bit gcc environment, and a simple and feasible environment configuration link is attached: https://gitee.com/cn-guoziyang/oslab
By modifying the Linux 0.11 system file (run with Bochs), the implementation is to add a simple system call. Here is the call nameout.c output "Hello, I'm lwh"
Write the program nameout.c at the user level, open the window to call the system function through the syscall macro, and call the sys_nameout system function. Write the function sys_nameout, which is saved in the linux0.11 system kernel in the file format of name.c; sys_nameout calls printk() to complete the printout. Modify the Makefile file so that the kernel/who.c we add can be compiled and linked to other Linux codes.

Detailed steps: Add the macro definition of iam and whoami system call numbers (_NR_xxxxxx)
File path: /linux-0.11/**include/unistd.h ** 
Modify the total number of system calls file path: /linux-0.11/**kernel/system_call.s ** 
Add system call name to the newly added system call and maintain the system call table file path: /linux-0.11/ include/linux/sys.h

Write code implementation for the newly added system call and create a file name.c file path **: /linux-0.11/kernel**

Write printk("Hello, I'm lwh") in name.c
Modify Makefile
To allow the kernel/who.c we add can be compiled and linked with other Linux code, we must modify the Makefile file
File path: /linux-0.11/kernel/Makefile

Writing a test program
So far, the part that needs to be modified in the kernel has been completed. Next, you need to write a test program to verify whether the newly added system call has been compiled into the linux-0.11 kernel for call
File path:/oslab/namein.c /oslab/nameout.c

/* nameout.c */
#define LIBRARY
#include <unistd.h>
#include <errno.h>
#include <asm/segment.h>
#include <linux/kernel.h>
#include <stdio.h>
_syscall2(int, nameout,char *,name,unsigned int,size);
int main(int argc, char *argv[])
{
char username[64] = {0};
/ Calling system call nameout() /
nameout(username, 24);
printf("%sn", username);
return 0;
}
Using mount method to realize file sharing between the host and the virtual machine operating system, execute the following command in oslab directory to mount the hdc directory to the virtual machine operating system

Compile linux kernel file path: /oslab/linux
Execute the make command in the terminal 
Make Success
Run the Bochs virtual machine file path: /oslab/ terminal to execute the run command 
Add a new call number file path for linux-0.11: /usr/include/unistd.h in the virtual machine (can also be modified in the graphical interface after mounting) 
(If modified in the virtual machine)
(If modified in the graphical interface of the host after mounting)

gcc run successfully outputs case text


Disk scheduling is performed using FIFO (first come first service), SSTF (shortest seek priority), and SCAN (elevator scheduling algorithm)
Show scheduling order, calculate the average number of moving tracks
Write a file tool filetools using filesystem calls to have the following functions:
Create a new file, write a file, read a file, modify file permissions, view the current file permissions, and exit
Use pipelines to implement process communication between parent and child processes
Generate 320 instruction sequences
Convert instruction sequence into page address stream
Calculate the first-in-first-out (FIFO) page permutation algorithm, the most recent and longest-lasting page permutation algorithm, and the hit rate of the optimal (Optimal) page permutation algorithm under different memory page blocks
Use pipelines to implement process communication between parent and child processes
Use message buffer queues to enable communication between client and server processes
Use shared storage to achieve process communication between two processes