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

Define the properties of interactive operating system, Define the propertie...

Define the properties of Interactive operating system Interactive:- This system is composed of many short transactions where the results of the next transaction may be unpred

Explain the demand paging system, Question : (a) In the demand paging ...

Question : (a) In the demand paging system, when a process tries to access a page that was not brought into memory, a page fault occurs that involves a series of actions. The

Explain variable partitioning in memory management, VARIABLE PARTITIONING ...

VARIABLE PARTITIONING We can differ the partitions and change the location according to the size of the process.   50k 40k

Search and print between two words/patterns, what if we need the portion fr...

what if we need the portion from a text based on some keyword. For eg. My file is like below, ------------------------------------------------ Order=[ 1 2 3 4 5 Order=[ 6 7 8 9

Unix, what is difference between file descriptor and file pointer?

what is difference between file descriptor and file pointer?

Thread safety, What does it mean for something to be thread-safe? By saying...

What does it mean for something to be thread-safe? By saying that X is thread-safe, we mean that if multiple threads use X at the same time, we don't have to worry about concurrenc

Producer - consumer synchronization, This assignment is based on Programmin...

This assignment is based on Programming Project 6.40 in Silbershatz. Implement the ProducerXConsumer program according to the instructions for Project 6.40 for both Linux and Win32

What is low-level formatting, What is low-level formatting? Before a di...

What is low-level formatting? Before a disk can kept data, it must be required into sectors that the disk controller can read and write. This procedure is called low-level form

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