cpu

Why does this Java code not utilize all CPU cores?

不问归期 提交于 2019-11-27 16:04:23
问题 The attached simple Java code should load all available cpu core when starting it with the right parameters. So for instance, you start it with java VMTest 8 int 0 and it will start 8 threads that do nothing else than looping and adding 2 to an integer. Something that runs in registers and not even allocates new memory. The problem we are facing now is, that we do not get a 24 core machine loaded (AMD 2 sockets with 12 cores each), when running this simple program (with 24 threads of course).

Return address prediction stack buffer vs stack-stored return address?

▼魔方 西西 提交于 2019-11-27 15:36:05
Have been reading Agner Fog's "The microarchitecture of Intel, AMD and VIA CPUs" and on page 34 he describes "return address prediction": http://www.agner.org/optimize/microarchitecture.pdf 3.15 Returns (all processors except P1) A better method is used for returns. A Last-In-First-Out buffer, called the return stack buffer,remembers the return address every time a call instruction is executed, and it uses this for predicting where the corresponding return will go. This mechanism makes sure that return instructions are correctly predicted when the same subroutine is called from several

Execute RDMSR and WRMSR instructions from C/C++ code

那年仲夏 提交于 2019-11-27 15:25:29
问题 I need to control C-State configuration. Specifically, I'd probably like to execute the following asm code: __asm { rdmsr and eax, 0x00 or eax, 0x01 wrmsr } Currently, I got this exception on rdmsr line: Unhandled exception at 0x00e3139e in MessWithCStates.exe: 0xC0000096: Privileged instruction. How can I (permanently) elevate priviliges of my app so it could execute the code above? I use VS 2010. NOTE: It is possible without writing a kernel-mode driver. See R/W Everything . 回答1: Chances

How to get CPU info in C on Linux, such as number of cores? [duplicate]

不羁岁月 提交于 2019-11-27 14:01:21
问题 This question already has an answer here: How to get the number of CPUs in Linux using C? 7 answers Is it possible to get such info by some API or function, rather than parsing the /proc/cpuinfo ? 回答1: From man 5 proc : /proc/cpuinfo This is a collection of CPU and system architecture dependent items, for each supported architecture a different list. Two common entries are processor which gives CPU number and bogomips; a system constant that is calculated during kernel initialization. SMP

What does 'bank'ing a register mean?

跟風遠走 提交于 2019-11-27 13:30:39
问题 Reading 'ARM Architecture' on Wikipedia and found the following statement: Registers R0-R7 are the same across all CPU modes; they are never banked. R13 and R14 are banked across all privileged CPU modes except system mode. What does banking a register mean? 回答1: Register banking refers to providing multiple copies of a register at the same address. Taken from section 1.4.6 of the arm docs The term is referring to a solution for the problem that not all registers can be seen at once. There is

How to read performance counters on i5, i7 CPUs

老子叫甜甜 提交于 2019-11-27 13:10:57
问题 Modern CPUs have quite a lot of performance counters - http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html how to read them? I'm interested in cache misses and branch mispredictions. 回答1: Looks like PAPI has very clean API and works just fine on Ubuntu 11.04. Once it's installed, following app will do what I wanted: #include <stdio.h> #include <stdlib.h> #include <papi.h> #define NUM_EVENTS 4 void

Is bit shifting O(1) or O(n)?

血红的双手。 提交于 2019-11-27 12:22:37
Are shift operations O(1) or O(n) ? Does it make sense that computers generally require more operations to shift 31 places instead of shifting 1 place? Or does it make sense the number of operations required for shifting is constant regardless of how many places we need to shift? PS: wondering if hardware is an appropriate tag.. old_timer Some instruction sets are limited to one bit shift per instruction. And some instruction sets allow you to specify any number of bits to shift in one instruction, which usually takes one clock cycle on modern processors (modern being an intentionally vague

Programmable USB dongles [closed]

六眼飞鱼酱① 提交于 2019-11-27 12:11:31
问题 Where can I buy a programmable USB dongle that supports C as a development language? 回答1: Senselock rockey Aladdin We use Senselock in our application. It is a smart dongle, that you can download your custom code into it. The way it works is that instead of just checking the presence of a dongle, your code should expect a correct output from the dongle emitted from your code inside the dongle. 回答2: One place to start is Hexwax. Try http://www.hexwax.com/Products/expandIO%2DUSB/ which will

Get results of GPU calculations back to the CPU program in OpenGL

这一生的挚爱 提交于 2019-11-27 11:41:53
问题 Is there a way to get results from a shader running on a GPU back to the program running on the CPU? I want to generate a polygon mesh from simple voxel data based on a computational costly algorithm on the GPU but I need the result on the CPU for physics calculations. 回答1: Define "the results"? In general, if you're doing GPGPU-style computations with OpenGL, you are going to need to structure your shaders around the needs of a rendering system. Rendering systems are designed to be one-way:

How to enable support of CPU virtualization on Macbook Pro?

点点圈 提交于 2019-11-27 11:06:46
问题 I have the VirtualBox installed on my Macbook Pro, and I want to install a linux VM on VirtualBox. When I launched the new VM, it prompts that "Your CPU does not support long mode. Use a 32bit distribution." After searching for this problem, I found that support of CPU virtualization is required for this VM. Then I checked on my Macbook and its CPU is i7 which supports virtualization. So I guess the problem is related to the OS or EFI version? OS version: 10.6.8 / EFI version: latest (check