Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS604 Assignment 02 Solution spring April 2012 due date is 25 April 2012
#1
Question 1: [Marks 20]
In Linux Ubuntu flavor, write a program in C language to do the following tasks.
1) Use fork ( ) system call to create a child process.
2) Child process should first take student name as input and then it should display student name that it takes from user. At last, child process should display numbers from 0 to 5.
3) Parent process should first take VU Student ID as input and then it should display VU Student ID that it takes from user. At last, parent process should display numbers from 6 to 10.
4) Output of the program should be like the one give below.
Enter Student Name: Mansoor Anwar
Student Name is: Mansoor Anwar
child: 0
child: 1
child: 2
child: 3
child: 4
child: 5
Enter Student ID: BC070651121
Student ID is: BC070651121
parent: 6
parent: 7
parent: 8
parent: 9
parent: 10

5) Execute this program on Linux Ubuntu. Take screen shots of your program that you write in C,
Commands that you used to run your program in Linux Ubuntu and the out put displayed by your
program. After taking screen shots, send these screen shots to me properly in your assignment.

Note:
1) Do not write your program in other languages like Java, C++ etc. Write your program only in C language.
2) Do not execute your program in other operating systems like Windows, Mac etc. Execute your program
only in Linux Ubuntu flavor.
3) You should provide three screen shots. Required three screen shots that you should provide are given
below.
i) Screen shot of your program that you write in C.
ii) Screen shot of Commands that you used to run your program in Linux Ubuntu.
iii) Screen shot of Final output of your program shown.
4) If the programs out put of any two students will be same then both of them will get zero marks. Similarly,
if Student ID and Student Name displayed in final output of program will not mach with actual name and
ID of student who submitted the assignment then that particular student will get zero marks. Moreover if
you will copy your assignment then you will get zero marks.
5) If you will try to submit your assignment by editing screen shots of any other student then you will get
zero marks.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#2
cs604 idea solution April 2012 are in attachment


Attached Files
.doc   cs604.doc (Size: 19.5 KB / Downloads: 318)

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#3
#include <sys/types.h>
#include <sys/wait.h>
pid_t wait(int *stat_loc);
#include <stdio.h>


void main(){
int pid, status;
pid = fork();
if(pid == -1) {
printf(“fork failed\n”Wink;
exit(1);
}
if(pid == 0) { /* Child */
printf(“Child here!\n”Wink;
exit(0);
}
else { /* Parent */
wait(&status);
40
printf(“Well done kid!\n”Wink;
exit(0);
}
}



0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#4
is this complete soution????Confusedmileys:
Reply
#5
idea solution hai yeh

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS301 Assignment # 4 Due Date: 02-Feb-2016 Vuhelper 0 2,322 02-03-2016, 05:38 PM
Last Post: Vuhelper
  CS703 – Advanced Operating Systems Assignment No.3 solution January 2016 Vuhelper 0 5,907 01-23-2016, 09:58 PM
Last Post: Vuhelper
  CS601 Data Communication Assignment No. 03 Solution 23rd January 2016 Vuhelper 1 1,928 01-23-2016, 06:09 PM
Last Post: Vuhelper
  CS403 Assignment No. 03 Solution 23rd January 2016 Vuhelper 2 1,165 01-23-2016, 03:18 PM
Last Post: Vuhelper
  CS506 Web Design and Development Assignment no 3 Solution 3rd January 2016 Vuhelper 0 2,241 01-23-2016, 03:16 PM
Last Post: Vuhelper
  CS724 Software Process Improvement Assignment No 01 Solution 20th January 2016 Vuhelper 0 1,966 01-20-2016, 06:26 PM
Last Post: Vuhelper
  CS711 Software Design Assignment No 01 Solution Due Date Feb 12, 2016 Vuhelper 0 1,664 01-20-2016, 06:24 PM
Last Post: Vuhelper
  CS709 Formal Methods for Software Engineering Assignment No 01 Solution January 2016 Vuhelper 0 1,800 01-20-2016, 06:22 PM
Last Post: Vuhelper
  cs703 assignment no 3 Solution 20th January 2016 Vuhelper 0 1,701 01-20-2016, 06:20 PM
Last Post: Vuhelper
  CS704 Assignment No. 01 Solution January 2016 Vuhelper 0 4,796 01-20-2016, 06:19 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)