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 about file allocation methods, Explain about file allocation method...

Explain about file allocation methods? The main problem in direct-access nature is how to assign space to these files so that disk space if utilized effectively and files can b

Why do systems stay track of the type of a file, Q. Why do some systems sta...

Q. Why do some systems stay track of the type of a file while others leave it to the user or simply don't implement multiple file types? Which system is "better?" Answer: A f

Gang scheduling , Gang Scheduling : A set of related process is scheduled ...

Gang Scheduling : A set of related process is scheduled to execute on a set of processors at the similar time, on a 1-to-1 basis. Closely related processes or threads may be sched

Define file permission in unix, The permission function is used to calculat...

The permission function is used to calculate what, if any access each class or level of user has to each file on a Unix machine. The permission task is one of the data components s

Starvation, what do you mean by starvation?explain in detail

what do you mean by starvation?explain in detail

What is meant by arm-stickiness, What is meant by arm-stickiness? If on...

What is meant by arm-stickiness? If one or a few processes have a high access rate to data on single track of a storage disk, then they might be monopolizing the device by repe

Installation and Training Documentation, Ask question Project Details PROJE...

Ask question Project Details PROJECT OVERVIEW The ABC Hospital is upgrading their version of Windows. As part of the upgrade, 100 new computers will be purchased. Your task is to

Comparison of disk scheduling algorithms, COMPARISON OF DISK SCHEDULING ALG...

COMPARISON OF DISK SCHEDULING ALGORITHMS Name      Description                  Remarks      (Selection according to requestor)   RSS        Random scheduling     fo

Define the division of labour between client and server, Define the Divisio...

Define the Division of Labour between Client and Server Given our definition of client - server as the interaction between dispersed application logic components it must be not

Advantages and disadvantages of thread, OPERATING SYSTEM 1. Describe th...

OPERATING SYSTEM 1. Describe the term operating system. Write down the functions of operating system. 2. Explain Thread? Write down the advantages and disadvantages of threa

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