Postagens

Assignment 3 - 2022

  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. tip: Do you know what is a file in sysfs? It just exports some information from the kernel. In order to create "show_blocked",  you do not have to create any additional data structure (such as an array) inside the kernel. You will have to look for the pid of all blocked processes looking some data structure that already exists. Notice that when you have many "read_test" processes waiting for a char, when one char arrives from keyboard, all processes are put to run. Change this behavior, and give one char to just one process, keeping all others blocked. Team 2: systemtap: I/O monitoring You are not using Shibata's work. systemtap is a script language deve

Assignments-1 2022

Imagem
My Operating System course has, generally, 4 to 5 assignments corresponding to each chapter of the book: " Operating Systems Design and Implementation, Third Edition ", i.e., 1. Introduction, 2. Processes, 3. Input and Output, 4. Memory and 5. File Systems. For the first assignment, I ask students to implement a simple system call. Generally, I divide the class into 10 teams which are given 10 different tasks. General Instructions to the First Assignment A system call makes a software interrupt. All teams must install docker and Shibata's work, visualize the switch from user to kernel mode following:  http://linux-kernel-lab.blogspot.com.br/2018/04/arm-linux-kernel-on-docker-image-with.html http://linux-kernel-lab.blogspot.com.br/2018/04/first-run.html http://linux-kernel-lab.blogspot.com.br/2018/04/first-init.html http://linux-kernel-lab.blogspot.com.br/2018/04/rebuilding-new-docker-image.html http://linux-kernel-lab.blogspot.com.br/2018/04/creating-new-te

Assignment 4 - 2021

  Team 1: page fault on calloc  Using phase 4 of Shibata's team , write a program that continually gets memory (calloc) and writes on a structure, creating a circular linked list (where each cell is in this structure), i.e., a cell (this structure) must point to the former one and to the next one. Make sure you write on the data structure in order to force a major page fault. Explain how virtual memory was allocated by /proc/$PID/maps (the process may be blocked by a getchar). Did the calloc took memory from heap or from stack? 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 much memory did your process get? Make sure the swap area is very large, greater than 4GB. You may experiment getting little or big chunks of memory using calloc. Does it change how much memory your process get? Team 2: shared memory Using phase 4 of Shibata's team , implement a program that creates a shared memory greater than the

Assignments 2 - 2022

Imagem
  Phase 2 All teams, please study:  https://linux-kernel-lab.blogspot.com/2018/06/block-and-unblock-process-assignment.html Team 1 - process hierachy Study: -V52: https://www.youtube.com/watch?v=tSnT9SYAb9A 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. Study the Linux kernel code in order to understand what happens when a child process has his father killed. Team 2 - signal Study the following code: #include<stdio.h> #include<signal.h> void bypass_sigint(int sig_no) {   printf("divide by zero\n"); } int main() {   int a,b,c;     struct sigaction sa;     memset(&sa, 0, sizeof(sa));     sa.sa_handler = &bypass_sigint;    

Assignments 2- 2021

Imagem
Phase 2 All teams, please study:  https://linux-kernel-lab.blogspot.com/2018/06/block-and-unblock-process-assignment.html Team 1 - process hierachy Study: -V52: https://www.youtube.com/watch?v=tSnT9SYAb9A 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 - signal Study the following code: #include<stdio.h> #include<signal.h> void bypass_sigint(int sig_no) {   printf("divide by zero\n"); } int main() {   int a,b,c;     struct sigaction sa;     memset(&sa, 0, sizeof(sa));     sa.sa_handler = &bypass_sigint;     sigaction(SIGFPE, &sa,NULL);     while (1) {       sleep(1);         printf("do nothing \n &quo

Assignment 4 - 2020

Team 1: page fault on calloc Using phase 4 of Shibata's team , write a program that continually gets memory (calloc) and writes on a structure, creating a circular linked list (where each cell is in this structure), i.e., a cell (this structure) must point to the former one and to the next one. Make sure you write on the data structure in order to force a major page fault. Explain how virtual memory was allocated by /proc/$PID/maps (the process may be blocked by a getchar). Did the calloc took memory from heap or from stack? 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 much memory did your process get? Make sure the swap area is very large, greater than 4GB. You may experiment getting little or big chunks of memory using calloc. Does it change how much memory your process get? Team 2: shared memory Using phase 4 of Shibata's team , implement a program that creates a shared memory greater tha