Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and run the program in UNIX/LINUX based C. 1. Write a main program that creates three thread, print their thread id of each thread.

  • Write and run the program in UNIX/LINUX based C.

1. Write a main program that creates three thread, print their thread id of each thread. Also print the process id of the main program and prove that the process id of all the three thread are same. (3 marks)

2. Write a program to demonstrate that all threads of the same process share the global data. (3 marks)

3. Write a program to create four threads. Use two datas. First thread must add two datas. Second thread must subtract two datas. Third thread must multiply two datas. Fourth thread must divide two datas. (4 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started