cpu

What does “rep; nop;” mean in x86 assembly? Is it the same as the “pause” instruction?

吃可爱长大的小学妹 提交于 2019-11-27 06:22:00
What does rep; nop mean? Is it the same as pause instruction? Is it the same as rep nop (without the semi-colon)? What's the difference to the simple nop instruction? Does it behave differently on AMD and Intel processors? (bonus) Where is the official documentation for these instructions? Motivation for this question After some discussion in the comments of another question , I realized that I don't know what rep; nop; means in x86 (or x86-64) assembly. And also I couldn't find a good explanation on the web. I know that rep is a prefix that means "repeat the next instruction cx times" (or at

How processor handles case of division by zero

穿精又带淫゛_ 提交于 2019-11-27 06:15:01
问题 Curious what the processor/CPU does in general or let say, on intel cpu & Linux, when it executes a division by zero instruction. Also how the error is relayed to the application, so that it can log the error or notify the developer? Thank you! 回答1: To answer in general terms, rather than going into gory details for Linux on x86_64, which are likely to obscure the concepts. CPUs tend to throw an exception interrupt, on things like division by zero, or dereferencing a NULL pointer. These

PInvoke for GetLogicalProcessorInformation Function

我的未来我决定 提交于 2019-11-27 06:09:59
问题 I want to call via c#/PInvoke the GetLogicalProcessorInformation function, but I'm stuck with SYSTEM_LOGICAL_PROCESSOR_INFORMATION struct and CACHE_DESCRIPTOR struct. How should I define these structs for correct usage? Main problems: 1. SYSTEM_LOGICAL_PROCESSOR_INFORMATION has union in its definition 2. SYSTEM_LOGICAL_PROCESSOR_INFORMATION has ULONGLONG in its definition 3. CACHE_DESCRIPTOR has WORD and DWORD in its definition. Can you help me with these structures? 回答1: Updated : fixed the

CPU位数,寻址能力,指令集,寄存器位数,操作系统位数

梦想的初衷 提交于 2019-11-27 05:11:37
part 1 CPU位数 = CPU中寄存器的位数 = CPU能够一次并行处理的数据宽度 = 数据总线宽度 操作系统位数 = 其所依赖的指令集位数 <= CPU位数 CPU寻址能力 = 2^S (s为地址总线宽度) <= CPU位数 chenqi@chenqi-OptiPlex-760:/$ cat /proc/cpuinfo | grep -i address address sizes : 36 bits physical, 48 bits virtual 表示物理内存寻址64G,虚拟内存寻址256T. (就是说,内存超过64G的部分也没什么用,硬盘超过256T的部分也没用) Linux下查看系统位数: chenqi@chenqi-OptiPlex-760:/$ getconf LONG_BIT 64 chenqi@chenqi-OptiPlex-760:/$ getconf WORD_BIT 32 上述信息显示这个系统时64位系统。 Linux下查看CPU硬件架构 chenqi@chenqi-OptiPlex-760:/$ arch x86_64 chenqi@chenqi-OptiPlex-760:/$ uname -m x86_64 chenqi@chenqi-OptiPlex-760:/$ echo $HOSTTYPE x86_64 part 2 http://en

How exactly does the callstack work?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 04:59:14
问题 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);

Detecting the number of processors

耗尽温柔 提交于 2019-11-27 04:57:56
How do you detect the number of physical processors/cores in .net? stephbu System.Environment.ProcessorCount returns the number of logical processors http://msdn.microsoft.com/en-us/library/system.environment.processorcount.aspx For physical processor count you'd probably need to use WMI - the following metadata is supported in XP/Win2k3 upwards (Functionality enabled in SP's prior to Vista/Win2k8). Win32_ComputerSystem.NumberOfProcessors returns physical count Win32_ComputerSystem.NumberOfLogicalProcessors returns logical (duh!) Be cautious that HyperThreaded CPUs appear identical to

std::chrono::clock, hardware clock and cycle count

为君一笑 提交于 2019-11-27 04:48:12
问题 std::chrono offer several clocks to measure times. At the same time, I guess the only way a cpu can evaluate time, is by counting cycles. Question 1: Does a cpu or a gpu has any other way to evaluate time than by counting cycles? If that is the case, because the way a computer count cycles will never be as precise as an atomic clock, it means that a "second" ( period = std::ratio<1> ) for a computer can be actually shorter or bigger than an actual second, causing differences in the long run

AES-NI intrinsics enabled by default?

喜夏-厌秋 提交于 2019-11-27 04:23:17
问题 Oracle has this to say about Java 8 with regards to AES-NI: Hardware intrinsics were added to use Advanced Encryption Standard (AES). The UseAES and UseAESIntrinsics flags are available to enable the hardware-based AES intrinsics for Intel hardware. The hardware must be 2010 or newer Westmere hardware. For example, to enable hardware AES, use the following flags: -XX:+UseAES -XX:+UseAESIntrinsics To disable hardware AES use the following flags: -XX:-UseAES -XX:-UseAESIntrinsics But it does

Is setInterval CPU intensive?

半腔热情 提交于 2019-11-27 03:52:50
I read somewhere that setInterval is CPU intensive. I created a script that uses setInterval and monitored the CPU usage but didn't notice a change. I want to know if there is something I missed. What the code does is check for changes to the hash in the URL (content after #) every 100 milliseconds and if it has changed, load a page using AJAX. If it has not changed, nothing happens. Would there be any CPU issues with that. I don't think setInterval is inherently going to cause you significant performance problems. I suspect the reputation may come from an earlier era, when CPUs were less

Finding out the CPU clock frequency (per core, per processor)

人走茶凉 提交于 2019-11-27 03:39:22
Programs like CPUz are very good at giving in depth information about the system (bus speed, memory timings, etc.) However, is there a programmatic way of calculating the per core (and per processor, in multi processor systems with multiple cores per CPU) frequency without having to deal with CPU specific info. I am trying to develop a anti cheating tool (for use with clock limited benchmark competitions) which will be able to record the CPU clock during the benchmark run for all the active cores in the system (across all processors.) I'll expand on my comments here. This is too big and in