Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : Both threads share the address space, so T2 sees the updated variable and both share the open file descriptor / दोनों थ्रेड एड्रेस स्पेस साझा करते हैं, अतः T2 अद्यतन वेरिएबल देखता है और दोनों फाइल डिस्क्रिप्टर साझा करते हैं

Advertisement

Detailed Solution

सही उत्तर Both threads share the address space, so T2 sees the updated variable and both share the open file descriptor / दोनों थ्रेड एड्रेस स्पेस साझा करते हैं, अतः T2 अद्यतन वेरिएबल देखता है और दोनों फाइल डिस्क्रिप्टर साझा करते हैं है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Two threads T1 and T2 belong to the same process. T1 writes to a global variable and T2 opens a new file. Which statement is correct? / एक ही प्रोसेस के दो थ्रेड T1 और T2 हैं। T1 एक ग्लोबल वेरिएबल में लिखता है और T2 एक नई फाइल खोलता है। कौन-सा कथन सही है?

1.
T2 cannot see T1's change because threads have separate address spaces / T2, T1 का परिवर्तन नहीं देख सकता क्योंकि थ्रेड के एड्रेस स्पेस अलग होते हैं
2.
The file opened by T2 is invisible to T1 / T2 द्वारा खोली गई फाइल T1 को अदृश्य रहती है
3.
The change becomes visible to T2 only after T1 terminates / परिवर्तन T1 समाप्त होने के बाद ही T2 को दिखता है
4.
Both threads share the address space, so T2 sees the updated variable and both share the open file descriptor / दोनों थ्रेड एड्रेस स्पेस साझा करते हैं, अतः T2 अद्यतन वेरिएबल देखता है और दोनों फाइल डिस्क्रिप्टर साझा करते हैं

Correct Answer: Both threads share the address space, so T2 sees the updated variable and both share the open file descriptor / दोनों थ्रेड एड्रेस स्पेस साझा करते हैं, अतः T2 अद्यतन वेरिएबल देखता है और दोनों फाइल डिस्क्रिप्टर साझा करते हैं

Threads of one process share code, data (globals) and open files; each thread privately owns only its stack, registers and program counter. So T2 immediately sees the global change and can use the file T2 opened. / एक प्रोसेस के थ्रेड कोड, डेटा और खुली फाइलें साझा करते हैं; केवल स्टैक, रजिस्टर और प्रोग्राम काउंटर निजी होते हैं।

Downloaded from PrepSnap (prepsnap.in)