Skip to content

Commit 9fc4150

Browse files
committed
Edit READ ME mark down file
Edit README.md for a complete project introduction.
1 parent 627046f commit 9fc4150

File tree

1 file changed

+58
-4
lines changed

1 file changed

+58
-4
lines changed

README.md

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# simrupt: A device that simulates interrupts
2-
3-
`simrupt` is a simple Linux kernel module to explain the concept of deferred
1+
# KMLdrv: A device driver that performs tic-tac-toe game between kernel threads
2+
## Introduction
3+
`kmldrv` is a simple Linux kernel module which includes the concept of deferred
44
work and kernel concepts as following:
55
- circular buffer
66
- mutex lock
@@ -10,7 +10,61 @@ work and kernel concepts as following:
1010
- workqueue
1111
- kernel thread
1212

13-
It can be also used as a template to implement an IRQ-based device driver.
13+
It can use different machine-learning algorithm and perform tic-tac-toe games between kernel threads. The demo video are in the linke below:
14+
- [Kernel space tic-tac-toe game](https://www.youtube.com/watch?v=Y_xdLrDVGzk)
15+
16+
## Installation & Usage
17+
You can download the source code via the following command
18+
```
19+
$ git clone https://github.com/vax-r/KMLdrv.git
20+
```
21+
After the source code is downloaded, go into the directory and do as the following
22+
```
23+
$ make
24+
make -C /lib/modules/6.5.0-28-generic/build M=/home/vax-r/linux2024/KMLdrv modules
25+
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-28-generic'
26+
warning: the compiler differs from the one used to build the kernel
27+
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
28+
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
29+
CC [M] /home/vax-r/linux2024/KMLdrv/simrupt.o
30+
CC [M] /home/vax-r/linux2024/KMLdrv/game.o
31+
CC [M] /home/vax-r/linux2024/KMLdrv/wyhash.o
32+
CC [M] /home/vax-r/linux2024/KMLdrv/xoroshiro.o
33+
CC [M] /home/vax-r/linux2024/KMLdrv/mcts.o
34+
CC [M] /home/vax-r/linux2024/KMLdrv/negamax.o
35+
CC [M] /home/vax-r/linux2024/KMLdrv/zobrist.o
36+
LD [M] /home/vax-r/linux2024/KMLdrv/kmldrv.o
37+
MODPOST /home/vax-r/linux2024/KMLdrv/Module.symvers
38+
CC [M] /home/vax-r/linux2024/KMLdrv/kmldrv.mod.o
39+
LD [M] /home/vax-r/linux2024/KMLdrv/kmldrv.ko
40+
BTF [M] /home/vax-r/linux2024/KMLdrv/kmldrv.ko
41+
make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-28-generic'
42+
cc -std=gnu99 -Wno-declaration-after-statement -o kmldrv-user kmldrv-user.c
43+
```
44+
Make sure the kernel object file is compiled correctly, then you can insert the kernel module
45+
```
46+
$ sudo insmod kmldrv.ko
47+
```
48+
Now you can enjoy the tic-tac-toe games performed between kernel threads through the following command
49+
```
50+
$ sudo ./kmldrv-user
51+
```
52+
Enjoy the show !
53+
54+
## Features
55+
### User space tool `kmldrv-user`
56+
`kmldrv` provide a interface for userspace program to interact with it, for example you can use the userspace tool `kmldrv-user`. It has the following ability
57+
- Display the status of `kmldrv`, to show whether its loaded or not
58+
- `Ctrl + P` : Stop/Resume the displaying of chess board
59+
- `Ctrl + Q` : Stop the tic-tac-toe games in kernel space
60+
### Machine Learning Algorithms
61+
Currently `kmldrv` supports two machine learning algorithms
62+
- Monte-Carlo Tree Search
63+
- Negamax AI Algorithm
64+
### PRNG support
65+
Currently `kmldrv` utilize two different PRNG (Pseudo-Random Number Generator) to generate random number
66+
- `xoroshift`
67+
- `wyhash`
1468

1569
## License
1670

0 commit comments

Comments
 (0)