Explain the per thread scoping, Operating System

Explain the Per Thread Scoping

Thread-level programming introduces new twists for application-level variable scoping. Threads are commonly used in one of two ways.

  • To execute independent parts of the application program
  • To execute similar application functions on a per-user basis


In the latter case, any global variables used by the threads may be subject to modification by more than one thread at a time. Disastrous results may occur if this is left unchecked.

Since threads are potentially executing  the same procedures within an application. Or accessing similar data, per-thread data items may be required.

A common practice in a multithreaded program is  to repentantly call application functions on a per-user or per-function basis. In order to make a function reentrant, variables within the function must either be local or have sterilized access to global data. When executing functions on be half of a user, however, these functions may need access to some user contextual data.

The application developer has one of two choices to make:

  • A variable could be passed to the functions representing an index into a user data structure or a pointer to user data. This is cumbersome, however, because that same variable will need to be passed to each subsequent function so that its scope is visible to application components down the line.
  • The developer can set up a similar variable with the global application scope but with per-threads access. The user data must be unique for each thread and be globally addressable by application functions.
Posted Date: 5/29/2013 5:30:31 AM | Location : United States

Related Discussions:- Explain the per thread scoping, Assignment Help, Ask Question on Explain the per thread scoping, Get Answer, Expert's Help, Explain the per thread scoping Discussions

Write discussion on Explain the per thread scoping
Your posts are moderated
Related Questions
swapping technique

What is the kernel? A more common explanation is that the OS is the one program running at all times on the computer  usually known as the kernel, with all else being applicati

Explain a boot control block A boot control block can have the information required by the system to boot an operating from that partition. If the disk does not have an operati

how the system call is work?

Question: (a) The following table (table 1.0) gives the length of the CPU burst time in milliseconds of processes P 1 to P 4 . Assume the processes arrived in the order P 1 ,

USER-LEVEL THREADS (ULT) In this level the kernel isn't aware of the existence of threads -- All thread management is complete by the application by using a thread library. Th

SSTF (Shortest Seek Time First) After a demand go to the closest request in the work queue regardless of direction Decrease total seek time compared to FCFS Disadv

Performance of Job Scheduling  Strategies In this project you will investigate the performance of Job Scheduling strategies, Memory Allocation strategies and a CPU Scheduling s

What is the purpose of system programs? System programs can be thought of as bundles of useful system calls. They give basic functionality to users and so users do not require