0% found this document useful (0 votes)
7 views1 page

OS Lab

The document outlines various UNIX commands and C programs related to file management, process management, and threading. It includes tasks such as creating files, changing permissions, and implementing scheduling algorithms. Additionally, it provides instructions for writing shell scripts to display system information and perform file counts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

OS Lab

The document outlines various UNIX commands and C programs related to file management, process management, and threading. It includes tasks such as creating files, changing permissions, and implementing scheduling algorithms. Additionally, it provides instructions for writing shell scripts to display system information and perform file counts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Unix Commands

1. Write UNIX commands to create a file, display its contents, and append data to it.
2. List all files in long format and redirect the output to a new file named [Link].
3. Write commands to search for a specific word in a file using grep.
4. Demonstrate file permission changes using chmod for read and write access to users.

Process Management System Calls

5. Write a C program to create a child process using fork() and display parent and child
PIDs.
6. Write a program to demonstrate the use of wait() system call for parent–child
synchronization.
7. Write a C program to demonstrate the use of sleep() system call in a child process.
8. Write a program to execute the ls command using execlp() system call.

File Management System Calls

9. Write a C program to create and open a file using open() system call.
10. Write a program to copy contents from one file to another using read() and write().
11. Write a C program to demonstrate file closing using close() system call.

Programs on Pthreads

12. Write a program to create multiple threads using pthread_create() and display thread IDs.
13. Write a program to increment a shared variable using threads and protect it using a mutex.
14. Implement Producer–Consumer problem using pthread condition variables.
15. Write a pthread program to measure execution time of a threaded task.

Programs on Shell Scripts

16. Write a shell script to display system information such as hostname and kernel version.
17. Write a shell script to count number of files in a directory.
18. Write a shell script to display current date, username, and working directory.

Process Scheduling Algorithms

19. Write a program to implement First Come First Serve (FCFS) scheduling algorithm.
20. Write a program to implement Round Robin scheduling algorithm and calculate waiting
time.

You might also like