What is code blocking? How can you solve it? Please describe two example about your solutions?
Following is the answer:
Blocking:
Blocking means, when one process is running then another process is
blocked untill first process is finished.When First Process is
running then another process is waits till the first process is
complete.
A blocking is the one that returns only :
when the task assigned to it is completed or
it is sure that the task cannot be performed or has failed
To generalize the concept further , we say a blocking call defined
this way has a Timeout of infinity i.e. the call will return IF and
ONLY IF any of the conditions in 1 or 2 is satisfied , and till
then the caller will have to wait and the current thread will be
blocked.
Ex:
Consider the situation where we need to read the content from a
file.

This would comprise of 3 simple steps as depicted above. In above
case each step is depending on the result of it’s predecessor. For
instance, we cannot print the content of the file unless the file
is read. If suppose the operation 1 would have taken 5 sec to
complete followed by 2 and 1 sec for the remaining steps, the
overall process would take 5 + 2 + 1 = 8 sec to complete. And for
this 8 seconds, all the other operations would be blocked.
That is to say, the server would be busy unless the operation completes and therefore would not be able to process other incoming requests.
How to solve:
make callback function to overcome the problem.
When you run first process then it registers a callback event in
function and then run some another task, when first process is
completed then callback function shows the output.So this process
is asynchronous.It avoids code blocking.
example 1:

Code is started reading the file and do not waits for the operation
to complete. Instead it registers a callback event in it’s memory,
and starts doing other stuffs. Once the file reading is complete,
then it remembers the callback it registered lately for this
operation, so it calls that callback and therefore print the
content of the file.
This approach is rather sophisticated as there are no stuffs that’s blocking the execution cycle of the program and the server is free almost every time. Well, this is good. The more the time server is free the more the number of incoming requests it can handle.
example 2:
we have a collaborative application sending emails to users when other users comment on something. Let’s say for arguments sake we have 50 separate emails to send. If we use similar code when someone posts a comment processing will be blocked until all 50 emails have been sent.
So our app can be slowed by:
The time it takes to process 50 emails
A slow network to the mail server
Heavy load on the mail server
Until we return from this the slowness is passed directly to the
user.
Increasingly web applications do not exist on a single server. They are becoming complex networked applications using cloud infrastructures, third-party APIs and services across the internet.
Solution:
In the email example we can use something like mail api to perform these tasks asynchronously. We bring up resque workers as separate processes and use Redis to store bits of data that the workers can use to do their work. It is a great library and very easy to use. Instead of forcing the user to wait until mail is sent we put the task onto a queue and get a worker to execute it.
What is code blocking? How can you solve it? Please describe two example about your solutions?
For this week, please describe in your own words what multithreading is and how can multiple threads run simultaneously on a single-processor system? Provide small code example and the result/output of running your code to demonstrate this behavior. Write a few sentences explaining your code and the result/output of running your code.
Can you solve some problems with Gauss's law spherical geometry? Provide some example problem solutions about Gauss`s law spherical geometry.
Solve the following subnetting questions. Be sure to describe how you came to the solutions. What is the last valid host on the subnet 172.30.96.0/20? What is the broadcast address of the network 172.25.8.0/23? Which subnet does host 172.30.161.65 255.255.254.0 belong to? What is the first valid host on the subnetwork that the node 172.30.189.212 255.255.255.128 belongs to? What valid host range is the IP address 10.37.220.29/20 a part of? How many subnets and hosts per subnet can you get...
Read the sample Matlab code euler.m. Use either this code, or write your own code, to solve first order ODE = f(t,y) dt (a). Consider the autonomous system Use Euler's method to solve the above equation. Try different initial values, plot the graphs, describe the behavior of the solutions, and explain why. You need to find the equilibrium solutions and classify them. (b). Numerically solve the non-autonomous system dy = cost Try different initial values, plot the graphs, describe the...
Can you please give an example of anticonvulsants then describe what it is. Include it is mechanism of action along with one risk and one benefit.
In Linux: - Please describe ( Shell Command-Line Expansion) and provide an example. - Please describe the meaning of ( running a process in the background ) with your example. - Please describe how you can use ( noclobber ) with example.
give an example of how institution can affect an economic growth. You should describe how the institution in your example can promote economic growth?
Solve using R and show R code
Instruction: Please submit your R code along with a brief write-up of the solutions. Some of the questions below can be answered with very little or no programming. However, write code that outputs the final answer and dos not ryuira uper calceulatioms. Q.N. 1) The mammals data set in the MASS package records brain size and body size of 62 different mammals a) Fit a regresion model to describe the relation between brain...
How can you know if a solid is formed when two aqueous ionic solutions are mixed? What is the name of this kind of reaction? Provide an example.
What about the role excites you and motivated you to apply? Please describe your interest in working with us