Spring 2023 - CS604 - 1
Spring 2023 - CS604 - 1
Please carefully read the following instructions before attempting the assignment.
You should consult the recommended books to clarify your concepts as handouts are not
sufficient.
Assignment Submission:
You are supposed to submit your assignment in Doc or Docx format.
Any other formats like scan images, PDF, zip, rar, ppt, and BMP, etc will not be accepted.
You are required to send the screenshot and C code of Question no. 1 in the same word file.
Furthermore, Linux commands of Question no. 2 should also be pasted in the same Word file.
Assignment No. 1 covers 1-13 Lectures.
OBJECTIVE
The objective of this assignment is to provide hands-on experience in the:
Inter-Process Communication through pipe System call
Linux File/Directory management commands.
System calls and their usage in Linux
NOTE
No assignment will be accepted after the due date via email in any case (whether it is the case of
load shedding or internet malfunctioning etc.). Hence refrain from uploading assignments in the
last hour of the deadline. It is recommended to upload the solution file at least two days before
its closing date.
Please consult with your instructor before the deadline if you find any mistake or confusion in
assignment (Question statement). After the deadline, no queries will be entertained in this
regard.
You are required to create the C program for Inter-process Communication between the
parent and child process. Following are the functionalities to be carried out by your C
program.
Firstly, parent process creates the pipe through pipe() system call and then creates the
child process through fork() system call.
In the child code it gets its own process id through getpid() system call and then write
it to pipe through write() system call.
In the parent code:
a) The parent process read the process Id of child through read() system call and
then parent process prints the process id of child.
b) Finally, parent process gets and prints its own process id through getpid()
system call and printf() function.
In the following table write the Linux command for the given details.
Detail. Linux Command
Command to list the contents of current
working directory.
Command to change the current working
directory.
Command used to search for a pattern in a
file or files.
Command is used to display the contents of
a file. It can also be used to display the
entire contents of a file or a portion of the
contents, depending on the options used.
Command is used to remove a file or
directory.
Note: in case you have installed the Virtual Box you can take the screenshot as follows. Go
to the view menu and click on Take Screenshot as follow.
See the following link for the installation of Virtual Box and Ubuntu (Linux) on your system.
https://vulms.vu.edu.pk/CourseResources/OpenFile.aspx?
File=tutorial_for_installing_virtualbox_and_ubuntu.mp4
See the following link installing gcc and compiling and runnings your first program in Linux.
https://vulms.vu.edu.pk/CourseResources/OpenFile.aspx?File=How%20to%20install%20gcc
%20on%20Ubuntu%20and%20compile%20a%20C%20program.mp4
The EnD