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

Explain the various types of computer systems, Explain the various types of...

Explain the various types of computer systems. Mainframe systems Large Number of CPU with Greatest Processing Power:  Huge Memory Capacity:  Increased Performance by s

Explain logical file system architecture, Logical File System Responsi...

Logical File System Responsible for providing the before discussed interface to the user including: File access. Directory operations. Security and protection.

Explain briefly the working of semaphore with example ?, Explain briefly th...

Explain briefly the working of semaphore with example ? The E.W. Dijkstra (1965) abstracted the key idea of mutual exclusion in his concepts of semaphores. Definition A s

Explain the resource ownership and control, Explain the Resource Ownership ...

Explain the Resource Ownership and Control Operating systems are required to handle many different types of resources. CPU , memory, and I/O devices  are some of the varied sys

What is the use of FIFOs in client-server applications, What is the use of ...

What is the use of FIFOs in client-server applications

Explain signal handling, Signal handling A signal is used in UNIX syste...

Signal handling A signal is used in UNIX systems to inform a process that a particular event has occurred. 1. A signal is produced by the occurrence of a particular event.

Address operator and pointers, We are use to using variables within C witho...

We are use to using variables within C without thinking about where they are stored. Most variables are dynamic i.e. can change, therefore they are stored in Ram, unlike a program

Computer, what is an operating system?

what is an operating system?

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