cpu

What are the advantages of a 64-bit processor?

感情迁移 提交于 2019-11-28 08:03:02
Obviously, a 64-bit processor has a 64-bit address space, so you have more than 4 GB of RAM at your disposal. Does compiling the same program as 64-bit and running on a 64-bit CPU have any other advantages that might actually benefit programs that aren't enormous memory hogs? I'm asking about CPUs in general, and Intel-compatible CPUs in particular. There's a great article on Wikipedia about the differences and benefits of 64bit Intel/AMD cpus over their 32 bit versions. It should have all the information you need. Some on the key differences are: 16 general purpose registers instead of 8

Alignment along 4-byte boundaries

橙三吉。 提交于 2019-11-28 06:03:54
I recently got thinking about alignment... It's something that we don't ordinarily have to consider, but I've realized that some processors require objects to be aligned along 4-byte boundaries. What exactly does this mean, and which specific systems have alignment requirements? Suppose I have an arbitrary pointer: unsigned char* ptr Now, I'm trying to retrieve a double value from a memory location: double d = **((double*)ptr); Is this going to cause problems? It can definitely cause problems on some systems. For example, on ARM-based systems you cannot address a 32-bit word that is not

How has CPU architecture evolution affected virtual function call performance?

柔情痞子 提交于 2019-11-28 05:48:29
Years ago I was learning about x86 assembler, CPU pipelining, cache misses, branch prediction, and all that jazz. It was a tale of two halves. I read about all the wonderful advantages of the lengthy pipelines in the processor viz instruction reordering, cache preloading, dependency interleaving, etc. The downside was that any deviation for the norm was enormously costly. For example, IIRC a certain AMD processor in the early-gigahertz era had a 40 cycle penalty every time you called a function through a pointer (!) and this was apparently normal. This is not a negligible "don't worry about it

VisualVM and Self Time

守給你的承諾、 提交于 2019-11-28 05:37:38
I've been searching all over for a consistent and clear explanation of what 'self time' actually refers to in the VisualVM context and how does it differ to 'self time (cpu)'. Also does 'self time [%]' refer to self time or self time cpu. There doesn't appear to be much documentation on this or at least I haven't found it. So any thoughts/input will be appreciated. Tomas Hurka Self Time is a wall-clock time spent in the method itself ( includes time waiting/sleeping ). Self Time (CPU) is a time processor time , so it does NOT include time spent waiting, sleeping , etc. Both columns do NOT

Profiled app with YourKit, still can't identify the CPU hog

帅比萌擦擦* 提交于 2019-11-28 04:58:37
问题 I've got a Java application that is consuming 100% of the CPU most of the time (as indicated by cacti and top monitoring). We fired up YourKit (which confirms the CPU resource issue) and it identifies java.net.SocketInputStream.read(byte[], int, int) as the biggest hot spot at 15% of time. I believe they aren't accurately measuring CPU time for methods that perform blocking IO like SocketInputStream.read would. There are 6 other identified hot spots, but they account for less than 20% of

Throttling CPU/Memory usage of a Thread in Java?

拥有回忆 提交于 2019-11-28 03:15:39
I'm writing an application that will have multiple threads running, and want to throttle the CPU/memory usage of those threads. There is a similar question for C++ , but I want to try and avoid using C++ and JNI if possible. I realize this might not be possible using a higher level language, but I'm curious to see if anyone has any ideas. EDIT: Added a bounty; I'd like some really good, well thought out ideas on this. EDIT 2: The situation I need this for is executing other people's code on my server. Basically it is completely arbitrary code, with the only guarantee being that there will be a

Accurate calculation of CPU usage given in percentage in Linux?

前提是你 提交于 2019-11-28 03:06:16
It's a question which has been asked many times, however there is no well supported answer I could find. Many people suggest the use of top command, but if you run top once (because you have a script for example collecting Cpu usage every 1 second) it will always give the same Cpu usage result ( example 1 , example 2 ). A more accurate way to calculate CPU usage, is by reading the values from /proc/stat , but most of the answers use only the first 4 fields from /proc/stat to calculate it (one example here ). /proc/stat/ has 10 fields per CPU core as of Linux kernel 2.6.33! I also found this

When are x86 LFENCE, SFENCE and MFENCE instructions required?

断了今生、忘了曾经 提交于 2019-11-28 02:59:21
Ok, I have been reading the following Qs from SO regarding x86 CPU fences ( LFENCE , SFENCE and MFENCE ): Does it make any sense instruction LFENCE in processors x86/x86_64? What is the impact SFENCE and LFENCE to caches of neighboring cores? Is the MESI protocol enough, or are memory barriers still required? (Intel CPUs) and: http://www.puppetmastertrading.com/images/hwViewForSwHackers.pdf https://onedrive.live.com/view.aspx?resid=4E86B0CF20EF15AD!24884&app=WordPdf&authkey=!AMtj_EflYn2507c and I must be honest I am still not totally sure when a fence is required. I am trying to understand

Linux Process States

 ̄綄美尐妖づ 提交于 2019-11-28 02:49:52
In Linux, what happens to the state of a process when it needs to read blocks from a disk? Is it blocked? If so, how is another process chosen to execute? Tim Post While waiting for read() or write() to/from a file descriptor return, the process will be put in a special kind of sleep, known as "D" or "Disk Sleep". This is special, because the process can not be killed or interrupted while in such a state. A process waiting for a return from ioctl() would also be put to sleep in this manner. An exception to this is when a file (such as a terminal or other character device) is opened in O

How exactly does the callstack work?

可紊 提交于 2019-11-28 02:36:43
I'm trying to get a deeper understanding of how the low level operations of programming languages work and especially how they interact with the OS/CPU. I've probably read every answer in every stack/heap related thread here on Stack Overflow, and they are all brilliant. But there is still one thing that I didn't fully understand yet. Consider this function in pseudo code which tends to be valid Rust code ;-) fn foo() { let a = 1; let b = 2; let c = 3; let d = 4; // line X doSomething(a, b); doAnotherThing(c, d); } This is how I assume the stack to look like on line X: Stack a +-------------+