cpu

CPU throttling in C++

我的梦境 提交于 2019-12-04 10:10:18
问题 I was just wondering if there is an elegant way to set the maximum CPU load for a particular thread doing intensive calculations. Right now I have located the most time consuming loop in the thread (it does only compression) and use GetTickCount() and Sleep() with hardcoded values. It makes sure that the loop continues for a certain period of time and than sleeps for a certain minimal time. It more or less does the job i.e. guarantees that the thread will not use more than 50% of CPU. However

linux high kernel cpu usage on memory initialization

柔情痞子 提交于 2019-12-04 09:33:44
问题 I have a problem with high CPU cunsumption by the linux kernel, while bootstrapping my java applications on server. This problem occurs only in production, on dev servers everything is light-speed. upd9: There was two question about this issue: How to fix it? - Nominal Animal suggested to sync and drop everything, and it really helps. sudo sh -c 'sync ; echo 3 > /proc/sys/vm/drop_caches ; Works. upd12: But indeed sync is enough. Why this happening? - It is still open for me, I do understand

Getting CPU or motherboard serial number?

99封情书 提交于 2019-12-04 09:03:38
I'm trying to get the CPU serial or motherboard serial using C or Python for licensing purposes. Is it possible? I'm using Linux . You need to use the CPUID instruction. CPUID Most C compilers have some support for inline assembly, but you will need to know what you are doing. Under Linux, you could use "lshw -quiet -xml" and parse its output. You'll find plenty of system information here: cpuid, motherboard id and much more. You can get the CPUID. Maybe linux command 'dmidecode' can help you. You can exec this command,or load the source code of "dmidecode". Next is the output of "dmidecode -t

How does the cache coherency protocol enforce atomicity?

我的梦境 提交于 2019-12-04 06:36:50
I understand atomicity can be guaranteed on operations like xsub() , without using the LOCK prefix, by relying on the cache coherency protocol (MESI/MESIF). 1) How can the cache coherency protocol do this??? Its making me wonder if the cache coherency protocol can enforce atomicity, why do we need special atomic types/instructions etc? 2) If MOSI implements atomic instructions across multi-core systems then what is the purpose of LOCK ? Legacy? 3) If MOSI implements atomic instructions and MOSI is used for all instructions- then why do atomic instructions cost so much? Surely the performance

Are extended instruction sets (SSE, MMX) used in Linux kernel?

喜欢而已 提交于 2019-12-04 06:25:18
Well, they bring (should bring at least) great increase in performance, isn’t it? So, I haven’t seen any Linux kernel sources, but ‘d love to ask: are they used somehow? (In this case – there must be some special “code-cap” for system that has no such instructions?) The SSE and MMX instruction sets have limited value outside of audio/video and gaming work. You might find a few explicit uses in dark corners of the kernel, but I wouldn't count on it. The answer in the general case is "no, they are not used", nor are they used in most non-kernel/userspace applications. The kernel does sometimes

Does OpenACC take away from the normal GPU Rendering?

不羁岁月 提交于 2019-12-04 06:13:06
问题 I'm trying to figure out if I can use OpenACC in place of normal CPU serial execution calls. Usually my programming is all about 3D programming, or uses the GPU normally in some way. I.E. Image processing, or some other type of rendering that requires the use of shaders. I'm trying to figure out if this Library would benefit me or not. The reason I ask this is because if I'm rendering 3D Graphics (as fast as possible) would it slow down that process in away? Or is it able to maintain it's (in

Trying to disable Processor idle states (C states) on Windows PC

我的梦境 提交于 2019-12-04 05:26:56
I need to prevent the processor from entering an idle state (non C0 C state). Admittedly I do not know much about processor C and P states so bear with me. We use a camera from a third party vendor which occasionally delivers corrupted frames. The vendor has determined that when the CPU enters an idle state it interferes with the transmission of the frame over the firewire. To confirm this I used the following code on a Windows 7 PC and indeed, disabling the idle states resolved the issue. //WIN7 const DWORD DISABLED = 1; const DWORD ENABLED = 0; GUID *scheme; PowerGetActiveScheme(NULL,

What is the purpose of hard disk direct memory access?

若如初见. 提交于 2019-12-04 04:31:10
At first glance it seems like a good idea to let the hard disk write to RAM on its own, without CPU instructions copying data, particularly with the success of asynchronous networking in mind. But the Wikipedia article on Direct Memory Access (DMA) states this: With DMA, the CPU gets freed from this overhead and can do useful tasks during data transfer (though the CPU bus would be partly blocked by DMA). I don't understand how a bus line can be "partly blocked". Presumably memory can be accessed by one device at the time, and it then seems like there is little useful work the CPU can actually

How does Spectre attack read the cache it tricked CPU to load?

戏子无情 提交于 2019-12-04 03:23:46
I understand the part of the paper where they trick the CPU to speculatively load the part of the victim memory into the CPU cache. Part I do not understand is how they retrieve it from cache. They don't retrieve it directly (out of bounds read bytes are not "retired" by the CPU and cannot be seen by the attacker in the attack). A vector of attack is to do the "retrieval" a bit at a time. After the CPU cache has been prepared (flushing the cache where it has to be), and has been "taught" that a if branch goes through while the condition relies on non-cached data, the CPU speculatively executes

Is there a CPU that runs Java in microcode? [closed]

こ雲淡風輕ζ 提交于 2019-12-04 02:02:15
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Java is a beautifully crafted OO language but the first thing I noticed is how slow it is (compared to C++). This is probably because it has to go through another layer of translation (the VM) instead of running directly in the CPU's native microcode. My question: Do you know of any attempts to create Java-specific CPU's that run Java natively without requiring the software-implemented VM? Sun