Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide answers and explanation. Question o Give all possible outputs of the following program. ( begin{aligned} 1 & 2 & text { #include

Please provide answers and explanation.

image text in transcribed

Question o Give all possible outputs of the following program. \( \begin{aligned} 1 & \\ 2 & \text { \#include } \\ 3 & \text { \#include } \\ 4 & \text { int i= 0; } \\ 5 & \text { void *do_stuff(void *arg) }\{ \\ 6 & \text { i++; } \\ 7 & \text { return NULL; } \\ 8 & \text { \} } \\ 9 & \text { int main() }\{ \\ 10 & \text { pthread_t tid1, tid2; } \\ 11 & \text { pthread_create(\&tid1, NULL, do_stuff, NULL); } \\ 12 & \text { pthread_create(\&tid2, NULL, do_stuff, NULL); } \\ 13 & \text { pthread_join(tid1, NULL); } \\ 14 & \text { pthread_join(tid2, NULL); } \\ 15 & \text { printf("8d } \backslash n ", i) ; \\ 16 & \text { return 0; } \\ 17 & \text { \} }\end{aligned} \)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions