Postagens

Assignment 4

Team 1: page fault on malloc Using phase 4 of Shibata's team , write a program that continually gets memory (malloc) and writes on a structure, creating a linked list (where each cell is in this structure), i.e., a cell (this structure) must point to the former one.  After some time, due to virtual memory, data must go to disk in order to free memory to more data through do_swap_page. How does the Linux choose the page to evict? Let the program run freely. What error do you get? Insert a breakpoint closer to the interrupt vector when this error happens. Explain. Obs: observe the effect of differente sizes of the physical memory in qemu. Explain how virtual memory was allocated by /proc/$PID/maps (the process may be blocked by a getchar). Team 2: allocating a physical page frame Using phase 4 of Shibata's team , implement the program "large" that uses 2 times the physical memory (adjust memory size in qemu). This program declares a large vector. For each eleme...

virtual memory - do_swap

The Versatile board running Linux uses virtual memory. When a process is using more and more memory, it must swap old memory to disk in order to free space to the new memory. The same mechanism for virtual memory is also used in memory mapped files. Let us suppose that a large file is mapped into memory. As the memory is being filled, data from memory must be saved in the file. At first, it should be very easy to accomplish this memory swap, so I asked for some students to run a code like that, but they didn't get it.  Then, I asked again in the following year, but they failed too. Next year, I decided to ask for Shibata's team to study it and they managed to see the memory swap. The kernel had to be compiled differently. In order to compile the kernel: In /Downloads/pcs3746-sistemas-operacionais/1/linux create the file .config-fragment containing: CONFIG_DEBUG_INFO=y CONFIG_DEVTMPFS=y CONFIG_PCI=y CONFIG_PCI_VERSATILE=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_PCI=y ...

Assignments 3

Team 1: blocked processes in blocking_device Read and experiment phase 3 work in  http://linux-kernel-lab.blogspot.com/2018/06/blocking-device.html Make the pid of all processes blocked in blocking_device visible in /sys/show_blocked. Test it. You may run "read_test  &" as many times as you wish. Team 2: on release Read and experiment phase 3 work in  http://linux-kernel-lab.blogspot.com/2018/06/blocking-device.html When a user types in the keyboard, he constantly presses and releases key. The normal behavior is to get the character as soon as the key is pressed. If it takes sometime to release, then the key is repeated many times until it is released. Let us change its behavior. Suppress the key repetition when the user doesn't release it.  Get the character when the key is released and not pressed. Team 3: no key repetition Read and experiment phase 3 work in  http://linux-kernel-lab.blogspot.com/2018/06/blocking-device.html Whe...

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/...

block and unblock process: assignment report2

I am sharing the second assignment from Shibata's team / 2017 in https://drive.google.com/file/d/0ByqqM2mCIz0jdzVMMlp4THBUd3hGdFg0TFlCOXdVbHRKek9n/view?usp=sharing In order to run: ~/Downloads/pcs3746-sistemas-operacionais/1$ docker run -ti --rm -v "$PWD/linux":/home/student/src/linux -v "$PWD/../2/initramfs":/home/student/src/initramfs tiagoshibata/pcs3746 They implemented stop_process(pid)  and continue_process(). stop_process(pid): blocks the process pid and inserts in a list Blocked_list continue_process(): make the first process of the Blocked_list ready to run. In order to test, we have 3 processes: grand_parent, parent and child. The parent process get char from the keyboard and may block itself ("b") or the child ("a"). It will unblock using "d". The parent process prints "A" and the child consecutive numbers. Using the keyboard (ex: "a"  followed by enter) you may block or unblock the parent and...

Assignments 2

Team 1 - process hierachy Create the system call pid_father() which returns the pid of the father (see task_struct).  Make init creates one child which creates one grandson. Both init and grandson continually prints "init" and father's pid, however, the child process, exits. What happens to the grandson parent? Study the linux source code and show how the kernel changes the grandson's father.  Team 2 - process switch Last year, Shibatas's team answered the following question: Create 2 system calls: block(pid) blocks the pid process inserting it in a blocked processes queue. error = unblock() which unblock the first process in the blocked queue returning error = 0, or does nothing, and returns error = 1. Test his solution making: - init creates two children. First child continually prints "1" and second child continually prints "2". - init continually blocks first child (you must see a lot of "2"),...

A first assignment report

I am posting the first assignment received by Shibata's team, from last year. It is in Portuguese. Here it goes: https://drive.google.com/file/d/1r_sqC3u2kAfBng7aKyzgZKW8r8uj3-Nq/view?usp=sharing