CS604 Assignment 1 Spring 2024 – Assignments – Solution VU

CS604 Assignment 1 Spring 2024 – Assignments – Solution VU

 

Please carefully read the following instructions before attempting the assignment.

 

RULES FOR MARKING

It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after the due date.
  • The submitted assignment does not open or the file is corrupt.
  • Strict action will be taken if the submitted solution is copied from any other student or the internet.

 

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.

Secondly, you are required to send Question no. 1 and Question no. 2 in the same screenshot. Furthermore C code of Question no. 1 must also be pasted in the same word file after the screenshot.

 

 

OBJECTIVE

The objective of this assignment is to provide hands-on experience of:

·         The basic concept of Process creation in Linux

·         Useful Linux 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.

 

If you find any mistake or confusion in the assignment (Question statement), please consult with your instructor before the deadline. After the deadline, no queries will be entertained in this regard.

 

For any query, feel free to email at:

[email protected]

 

 

 

 

Questions No 01                                                                              15 marks

Write the C Program in which the parent process will create the child process through fork() system call. You need to perform the following activities in both child and parent processes respectively.

  • In the child process, you need to print the table depending upon the last digit of your VUID. For example in VUID mc125456789, the last digit is 9. So in that case table of 9 should be printed in the child process.
  • In the parent process, you need to print your VUID and name and a simple message like “In parent process”. Secondly, in the parent process call the wait() system call so that the child process can print the required table.

Questions No 02                                                                               05 marks

You are required to print the complete path name of the current working directory. And then create two directories as per your name and your VUID. Finally by using the ‘ls’ command display the list of directories.

In the screenshot you need to perform the following steps.

  • In the screenshot firstly compile the program as given in Question No. 1.
  • Then run the program.
  • As per the Question no. 2 print current working directory then finally create and display required directories.

Following is the sample screenshot for both Question No. 1 and Question No. 2.

Furthermore C code of Question no. 1 must also be pasted in the same word file, after the screenshot.

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 writing and compiling your first program in Linux.

https://vulms.vu.edu.pk/Courses/CS604/Downloads/how%20to%20Write%20and%20run%20program.rar

See the following link for installation of Virtual Box and Ubuntu (LInux) on your system.

https://vulms.vu.edu.pk/Courses/CS604/Downloads/Lab%201_CS604.docx

 

The End

vulearning

#CS604 #Assignment #Spring #Assignments #Query

Leave a Reply

Your email address will not be published. Required fields are marked *