Developing code with threads, Operating System

Assignment Help:

Developing Code with Threads

Writing code to support a thread-based implementation is very straightforward. Simple APIs are presented to the developer for each threads package. Actually, there are striking similarities between thread implementations on NetWare, Windows NT, and OS/2. We will use the Worker Model example of threads implementation introduced in the previous section. This example will be extended to include specifics for creating, controlling, and exiting threads for each platform. Listing shows the pseudocode representation of our example. We will only modify commands relating to threads in this example. Those commands will be highlighted and all other pseudocode will be left as-is.

LISTING

AcceptRegistrationRequests()

{

 do {

  .......

  WaitForClientRequestration( )

  RegisterClient()

  RegisterAsUser

  StartWorkerThread ()

           .......

  } while (FOREVER)

    }

    WorkerThread()

     {

    do {

  WaitForInterval ()

    if (CheckForWorkRequest() )  {

         Process Request ( )

         Send Response ( )

  }

     } while(CLIENT_CONNECTED)

     LeaveThread( )

}


Related Discussions:- Developing code with threads

What is mutual exclusion, Question 1 Brief the following distributed compu...

Question 1 Brief the following distributed computing system model Question 2 Explain the components involved in implementation of RPC mechanism Question 3 What is

Explain message passing system, Message passing system:- The function o...

Message passing system:- The function of message system is to permit processes to communicate with one another without the requirement to resort (option) to shared data. Commun

What is meant by context switch, What is meant by context switch? Switc...

What is meant by context switch? Switching the CPU to another process needs saving the state of the old process and loading the saved state for the latest process. This task is

Explain second-chance algorithm, Second-Chance algorithm When a page ha...

Second-Chance algorithm When a page has been selected, we inspect its reference bit. If the value is 0, we proceed to replace this page. If the reference bit is set to 1, thoug

Define drawback of distributed systems, Define drawback of Distributed syst...

Define drawback of Distributed systems Reliability is a drawback of Distributed systems

Prepare gantt charts and determine the average waiting time, Prepare Gantt ...

Prepare Gantt Charts and Determine the Average Waiting Time 1. Classify the interaction among the processes on the basis if degree to which they are aware of each  other's exi

What is process control block, What is process control block? Every pro...

What is process control block? Every process is represented in the OS by a process control block. It has many pieces of information associated with an exact process.

Explain tree structured directories structure, Tree structured directories:...

Tree structured directories: This is the main common directory structure. The tree has a root directory as well as every file in the system has a unique path name. A directory

Difference between preemptive and nonpreemptive scheduling, Define the diff...

Define the difference between preemptive and nonpreemptive scheduling. State why strict nonpreemptive scheduling is unlikely to be used in a computer center. Preemptive schedul

Explain external fragmentation?, Explain external fragmentation? Extern...

Explain external fragmentation? External fragmentation is the process where the free space and the space still available for use, in a piece of storage become separated into ma

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