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

AIMMS3.9, Do you have writers that can use the software AIMMS version 3.9?

Do you have writers that can use the software AIMMS version 3.9?

Paging, what is the use of valid invalid bits in paging

what is the use of valid invalid bits in paging

What is directory, What is Directory? The device directory or simply ca...

What is Directory? The device directory or simply called as directory records information-such as name, location, size, and type  for all files on that certain partition. The d

What is the lower bound on the numeral of page faults, Q. Presume that you...

Q. Presume that you have a page-reference string for a process with m frames (initially all empty). The page-reference string has length p along with n distinct page numbers

Explain about disk scheduling with neat diagram, Explain about disk schedul...

Explain about disk scheduling with neat diagram? FCFS Scheduling SCAN scheduling C-SCAN scheduling SSTF scheduling LOOK Scheduling

Show the services which provided by operating system, Q. Show the services ...

Q. Show the services which provided by operating system? A) Resource Allocation: If there are more than one user or jobs running at the same instance then resource

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