Question

In: Computer Science

In a system with threads, is there normally one stack per thread or one stack per...

In a system with threads, is there normally one stack per thread or one stack per process? Explain.

Solutions

Expert Solution

Each thread has its own stack so it can utilize its own local variables, thread offer global variables which are essential for .data or .bss segments of linux executable.

Since threads share global variables that is, we use synchronization instruments like mutex when we need to get to/alter global variables in multi threaded application. Local variables are important for thread singular stack, so no need of any synchronization.

There is one stack for every thread whether you are utilizing real threads or simulated threads. A stack holds the call history of the thread and hence the factors of the calling schedules and the statement area from which they settled on the decision. At the point when you switch back to the thread, regardless of how it is executed, it can decide to "return" and should have a stack to actualize the return by reestablishing the past everyday practice at the point after the call. Obviously, on the off chance that you are simulating thread, at that point the substance of the "stack" might be not the same as the local stack oversaw by the OS and CPU, and deciphered dialects are allowed to make a stack dependent on pseudo-code instead of native machine guidelines. It is as yet a stack


Related Solutions

Thread Programming (C Programming) Objective Develop threads: thread and main. Functionality of Threads: The main program...
Thread Programming (C Programming) Objective Develop threads: thread and main. Functionality of Threads: The main program accepts inputs from the user from the console. The user can provide the following two types of input: add num1 num2 mult num1 num2 Here, num1 and num2 are two integer numbers. E.g., the user may input add 1 2. The threads receive the command along with the number, and performs the appropriate arithmetic operation and returns the results to main program. The main...
Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of...
Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of using mailboxes over shared memory for inter-process communication.
DO THIS IN JAVA Write a complete Java program. the program has two threads. One thread...
DO THIS IN JAVA Write a complete Java program. the program has two threads. One thread prints all capital letters 'A' to'Z'. The other thread prints all odd numbers from 1 to 21.
Write a C program that creates 5 threads sends the thread index as an argument to...
Write a C program that creates 5 threads sends the thread index as an argument to the thread execution procedure/function. Also, the main process/thread joins the newly created threads sequentially one after the other. From the thread procedure print “I am a thread and my index is “ [print the correct index number]. From the main thread after the join print “I am the main thread and just completed joining thread index “ [print the correct index].
If bolt thread length is normally distributed, what is the probability that the thread length of...
If bolt thread length is normally distributed, what is the probability that the thread length of a randomly selected bolt is (a) Within 1.3 SDs of its mean value? (b) Farther than 1.5 SDs from its mean value? (c) Between 1 and 2 SDs from its mean value? You may need to use the appropriate table in the Appendix of Tables to answer this question.
If bolt thread length is normally distributed, what is the probability that the thread length of...
If bolt thread length is normally distributed, what is the probability that the thread length of a randomly selected bolt is (a) Within 1.3 SDs of its mean value? (b) Farther than 2.1 SDs from its mean value? (c) Between 1 and 2 SDs from its mean value?
Measurements of a number of fittings show that the pitch diameter of the thread is normally
Measurements of a number of fittings show that the pitch diameter of the thread is normally distributed with a mean of 8.007 mm and a standard deviation of 0.005 mm. The design specifications require that the pitch diameter be 8 ± 0.01 mm. Estimate the percentage of fittings that will be within tolerance.
Please select topic one or topic two below and use it to formulate a thread that...
Please select topic one or topic two below and use it to formulate a thread that is at least one paragraph in length. (You do not necessarily need to address all of the questions, they are to help you get started, please feel free to add ideas as well.) After composing your initial thread, please respond to a minimum of two threads from your classmates. 1. What is a right? Please name two or more rights that we have. Is...
Assume a company manufacturing many products, one of which normally sells for $48 per unit. The...
Assume a company manufacturing many products, one of which normally sells for $48 per unit. The company’s accounting system reports the following unit product cost for this product: Per Unit Direct materials $ 18 Direct labor 12 Manufacturing overhead 10 Total cost $ 40 The company estimates that $3 of its manufacturing overhead varies with respect to the number of units produced. The remainder of its overhead is fixed and unaffected by the volume of units produced within the relevant...
Dream Threads Company sells hand−sewn shirts for $40 per shirt. It incurs monthly fixed costs of...
Dream Threads Company sells hand−sewn shirts for $40 per shirt. It incurs monthly fixed costs of $8,000. The contribution margin ratio is calculated to be 40​%. What is the breakeven point in​ units? (Round your answer up to the nearest whole​ unit.) A. 500 units B. 3,200 units C. 200 units D. 100 units 2) Alpine Productions uses a standard cost system for recording transactions. Alpine reported the following data for the year ended December​ 31: Sales​ revenues: $650,000 Cost...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT