Explain the per thread scoping, Operating System

Assignment Help:

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.

Related Discussions:- Explain the per thread scoping

Aggregate planning, Prepare a report that motivates alternatives reactive s...

Prepare a report that motivates alternatives reactive strategies that can be used by wind Mud clothing factory

Operating system, The term Operating System (OS) is often misused. It is co...

The term Operating System (OS) is often misused. It is common, for example, for people to speak of an OS when they are in fact referring to an OS and to a set of additional applica

Drawbacks of least-recently used algorithm, The question of fairness, regar...

The question of fairness, regarding page eviction, is a hard one. How do we decide what is fair? Many operating systems use global LRU, where pages from all processes are managed t

Explanation of modern cpu architectures, Your CTO liked your proposal from ...

Your CTO liked your proposal from Unit 2 so much he only trusts you to explain complex concepts to his managers. He now wants you to write him a four page paper explaining the CPU,

Explain the features that bash shell provides, LINUX OPERATING SYSTEM 1...

LINUX OPERATING SYSTEM 1. Write a brief explanation about the Linux distribution. 2. Explain the features that Bash shell provides? 3. Who is responsible for managing use

Explain types of file allocation-contiguous allocation, Contiguous allocati...

Contiguous allocation: Every file will be allocated contiguous space in the memory. Allow the block size be 1K If a 50K files desires to be allocated space after t

Name the hardware to support demand paging, The hardware to support demand ...

The hardware to support demand paging is as follows Page table: This table has the skill to mark an entry invalid though a valid-invalid bit or particular value of protectio

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd