Determine the requiring variables on the scope of a thread, Operating System

Assignment Help:

Determine the Requiring Variables on the Scope of a Thread

It is very common in server application programs to require variables on the scope of a thread. To provide such a scope, the per-thread data item must be introduced. This data item may be used as a global variable, but each access needs to be made within the scope of a thread (that is, be unique for each thread). For instance, information such as errno must be unique to each thread or unpredictable results may occur. errno is a variable generally set by the operating system when certain application function are executed. Within NetWare , UnixWare, and OS/2, the variable is named errno. To receive the per-thread errno in Windows NT, the application must call GetLastError( ). Assume that two threads named A and B are making library function calls in which the errno variable will be set. If the two threads used the same global variable, the following might occur.

1. Thread A makes a call that results in an error and sets errno to 0X 10.

2. Thread B is then scheduled, makes a system call that executes properly, and sets errno to 0XX00.

3. Because Thread A and Thread B are using the same global errno, when Thread A queries errno it will have the results from Thread B.

This could be avoided if errno was of threads scope and thus was unique for each thread. All platforms with the exception of UnixWare consider errno with a thread scope, so each reference would only change the current thread's copy of errno UnixWare provides errno on the scope of the process, as threads are not supported. In addition, our thread-based platforms provide a mechanism for developers to access application-defined thread data areas.


Related Discussions:- Determine the requiring variables on the scope of a thread

Explain the os/2 operating system, Explain the OS/2 Operating System Li...

Explain the OS/2 Operating System Like NetWare, OS/2 manage resources at three levels, as shown in Figure 4.5 Resources may be maintained at the session, process, and thread le

Explain benefits of time-sharing system, Under what circumstances would a ...

Under what circumstances would a user be better off using a time-sharing system, rather than a personal computer or single-user workstation? When there are some other users, th

What is indexed allocation, What is indexed allocation? Every file has ...

What is indexed allocation? Every file has its own block of pointers to the sectors of the file.

Define the main reason to encrypt a file, Define the Main reason to encrypt...

Define the Main reason to encrypt a file Major reason to encrypt a file is secure it for transmission.

Network operating system, what is network operating? explain about it desig...

what is network operating? explain about it design issues?

Estimate the balking rate, People arrive at a barber shop at the rate of on...

People arrive at a barber shop at the rate of one every 4.5 minutes. If the shop is full (it can hold five people altogether), 30% of the potential customers leave and come back i

Explain about diffrent process state, Q. Explain about diffrent Process Sta...

Q. Explain about diffrent Process State? Process State When process executes, it changes its state. Process state is defined as the current activity of the process. Fi

Memory hierarchy, Difference between cache and associate memory

Difference between cache and associate memory

Information system can be divided into three task areas, From hardware pers...

From hardware perspective, every information system can be divided into three task areas Presentation, Application Logic and Data Storage. The R/3 Basis software is extremely s

What are the advantages of using unequal- size partitions, In fixed portion...

In fixed portioning scheme, what are the advantages of using unequal- size partitions? With unequal-size partitions there are two probable ways to assign process to partitions.

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