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

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ 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

 

Instructions:                          

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.

Objectives:

 

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

 

 

 

BEST OF LUCK

 

+ 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)

Attachments:

Replies to This Discussion

#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 *name;
char *detail; 
struct thread_data *my_data;
sleep(1);
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 ");
printf("%s\n",name);
printf("%s\n",detail);
pthread_exit(NULL);
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 = "MC140401760";
thread_array[0].detail = "ABC";
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 = "MIT";
thread_array[2].detail = "VU";
thread_array[2].parentID = process_id;
thread_array[2].th_ID = pthread_self();
// creating threads via loop

Omer run the below code if it works fine then also share me output of MC140401760 on koukab,haider@gmail.com.

plzzzz koi mje bi assignment bana dy...mn kl s download kr ri hun ubuntu download ni o raha bilkul bi net speed ni....plzzz koi bana dy yar.                                                    name: Asifa Mushtaq                                                                                              id: bs160201258                                                                                                      mail: asifamushtaq1717@gmail.com 

please koi to help kro
Name haider faiz
id Bc170200083
mail : haiderali907jav@gmail.com

mc160401486

ali ahmad 

mail.alijanjwa0305@gmail.com

plz help me

sir kindly send me solution mera software download hi nai ho raha 1 gb ka hai 

mc160401482

Sania sajid 

mc160401482@vu.edu.pk

Sir code teekh nai ha error de raha ha plz error k bagahr code send kare 

bc140401734

Aiza

bc140401734@vu.edu.pk

cs604 plz help me

mc160401486

aliahmad 

alijanjwa0305@gmail.com

code error da rha ha

mujy b koi screenshot bnado yr mre pas ubantu ni hy

code file send karo

RSS

Latest Activity

+ "αяsαℓ " Ќąƶµяɨ •" liked + Iuuoɔǝut+'s discussion عشق
11 seconds ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + M.Tariq Malik's discussion Follow the Main Forum & Study Groups New Added Discussions at Your Mail Address
21 seconds ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + M.Tariq Malik's discussion Follow the Main Forum & Study Groups New Added Discussions at Your Mail Address
31 seconds ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + M.Tariq Malik's discussion VIRTUAL UNIVERSITY OF PAKISTAN ORGANIZED AAOU 2019
50 seconds ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + M.Tariq Malik's discussion VIRTUAL UNIVERSITY OF PAKISTAN ORGANIZED AAOU 2019
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + M.Tariq Malik's discussion Fall 2019- 2nd Merit List of Candidates Eligible for Admission
1 minute ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion ENG201 Handouts With Highlights Important Questions + MCQs
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + M.Tariq Malik's discussion Fall 2019- 2nd Merit List of Candidates Eligible for Admission
1 minute ago
+ M.Tariq Malik's 3 discussions were featured
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + M.Tariq Malik's discussion Fall 2019 2nd Merit List of Candidates Eligible for Admission
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + M.Tariq Malik's discussion Fall 2019 2nd Merit List of Candidates Eligible for Admission
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + M.Tariq Malik's discussion Fall 2019 2nd Merit List of Candidates Eligible for Admission
1 minute ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + M.Tariq Malik's discussion Fall 2019 2nd Merit List of Candidates Eligible for Admission
2 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + Iuuoɔǝut+'s discussion Mohabbat ki manzil
2 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" liked + Iuuoɔǝut+'s discussion Mohabbat ki manzil
2 minutes ago
+ M.Tariq Malik added a discussion to the group ENG201 Business and Technical English Writing
2 minutes ago
+ M.Tariq Malik left a comment for sami3
8 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion BIT710 Computer Network (Handouts) All Lectures Power Point Slides ( BIT710 All 45 lectures PPT slides)
15 minutes ago
+ M.Tariq Malik added a discussion to the group BIT710 Computer Network
17 minutes ago
+!!mano stella + liked +!!mano stella +'s blog post Khuda Ki Mohabbat
27 minutes ago

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

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