Example of shared programming using library routines, Computer Engineering

Assignment Help:

Q. Example of shared programming using library routines?

Think about subsequent set of statements 

Process A                                  Process B              

   :                                                    :

fork B;                                              :

   :                                                     :

Join B;                                            end B;             

In the above group of statements process A creates a child process B by statement fork B. Then A and B carry on their computations separately till A reaches join statement At this phase if B is already completed then A continues executing subsequent statement or else it waits for B to complete. 

In the shared memory model a general problem is to synchronize the processes. It can be possible that more than one process is trying to concurrently edit the same variable. To solve this problem numerous synchronization mechanism such as test_and_set, semaphores and monitors have been used. We will not go in the details of these mechanisms. Rather we will symbolize them by a pair of two processes known as lock and unlock. Whenever a process P locks a common variable then only P can use that variable.

Other simultaneous processes have to wait for common variable till P calls the unlock on that variable. Let's see effect of locking on output of a program when we don't employ lock and when we employ lock.


Related Discussions:- Example of shared programming using library routines

How do subroutines help in program writing, How do subroutines help in prog...

How do subroutines help in program writing? Some of the significant characteristics of Subroutine that help in program writing are: A subroutine is named, each have a

Environments -artificial intelligence, Environments: We have seen that...

Environments: We have seen that an agents intelligent should take into account certain information when it choose a rational action, including information from its sensors, in

Procedure which divides a 32-bit number by a 16-bit number, Write a procedu...

Write a procedure which divides a 32-bit number by a 16-bit number. The procedure must be general which is it's defined in one module and can be called from another assembly module

What is the future of hyper threading, Q. What is the Future of Hyper threa...

Q. What is the Future of Hyper threading? Current Pentium 4 based MPUs employ Hyper-threading however next-generation cores, Conroe, Merom and Woodcrest will not. As some have

Write a class driver , Create a class called  performance that records the ...

Create a class called  performance that records the information of a performance. The class should include at least five data items:  id,  title,  basePrice, startDate, endDate. Yo

Mutation - canonical genetic algorithm, Mutation: However it may appea...

Mutation: However it may appear that the above recombinations are a little arbitrary that especially as points defining whether crossover and inversion occur are chosen random

IEEE802, 1. (a) Given a baseband bus with station 1 located at 10m, station...

1. (a) Given a baseband bus with station 1 located at 10m, station 2 located at 1000m, and station 3 located at 1010 meters (see diagram above). If the data rate of the bus is 10 M

Write a program to event advertised, A museum has a collection of old poste...

A museum has a collection of old posters advertising events of various kinds (theatre, sport, fairs, lectures etc.). It wishes to keep a record of these, containing, for each poste

Application area of artificial intelligence, 1. The State of the Art: What ...

1. The State of the Art: What can AI do today? A concise answer is difficult because there are so many activities in so many subfields. Here we sample a few applications other

What is interpreter, Q. What is interpreter? An interpreter translates ...

Q. What is interpreter? An interpreter translates each high-level-language statement into its equivalent set of machine-language instructions, which are then executed right awa

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