2
Assignment No. 01 Semester: Spring 2016 CS604 –Operating System Total Marks: 20 Due Date: 12-05- 2016 Assignment Objective: To give you hand on experience of Ubuntu though VMware To know about system calls like fork, wait, and exec How to work on Ubuntu terminal How to compile a program using gcc compiler and execute a program through terminal Uploading instructions: Your assignment must be in .doc format (Any other formats like scan images, PDF, bmp, etc will not be accepted). Save your assignment with your ID (e.g. bc020200786.doc). No assignment will be accepted through email. Rules for Marking: It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The submitted assignment does not open or file is corrupted. Your assignment is copied from internet, handouts or from any other student (Strict disciplinary action will be taken in this case). Assignment Question Write a C program in any editor of Linux in which you have to create one child using fork system call. In child process, message will be displayed to take input for two tasks through Switch or If else statements. One for execution of ping command for any website i.e ping yahoo.com using the execlp() system call. Second to create any directory using mkdir command i.e mkdir VU Parent process should wait until child finishes its execution through Wait() call and display a message “Well done Kid”. Finally Both Parent and Child ID should be displayed.

api.ning.comapi.ning.com/.../Spring2016_CS604_1.doc  · Web viewHow to work on Ubuntu terminal . ... Uploading instructions: Your assignment must be in .doc format ... code in the

Embed Size (px)

Citation preview

Assignment No. 01Semester: Spring 2016

CS604 –Operating System

Total Marks: 20

Due Date: 12-05-2016

Assignment Objective: To give you hand on experience of Ubuntu though VMware To know about system calls like fork, wait, and exec How to work on Ubuntu terminal How to compile a program using gcc compiler and execute a program through terminal

Uploading instructions: Your assignment must be in .doc format (Any other formats like scan images, PDF, bmp, etc will not be

accepted). Save your assignment with your ID (e.g. bc020200786.doc). No assignment will be accepted through email.

Rules for Marking:

It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The submitted assignment does not open or file is corrupted. Your assignment is copied from internet, handouts or from any other student (Strict disciplinary action will be taken in this case).

Assignment

Question

Write a C program in any editor of Linux in which you have to create one child using fork system call. In child process, message will be displayed to take input for two tasks through Switch or If else statements.

One for execution of ping command for any website i.e ping yahoo.com using the execlp() system call. Second to create any directory using mkdir command i.e mkdir VU

Parent process should wait until child finishes its execution through Wait() call and display a message “Well done Kid”. Finally Both Parent and Child ID should be displayed.

You have to solve the assignment in the following way

Save the program in your student id directory which can be created anywhere i.e Desktop Attach only two screen shots i.e one for ping and other for mkdir Also copy the code in the text format in the same word file in which screen shot attached.

Sample Program output:Screen Shot 1:

Screen Shot 2:

Deadline: Your assignment must be uploaded/submitted on or before 12-05-2016