Blocking device

Here goes the third assignment from 2017, Shibata' s team. It creates a blocking device.
https://drive.google.com/file/d/0ByqqM2mCIz0jN1BBTjI5QW1tSTBnNDItRVN6dlluX3pzckU0/view?usp=sharing
The objective is to create a blocking device: the device with major number 10. See: https://github.com/tiagoshibata/linux/blob/086a4c6b4c1976befcb1b89900dedd0830abc80d/sys_blocking_dev/sys_blocking_dev.c
When a process reads the device 10, its driver will pass some data or it will block the process in case of no data available.
We are going to put data on the device 10 through a system call.
Shibata's team created the system call "write device" which writes data do the device. A process may be unblocked when a write is performed.
In order to test their work, they inserted busybox which provided a simple shell.
In this work, we have to compile linux kernel with DEVTMPFS support. It is done by inserting CONFIG_DEVTMPFS=y in ~/Downloads/pcs3746-sistemas-operacionais/1/linux/.config

More precisely do (diff notation):
< CONFIG_DEVTMPFS=y
< CONFIG_DEVTMPFS_MOUNT=y
---

> # CONFIG_DEVTMPFS is not set

Run as:
~/Downloads/pcs3746-sistemas-operacionais/1$ docker run -ti --rm -v "$PWD/linux":/home/student/src/linux -v "$PWD/../3/initramfs":/home/student/src/initramfs tiagoshibata/pcs3746


They created "read_test" - a process that continually reads the blocking device and "write_test" a process that continually provides random data to the device when typing "e". You may test as:

/ # read_test &
/ # write_test 
e
Writing 67
Read item: 67
e
Writing c6
Read item: c6
e
Writing 69
Read item: 69
e
Writing 73
Read item: 73

e



Comentários

Postagens mais visitadas deste blog

Basics on ARM processor

Assignments - 1

Assignments 2- 2021