The document contains questions about basic Unix commands, shell programming, system calls related to process and file management, and CPU scheduling algorithms. It asks to write programs to perform tasks like copying files, reading input, creating processes, and implementing scheduling algorithms like FCFS, SJF, RR and priority scheduling.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views2 pages
OS Lab Test 1 QP
The document contains questions about basic Unix commands, shell programming, system calls related to process and file management, and CPU scheduling algorithms. It asks to write programs to perform tasks like copying files, reading input, creating processes, and implementing scheduling algorithms like FCFS, SJF, RR and priority scheduling.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Q1.
Basic Unix commands and shell programming:
(2 marks each) 1. What commands would you type to do the following? (Test them out on your workstation.) a. Create a new subdirectory named step14. (2) b. Copy a file from your home directory into step14. (2) c. Rename the subdirectory step14 to delete_me. (2) d. Delete the subdirectory. (This step requires multiple commands.) (2) 2. What hidden directories and files exist in your home directory? (2) 3. Write a command to list all the links from a directory? (2) 4. Create a read-only file in your home directory? (2) 5. In a file word UNIX is appearing many times? How will you count number? (2) 6. Write a command which lists all files in your home directory whose name starts with a dot (“.”) and contain at least two other characters. (2) (5 marks each) 1. Program for simulation of cd, ls, mkdir, pwd Unix commands 2. Compare three list of arrays and write the common elements of all the three arrays: 3. a=(3 5 8 10 6),b=(6 5 4 12),c=(14 7 5 7) result is the common element 5. 4. Write a function called ENGLISH_CALC which can process sentences such as: 5. '3 plus 5', '5 minus 1' or '4 times 6' and print the results as: '3 + 5 = 8', '5 - 1 = 4' or '4 * 6 = 24' respectively. 6. Write a shell to loop through and print out all even numbers from the numbers list in the same order they are received. Don't print any numbers that come after 237 in the sequence. Q2. System calls in Process management and File management: (4+4) (4 marks each) 1. Write a program using open() system call to copy the contents of one file into another file. 2. Write a program to read a maximum of 15 characters from the user and print them on the screen. 3. Write a program to print the count of characters read by the read() system call. (4 marks each) 1. Write a program using fork() system call to create a hierarchy of 3 process such that P2 is the child of P1 and P1 is the child of P. 2. Create a parent-child relationship between two processes. The parent should print two statements: A) Parent (P) is having ID <PID> B) ID of P’s Child is <PID_of_Child> The child should print two statements: C) Child is having ID <PID> D) My Parent ID is <PID_of_Parent> Make use of wait() in such a manner that the order of the four statements A, B, C and D is: A C D B You are free to use any other relevant statement/printf as you desire and their order of execution does not matter. 3. Write a program to create two child process. The parent process should wait for both the child to finish. 4. Create a parent-child relationship between two processes such that the Child process creates a file named Relation.txt and the Parent process write some content into it by taking the input from the user. (OR) Q2. CPU Scheduling: (8 marks each) Write a C program for implementation of the following scheduling algorithms: FCFS (non-preemptive) SJF (non-preemptive) RR (Preemptive) Priority (preemptive&non-preemptive)