23CSE214 - OS Mid Lab Evalution (27.02.27) - v1
23CSE214 - OS Mid Lab Evalution (27.02.27) - v1
Instructions:
1. Each student will be assigned one 7-mark question and one 8-mark question,
totalling 15 marks for the mid-term exam.
2. Students must include the Aim, Algorithm, Code, Output, and Result for each
program.
3. All programs must be written in C language and executed in a UNIX/Linux
environment.
Questions:
System Calls:
o Write a C program in UNIX that creates a child process using the fork()
system call.
o The parent process should print its Process ID (PID), and the child process
should print its own PID along with its parent’s PID.
o Write a C program that demonstrates the exec() system call by replacing the
current process with the /bin/ls command to list files in the current directory.
o Ensure proper error handling if exec() fails.
o Write a C program where the parent process creates a child process using
fork().
o The parent should wait for the child to exit and then print the child’s exit
status using wait() and WEXITSTATUS().
The program should take number of processes, their burst time, and a time
quantum as input. It should display the completion time, turnaround time,
and waiting time for each process using time-sharing.
Thread Programming:
Write a C program that creates a thread to add two numbers and print the result.
The main function should pass two numbers to the thread, which will perform
the addition and display the sum.