Define the os/2 threads code, Operating System

Assignment Help:

Define the OS/2 threads code

The sample program in Listing is very similar to the NetWare example. OS/2 commands are substituted for the pseudocode commands controlling thread creation and execution.

Listing

Void WorkerThread(ULONG userID);

#define SLEEP_INTERVAL (ULONG) 50

void AcceptRegisterationRequests( )

{

   int userID, threadID ;

   do{

        ......

        WaitforClientRegistration( )

        RegisterClient()

        UserID = RegisterAsUser ( )

        DocCreateThread(&threadID,WorkerThread, userID, 0, 8192)

        ......

     } while (FOREVER)

   }

   Void WorkerThread(ULONG userID);

   {

  do{

          DosSleep(SLEEP_INTERVAL);

                   if (WorkAvailable) {

    Process Request ( )

    Send Response ( )

   }

  } while (CLENT_CONNECTED)

  DosExit(EXIT_THREAD,0);

 }

Listing : OS/2 threads code example  Upon successful registration, an OS/2 thread is started with the CreateThread(  ) command. The function WorkerThread( ) begins asynchronous execution and loops at specified intervals looking for work to perform. The intervals are created by the DosSleep ( ) function call and  will allow  the thread to periodically  poll for available work.When the client requests closure of the connection or an error occurs, the DosExit( ) function will be performed to exit the current worker thread.


Related Discussions:- Define the os/2 threads code

Is data in a file access sequentially or randomly, Q. Give an instance of ...

Q. Give an instance of an application in which data in a file should be accessed in the following order: a. Sequentially b. Randomly Answer: a. Print the content of

Designing issues in a network -transparency, Transparency Users mus...

Transparency Users must be able to access remote resources as though these resources were local. Transparency should as well promote user mobility. Users must be allowed

Advantages and disadvantages of using circuit switching, Q. What are the ad...

Q. What are the advantages as well as disadvantages of using circuit switching? For what types of applications is circuit switching a viable strategy? Answer: Circuit

Explain the novell netware, Explain the Novell NetWare     NetWare does...

Explain the Novell NetWare     NetWare doesn't really have the concept of processes in the architecture, as  the most closely associated element in the NetWare  environment to

Draw and r chart and an x-bar chart, Thermostats are subjected to rigorous ...

Thermostats are subjected to rigorous testing before they are shipped to air conditioning technicians around the world. Results from the last five samples are shown in the table. D

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

what is the use of valid invalid bits in paging

What are the two types of fragmentations, Questiion 1 Use Priority Sche...

Questiion 1 Use Priority Scheduling Algorithm to schedule the following processes        Process                 Burst Time             Priority/Time            P1

Advantages and disadvantages of multiprogramming, Q. Advantages and disadva...

Q. Advantages and disadvantages of multiprogramming? Advantages 1.    High CPU utilization. 2. It appears that many programs are allotted CPU almost concurrently. D

#title:cs604, Consider a scenario of post mailbox, there are two processes ...

Consider a scenario of post mailbox, there are two processes named sender S and receiver R. Both processes can communicate with each other by name along with message. You need to I

Basic synchronization, (Add synchronization to your solutions to HW 3 to el...

(Add synchronization to your solutions to HW 3 to eliminate all of the race conditions.  You should not remove any of the sleep() commands that you used to produce the race conditi

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