Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
How exactly does the processor handle this division by zero condition?
A divide by zero condition occurs when in a divide operation the
divisor turns out to be a zero as there is no binary representation for
infinity. The ALU cannot handle it.
Does different processor have different way of handling it?
I am a new at this topic and all the articles on the Internet contradict other.
It depends on the ISA. For example, x86 raises a #DE exception (same as divide overflow when the quotient doesn't fit in one register). ARM doesn't fault, you just get 0 in the destination. Division by zero not causing runtime exception on Nvidia Jetson.
(ARM division instructions only have a dividend 1 register wide, unlike x86 where the dividend is twice as wide as the divisor or quotient. ARM division can thus only overflow on INT_MIN/-1, other than divide-by-zero.)
In terms of an ALU, you have to build one that checks for that and handles it as a special case. What the rest of the CPU's internal logic does
(I'm assuming you mean integer division; FP usually runs with exceptions masked...)
What the OS does with a division exception depends on the OS. But if it's Unix-like, it has to deliver SIGFPE (arithmetic exception) to the offending process. Of course at that point it's no longer CPU-architecture, but software.
On which platforms does integer divide by zero trigger a floating point exception?
Why does integer division by -1 (negative one) result in FPE? (ARM vs. x86 difference)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
There is another question with this same title, but the question is asked differently than what's troubling me, and the answer is not sufficient.
The most prominent analogies I hear to explain bandwidth are the highway example, and the pipe example. In the highway example, bandwidth is the amount of cars that can drive on the highway in a given amount of time, and in the pipe its an amount of water that can flow through.
My question is - by measuring by cars per second, or liters per second, does that mean that a longer highway, pipe or copper wire has a higher bandwidth than a shorter one? That seems strange to me.
Wouldn't it make more sense to give the highway bandwidth as the amount of lanes it has - irrespective of a unit of time? It just makes more sense to me and is simpler to say that the pipe is "1 foot in diameter" rather than "it carries 100 litres per second".
Why do we measure bandwidth in bits per second and not just in bits?
"My question is - by measuring by cars per second, or liters per second, does that mean that a longer highway, pipe or copper wire has a higher bandwidth than a shorter one?"
No!
Bandwidth is not about how many cars can fit on the road. It's about how many cars can pass a point on the road during a certain time. How many cars per second can pass under a bridge, for example.
No, it wouldn't. You quote a highway in terms of lanes, because it's more understandable, and a reasonable approximation to assume 4 lanes = 4x as much traffic. But even then, you might have a traffic jam, and then 4 lanes is 'transmitting' fewer cars per minute than it would otherwise.
With a hose pipe, the width of the pipe is the speed of transmission if you assume the same water pressure.
These assumptions don't apply to communications - when I'm transmitting 'a bit' nothing physical is moving *. A 'bit' is the smallest piece that 'information' can be broken down into, and in order to transmit it, something needs to change.
If I turn on my torch and shine it at you, I've sent one 'message' (my torch is on). To send you anything more detailed, I would need to turn it off and on again - morse code is an example of doing this. The pattern of switching it off and on gives you some letters. How fast I can switch it off and on again, is how fast I can send a message.
So it is with bandwidth. I need to change things to communicate. If I can change things faster, I can communicate faster.
"bits" would be a measure of the number of torches I own. Bits per second is how fast I can flick them on and off to send a message.
* Electrons and photons do move, as does air to carry sound. But the signal isn't the thing moving - I don't have to move an atom of air from my mouth to your ear to 'talk' to you, the wave propagates through the medium.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
If a RAM has 32 bits in its MAR(memory address register) and its MDR (Memory data register) is 16 bits wide, then what is the capacity of RAM.
My probable solution is that it can address upto 2^32 locations.
Your solution is incorrect. The question is what the capacity is, not the number of addressable locations. Your answer should be measured in units of storage (e.g, bits, bytes, or their multiples).
Since this is clearly a homework problem, I'm not going to give an exact answer. But I will point you in the right direction by asking some additional questions:
What is the memory data register used for? (Refer to your textbook if you're not sure.)
What is the capacity of the memory data register? (The answer is in the question. Don't think about it too hard.)
With that in mind, what is the capacity of the memory?
Yes, that sounds right. If a microprocessor or CPU has a memory address register with a size of 32 bits, it can access 232 locations, as 32 binary bits used in combination allow you to handle 232 different values starting from 0 to 4294967295 (232 - 1).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a Xeon phi coprocessor 7120P.
When i run micinfo, i see board SKU to be C0PRQ-7120 P/A/X/D.
I notice that the SMC HW Revision states Product 300W Passive CS and i read on tomshardware that P stands for passive cooling for the intel xeon phi familiy devices.
Is this it or is there any other way to tell which device i have on my system 7120 P/A/X or D?
From the specs given on ark.intel.com, all four devices appear to be same.
Can some one elaborate on what are the actual differences between these devices.
The A/P/X/D variants of the Intel Xeon Phi Coprocessor 7120 are different form factors with different cooling. The codes are: A = active, that is, with fan; P = passive, that is, air stream needs to be supplied from chassis fans; D = dense, special form factor for very dense design; X is a special form factor for manufacturers that want to make their individual designs.
The CPU and memory of these coprocessor versions is the same in all four cases.
Cheers,
-michael
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have a question on speed up application built by MATLAB software, i need to know the affect of using vectorization and parallel computation on speed up the application ? and if there is better method than both previous way in such case ? thanks
The first thing you need to do when your MATLAB code runs too slow is to run it in the profiler. In recent versions of MATLAB, this can by done by pressing the "Run and Time" button on the main toolbar. This way, you will now which functions and which lines in these function take up the most time. Once you know this, you may do one of the following, depending on your circumstances and the nature of the particular piece of code:
Think if your algorithm is the most optimal one in terms of O() complexity.
Try turning loops into vector operations. The efficacy of this has declined in recent versions of MATLAB because of improvements in how loops are executed.
If you have a multi-core CPU try using the parallel computing toolbox. If your code parallelizes well, you will get a sped up nearly equal to the number of cores.
If you have an nVidia GPU try using the GPU support. You can get a speed-up by a factor of 10 or more with some problems, but not all problems are amicable to this sort of optimization.
If everything else fails, you may outsource the slowest piece of your code to a low level language like C. See here for how to do this. You could then use low-level profiling tools like Intel vTune to get the absolute maximum speed from the low-level code.
If it is still too slow, you may need to buy an FPGA. See here for a brief tutorial.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
It is said, "If a negative edge cycle is reachable from the source than the algorithm returns false".
What does this "reachable from source indicates"?
Look at the following image:
Can you give me some example in which this algorithm will return false if there exist a negative edge cycle reachable from source.
Note: I am new to algorithms.
What that means is that if there exists a cycle that has a total weight that is negative, then the algorithm cannot give an answer because repeatedly following the cycle "reduces" the weight of the path. I don't see any negative weight cycles (by inspection) in the graph you show, so the stated limitation shouldn't be a concern in your case.
Edit: "reachable from source" means that the negative weight cycle is only a concern if it is reachable - meaning that a path from the specified source to some node in the negative weight cycle exists - from the start or source node. Bellman Ford finds the shortest path from a distinguished node to all nodes reachable from that node. Does that make sense?
When the algorithm is used to find shortest paths, the existence of negative cycles is a problem, preventing the algorithm from finding a correct answer. However, since it terminates upon finding a negative cycle, the Bellman-Ford algorithm can be used for applications in which this is the target to be sought - for example in cycle-cancelling techniques in network flow analysis.
Please refer this link:- http://evlm.stuba.sk/~partner2/DBfiles/Optimization/Dynamical%20optimization/Optimization_EN_Ford-Belman_algorithm.pdf