2.2 Task: Freeze a Few System Calls [40 points] 1. Add a new system call, named \texttt{freeze}, that takes a list of system call numbers, and freezes them. This will stay in effect until next boot/ unfreeze. [For now, we have no syscall to unfreeze. See below.] 2. The list of syscall numbers is given as two arguments: \texttt{argc} a positive integer, \texttt{int syscalls[]} of \texttt{argc} number of non-negative integers. Each integer \texttt{syscalls[i]} is the number of a system call to be (or already) frozen. The \texttt{freeze} syscall should not complain if a syscall is already frozen -- merely ignore it. 3. Examine 5 system programs of your choice, that use one or more of the syscalls frozen as above, and report on their behavior after the freeze.
Added by Matthew B.
Close
Step 1
First, you need to define the system call number for your "freeze" system call. You can choose any unused system call number. Let's say you choose 333 as the system call number for "freeze". Show more…
Show all steps
Your feedback will help us improve your experience
Lien Le and 92 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
C Programming A Program for Performance Evaluation of Signals You will write a simple program called "ring" that creates a ring of N processes that send a signal round and round cnt times. The program is invoked with "./ring N leader cnt" where leader is 0 when you first invoke it. The program works as follows: If the leader parameter is 0, then it knows it is the leader. It then creates (with fork-exec) a child process that has parameters "N-1 leader cnt" where now leader is the PID of the true leader process. The child then will create another child process with parameters "N-2 leader cnt" where now leader is again the PID of the true leader process. The process that eventually is created with N=1 is the last one and it does not create another child. Instead, it sends a SIGUSR1 to the leader to start everything. All the processes suspend themselves waiting for a SIGUSR1 and then send a SIGUSR1 to the next one. At the end of the execution, the leader (only) prints the cnt and the true time elapsed since the beginning of execution as a floating-point number. Also, write a script "ring_time.sh" using a for loop that runs the ring program for N=20 processes and for cnt=10, 100, 1000, and 10000 signals and writes the results in the file "timing.out". The format of the file "timing.out" is the results of one run per line, and each line contains the cnt and the time it took.
Akash M.
Do the Collatz conjecture in C with the following changes: Fork two processes to print their respective sequence for the Collatz conjecture. The first process will produce the sequence which is indicated by the number on the command line. The second process produces the sequence from the common line number plus 4. Print the child, 1 or 2, with each number output and make sure that the forked processes can run concurrently. Additional information: Use the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line. For example, if 8 is passed as a parameter on the command line, the child process will output 8, 4, 2, 1 - because the parent and child processes have their own copies of the data, it will be necessary for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program. Perform necessary error checking to ensure that a positive integer is passed on the command line. The number entered on the command line must be greater than zero and less than 40. Please implement this function code in your file. You'll need to use stdlib.h if you want to use atoi to translate a character string into an integer. Use sprintf to put values into strings. You will need to do wait twice so that the main program finishes after the children (no cascading termination). You will need to use argc and argv to get command line arguments. Additionally, observe whether the processes always finish in the order in which they are forked.
Consider the following complete LC-3 program with 3 bugs: .ORIG x3000 LD R1, N LOOP ADD R1, R1, #-1 BRz DONE ADD R2, R2, R1 BRnzp LOOP DONE ST RESULT HALT N .FILL x000B RESULT .BLKW #1 .END
Supreeta N.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD