We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search


+ Link For Assignments, GDBs & Online Quizzes Solution


+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 01

Semester: Fall 2018

Operating Systems (CS604)


Total Marks: 20


Due Date: 4th December, 2018



Please read the following instructions carefully before submitting assignment:

§  You should submit your assignment before or on due date on VULMS.

§  Your assignment should be your own work in your own words. It should not be copied from Internet, handouts or books.

§  Assignment sent via Email will not be replied and accepted.

§  If the submitted assignment does not open or file (or ZIP) is corrupt, it will not be marked and hence awarded zero marks.



·         To know about how to create and terminate multiple threads in Linux Operating System.

·         To learn how to write, compile and execute C program in Linux O/S.



For any query about the assignment, contact at CS604@vu.edu.pk


Problem Statement

You are required to write a C program that will create three threads named as; Thread 1, Thread 2 and Thread 3. You are required to run these threads in parallel fashion and show output as shown in sample screenshots. Each thread will display its Process and Thread ID as well.


The threads will have the additional functionalities:


Thread 1 will display the personal information of student such as student name and id.

Thread 2 will display the course related information such as Course Code and Course Name.

Thread 3 will display the degree name and university name.


All such information should be passed as parameters to thread function and then display such information in each thread. Make sure that parent thread or main thread should wait until all other threads have finished their execution. Finally, all threads will be terminated.


You are required to Compile & run C program on Linux Operating system. You will compile your C program file with your Student ID.


Note:  File name other than your Student ID will not get marks.

You will write code and paste following two screenshots in Microsoft Word file.

1)      You will take screenshot of compiling command that you will issue at Linux Terminal.

2)      Then you will run your executable and take its screenshot.


Sample Output for Program


1. Compilation Phase



2. Program Output



Note: You are required to upload only Microsoft Word file which contains C code and required screenshots for login and program output. File other than Microsoft Word will not be accepted.






+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

See Your Saved Posts Timeline

Views: 10356


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Replies to This Discussion

Koi mrii ass ma hlp kr do

Email, cell no, facebook personal links, links sharing for promotion any kind of site & youtube direct link sharing is not allowed at the site.


Although If you want to share the youtube video, then paste the embed codes here of the youtube video. Otherwise your comment / reply will be deleted. As well as your account will be deleted from the site. Thanks for understanding.

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

Ubuntu mein code copy paste keisy krty hai??
any one tell me pls

first you open text editor on ubuntu and paste code there and save the text editor file on desktop with .c extention

than open the termianl

write cd Desktop/ on terminal 

than gcc likhain or file ka name jo apnay rakha ha compile hojayga program on ubuntu

me ne aise copy kia h but text editor me paste ni hota udr 

simple ha easily hojata paste dobara try karain lakin save file ko desktop pe kijiya ga or .c extention k sath

code compiling ki samjhe agaye ha lakin code ma errors bohat zayada hain manay run kar k daikha ha 

Code for CS604 Assignment (Fall 2018) 
Code for the Program:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#define NUM_THREADS 3
struct thread_data{
int parentID,th_ID;
char *name;
char *detail;
struct thread_data thread_array[NUM_THREADS];
void *MythreadFunc(void *value){
int id,parentid;
char *naam;
char *kaam; 
struct thread_data *my_data;
my_data = (struct thread_data *)value;
id = my_data -> th_ID;
parentid = my_data -> parentID;
naam = my_data -> name;
kaam = my_data -> detail;
printf("\nThread with ID :%ld ",pthread_self());
printf(" and Parent ID: %d",parentid);
printf(" created and started\n ");
return NULL; 
int main(){
pthread_t thread[NUM_THREADS];
int process_id,rc;
process_id = getpid();
printf("\n\nCurrent Process ID :%d ",process_id);
// Data of struct
thread_array[0].name = "BC17000000";
thread_array[0].detail = "XYZ";
thread_array[0].parentID = process_id;
thread_array[0].th_ID = pthread_self();
thread_array[1].name = "CS604";
thread_array[1].detail = "Operating System";
thread_array[1].parentID = process_id;
thread_array[1].th_ID = pthread_self();
thread_array[2].name = "BSSE";
thread_array[2].detail = "Virtual University of Pakistan";
thread_array[2].parentID = process_id;
thread_array[2].th_ID = pthread_self();
// creating threads via loop
for(int i = 0; i < NUM_THREADS; i++){
rc = pthread_create(&thread[i],NULL,MythreadFunc,(void *)&thread_array[i]);
printf("ERROR: return code from pthread_create() is %d\n",rc);
}// joining the threads to main thread so it can wait until all created threads can execute before main thread 
for(int i = 0; i < NUM_THREADS; i++)
printf("\n\nThreads are going to be terminated one by one\n");
printf("\n All Threads exited safely...\n");

kiya ya code right ha ya wrong ?

sr ubuntu m likhna pry ga pehly code ya window sy copy kr k past ho jae ga 

copy past nhe ho rha code plz tell me

koi banda ccorrect code  send kar sakta ha kaya 

jis may correctly threads display hun one by one


Latest Activity

+ ! ! ! ! ᎠixieᎠuຮt꧂ liked + ! ! ! ! ! !blaire's blog post Lets Make .....................Tasbeeh
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked +!!mano stella +'s blog post Khuda Ki Mohabbat
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked Biya's blog post Naik Biwi....
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked Biya's blog post Totay Bhe Jo Tara Toh Zamee p Nahi Girta.....
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked Biya's blog post Or Tera Raab Bholny wala NAhi. . . .
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked Biya's blog post Mera Yaqeen HAi. . .. .
53 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked + ! ! ! ! ! !blaire's blog post غار سجدہ
53 minutes ago
+ ! ! ! ! ! !Aaima Ansari ❤️ replied to + sílєnzíσ's discussion If fb, google nd youtube would have been subjects..... !!!!!!!!!!!!
1 hour ago
彡JK彡 ❤️ replied to +"Certified Gangster"++'s discussion Hosla
3 hours ago
彡JK彡 ❤️ replied to +++Mahoo+++'s discussion apko chun lia jata ha
3 hours ago
Shine--Ex-VUStudent liked + sílєnzíσ's discussion If fb, google nd youtube would have been subjects..... !!!!!!!!!!!!
3 hours ago
Biya replied to Biya's discussion Ehsaas...
3 hours ago
彡JK彡 ❤️ replied to + ! ❤INNOCENT❤'s discussion Akhri Salam Smjh kr
3 hours ago
彡JK彡 ❤️ replied to + !! SARAH's discussion + i dnt knw where it could fit into ur story but it is......!!
3 hours ago
彡JK彡 ❤️ replied to + !! SARAH's discussion + i dnt knw where it could fit into ur story but it is......!!
3 hours ago
彡JK彡 ❤️ replied to Biya's discussion Ehsaas...
3 hours ago
彡JK彡 ❤️ replied to +¢αяєℓєѕѕ gιяℓ's discussion True.....
3 hours ago
彡JK彡 ❤️ replied to + ! ! ! ! Noor E Kayenat's discussion Please Raise Ur Hand !!
3 hours ago
彡JK彡 ❤️ replied to Biya's discussion Aurat Bari Piyari Cheez Hai.. :D
3 hours ago
彡JK彡 ❤️ replied to + Iuuoɔǝut+'s discussion koi asa shaks hua kare ....
3 hours ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service