1)
struct semaphore
{
int value;
Queue type L;
}
Wait (semaphore s)
{
s.value = s.value - 1;
if (s.value < 0)
{
put process (PCB) in L;
sleep();
}
else
return;
}
Signal (semaphore s)
{
s.value = s.value + 1;
if (s.value <=0 )
{
select a process (PCB) from L;
wake up();
}
}
2)
3)
Several methods exist for implementing mutual exclusion with message passing. One method uses processes to regulate access to shared resources. A resource control process has a variable which records the status of a resource (free or busy), and a buffer which contains request messages from other processes.

This pictures shows an interaction between a process that wants to access a shared resource, and a resource control process. Three messages are sent here. Message (1) is a request for access to the resource. Process P1 then blocks, waiting for a reply from the resource control process. Message (2) is the reply sent by the control process. This message wakes up P1, and P1 now uses the resource. Message (3) informs the resource control process that P1 is done using the resource.
The code for this interaction looks like this:
P1:
send(control_process, "Give me resource");
receive(control_process, Message); // block while waiting for a reply
{
...Critical Section...
}
send(control_process, "Done with resource");
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY FOR ALL ANSWERS! give the wait and...
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY FOR ALL ANSWERS! in openGL given a pixel represented as a triple float color values (0.3,0.5,0.8) convert the pixel to byte color values . Note the range of a byte color value is [0,255] and the range of a float color is [0.0,1.0]. Round answer to the nearest whole number
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY FOR ALL ANSWERS! A) write a regular expression (use regular expression syntax) to represent a floating point number, where the number begiywith an optional sign followed by at least 1 digit , followed by a decimal point and one or more other digits. Ex: -33.9 , +1.11919, 1.0 B) draw a dfsa to represent the regular expression
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY The time taken to execute a given task for A B and C are: A- 10m , 25 s B - 8m , 40s C - 6m, 30s what is the performance of B and C relative to A?
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY FOR ALL
ANSWERS!
JAVA
C) Write a code to define/ derive a new subclass named
superVillan. The SuperVillan object has an objective (like world
domination- string) and a nemesis (SuperHero) Add these attributes
to the sub class. write proper cinstructor
I: Programming rhe following code segment w segment will be used in the epresents a superhero be used in the next two ques blic class Superhero ( private final string private...
NEED ASAP PLEASE WILL GIVE GOOD RATE RIGHT AWAY FOR ALL
ANSWERS!
MULTIPLE CHOICE
no explanation needed
SPRING Cs 424-524 aUESTION 1 12 points each, 30 points total +2 extra) Multiple 1. The main reason to include enumeration types in a programming language is to TEST2 choice: circle or check the best answer a. Make programs run faster b. Improve program readability c. Eliminate unnecessary /O d. Reduce type errors 2. A C++ value parameter is an example of a....
NEED ASAP WILL RATE RIGHT AWAY Construct a truth table and state if the expression is a tautology , contradiction or neither: (P -> Q) ^ (Q -> R) -> (P -> R)
Hi, I need this answered ASAP. I will give you a good rate.
Please make sure you draw the 'LOL Chart'. Thank you.
Question 9 20 pts A pinball machine consists of a spring that is compressed to fire a small ball into the game. How fast is the 5.1 g ball moving when a spring with a k value of 40 N/m is compressed 15 cm? Draw the LOL Chart and solve the problem.
I need both parts done ASAP, this is for
communications and systems 1. please show all work and label what
you are do I g so I can understand it please
1) (20 points) Message signal, m (t) 0.8 cos(2π250), is used to modulate carrier signal, c(t) to produce output y(t). Carefully label your plots: 1.5 co (2π5000t). la) (5 points) Assuming coherent modulation, plot yit)
Hey
guys please give me the answers quickly I need it so quick I will
give you a good rate thank you
11. For the reaction, 2 SO2(g) + O2(g) - 2 SO3(g), at 450.0 K the equilibrium constant, Kc, has a value of 4.62. A system was charged to give these initial concentrations: (SO3) = 0.0254 M, [O2) = 0.00855 M. (SO2) = 0.500 M. In which direction will it go? a. to the right b. to the left...
I need this answered correctly ASAP. Please make sure to do all
parts. If answers are incorrect I will give you a bad rate. Thank
you.
Question 16 10 pts A mass of 7 kg attached to a vertical spring stretches the spring 7 cm from its original equilibrium position. • What is the spring constant? • What is the period of motion of the system? • What is the frequency of the motion?