0% found this document useful (0 votes)
35 views

Assignment 02

This document contains instructions for Assignment 2 of the Operating Systems course. It includes 3 questions covering Linux commands, I/O system calls, and process management system calls. Students are asked to submit their assignment as a PDF file by the due date and time. Plagiarism will result in lost marks. The assignment can be evaluated through a quiz or viva.

Uploaded by

f2021065216
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Assignment 02

This document contains instructions for Assignment 2 of the Operating Systems course. It includes 3 questions covering Linux commands, I/O system calls, and process management system calls. Students are asked to submit their assignment as a PDF file by the due date and time. Plagiarism will result in lost marks. The assignment can be evaluated through a quiz or viva.

Uploaded by

f2021065216
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

University of Management and Technology

CC3011 - Operating Systems


Fall 2023

Assignment:02
Due Date: Wednesday, November 22, 2023
Submit Assignment on LMS (11:00 AM)
Instructions:
1. Submit a pdf file your ID and name like (ALI ASLAM_F2017065100).
2. Any kind of plagiarism found will result a serious loss in marks. Submit your assignments on
LMS within the given time frame. Emailed Tasks will not be accepted.
3. I can take either quiz or viva for this assignment. Answer must be to the point.

Question 01: Write Linux basic commands to fulfill following operations.

1. Create a new directory called "Class" in your home directory and then create a file
named "your_rollno.txt" inside the "Class" directory and write in the file : “ one line
about yourself”. Show the content of the file "your_ rollno.txt".
2. Create two directories on desktop. Create three files in first directory. Then move all
files from first directory to another directory and delete first directory.
3. Display the name of User.
4. Verify that you are in your home directory. Make the directory “Classes”
5. List the files in the current directory to verify that the directory “Classes” has been made
correctly. Change directories to “Classes”.
6. Clear the window.
7. Create a file named F1. Copy F1 to Home and Rename F1 in Classes to thefile.
8. Remove thefile from the current directory. Verify thefile is removed.
9. Remove the directory Classes from your home directory
10. Lists files and directories of Home with detailed information like permissions, size, etc.

Page 1 of 3
Question 02: I/O System Call

1. Write a program that copies the contents of one file named "source.txt" to another file
named "destination.txt.".
2. Write a program that opens a file named "config.txt" for writing and then writes a line
from the terminal, such as "one line about yourself," to the file.
3. Develop a program that opens a file named "config.txt" for reading. Read and display the
words starting with vowels from the file.
4. Write a program which reads the text from file “News.txt” and checks if phrase
“and” is present in the text. Shows the result on screen using system calls.
5. Write a program which reads the text from file “News.txt” and counts number of
spaces and ‘\n’ in the text. Displays these counts on screen using system calls.

Question 03: Process Management System Calls

1. Write a program using fork( ). The child process displays “ I am a Child , I am Good” whereas
the parent process displays “I am a Parent”. Observe the output of the program by compiling and
running the program multiple times.
2. a. Write a program that contains single fork( ) that shows the process id of parent and child
process. In addition also display the pid returned in child and parent by fork( ) system call.
b. Repeat the same in Task a using two fork( ) system calls.
c. Build the tree hierarchy for Task a, b.
3. Write a program which create 3 child process and every process must print its process id (PID)
and its relationship to parent process. Show what will be the outputs. Also describe a reason.

First Grand
First Grand Grand Child
Parent First Child
Child Second
Grand Child
4. Write a program which creates three direct children of Parent process.
a. Each process must display its process id and name.
b. First child must sleep for 10 sec.
c. Second child must sleep for 5 sec.
d. Third child must sleep for 8 sec.
e. Parent process must wait for the second child. Then it will wait for one more child
to complete its execution.

Page 2 of 3
Good Luck 😎

Page 3 of 3

You might also like