Activities
Activities
CpE 312
December 8, 2021
Please answer the following questions to be graded and will be added scores in your activities. Please be
serious in answering these questions because some questions might be reuse for your final examinations.
Thanks and All the best!
Part 1.
1. What should happen if the kernel attempts to awaken all processes sleeping on an event, but no
processes are asleep on the event at the time of the wakeup?
2. In the algorithm getblk, if the 'kernel removes a buffer from the free list, it must raise the
processor priority level to block out interrupts before checking the free list. Why?
3. In algorithm brelse, the kernel enqueues the buffer at the head of the free list if the buffer contents
are invalid. If the contents are invalid, should the buffer appear on a hash queue?
4. The C language convention counts array indices from 0. Why do inode numbers start from 1 and
not 0?
5. If a process in algorithm iget when it finds the inode locked in the cache, why must it start the
loop again from the beginning after waking up?
6. Describe an algorithm that take an in-core inode as input and updates the corresponding disk
inode.
7. Create a file and read, write operations using different child process
8. Demonstrate fork(), kill(), sleep() system calls
9. Demonstrate explicit locking and unlocking on a file using lockf()
10. Implement sorting using pipes
11. Demonstrate FIFO’s
12. Implement Message Queues
13. Demonstrate Semaphores
Part 2.
1. Write a shell script to print prime numbers up to a given range using arguments.
2. Write a shell script which a. Converts a decimal number to binary b. Converts an octal number
to hexadecimal.
3. Write a shell script which merge the contents of file1, file2, file3, sort them and display the sorted
output on the screen page by page.
4. Write a shell script to order the file /etc/passwd on GID (primary) and UID (secondary) which
would place all users with same GID together. Users with a lower UID should be placed higher in
the list.
5. Write a script to compute the factorial value with and without using recursive functions.
6. Write a shell script to search given number using binary search using function.
7. Write an awk program which accepts input from the standard input and prints the total of any
column specified as an argument.
8. Write a awk program that reads a file and prints a report that groups employees of the same
department .The following are the contents of the report
a. The department name in the top
b. All detail of the employees
c. Total salary for the department
9. Programs based on filters – cut, grep, tr, sort
a. Write a shell program to compare two strings given by the user character by character.
b. Write a shell program to display files with same size from given directory.
c. Write a shell script to encode and decode contents of file.