cpu

When can the CPU ignore the LOCK prefix and use cache coherency?

馋奶兔 提交于 2019-12-21 01:58:27
问题 I originally thought cache coherency protocols such as MESI can provide pseudo-atomicity but only across individual memory-load/store instructions. If I was performing a fetch, modify, write combination of instructions, MESI-alone wouldn't be able to enforce atomicity across the first instruction to the last. However, section 8 of the Intel reference manual Vol 3a says: 8.1.4 Effects of a LOCK Operation on Internal Processor Caches For the P6 and more recent processor families, if the area of

Do normal x86 or AMD PCs run startup/BIOS code directly from ROM, or do they copy it first to RAM? [closed]

会有一股神秘感。 提交于 2019-12-20 12:23:50
问题 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 3 years ago . I understand modern computers have modified Harvard architectures. Can the fact that they can read instructions from somewhere other than where they hold data allow them to fetch instructions directly from ROM chips? Do they load the BIOS to RAM first, or do they execute it directly from the chip? I don't have a

How to find out if a shared hosting is running 32 or 64 bit - with php

余生颓废 提交于 2019-12-20 10:34:52
问题 Is it possible to identify Linux 32 or 64 bit, using PHP? phpinfo() returns Linux infong 2.4 #1 SMP Mon Oct 10 09:34:36 UTC 2011 i686 GNU/Linux It's shared hosting so I cant use command line. 回答1: Do a simple test: var_dump(is_int( 9223372036854775807 )); For 32-bit environment it will return false as this number is much bigger that maximum 32-bit integer. For 64-bit environment it will return true. Or use PHP_INT_MAX as mario suggested in comments. echo (PHP_INT_MAX == 2147483647)?'32-bit':

How do machines interpret binary?

折月煮酒 提交于 2019-12-20 09:47:09
问题 I was just thinking, how do machines interpreter binary code? All I understand is your code get's turned into 1 and 0's so the machine can understand them, but how do they do that? Is it just a normal text to binary translation? 回答1: First, "binary" doesn't mean what you think it means (any data on the computer, including text is already binary, it just the way we decide to display and handle is different). Second, compilation is not a simple transformation to funny characters (if it were, we

Processor/socket affinity in openMPI?

让人想犯罪 __ 提交于 2019-12-20 09:45:47
问题 I know,there are some basic function in openMPI implementation for mapping the different processes to different cores of different sockets(if the system have more than one sockets). --bind-to-socket (first come first serve) --bysocket (round-robin,based on load balencing) --npersocket N (assign N processes to each socket) --npersocket N --bysocket (assign N process to each socket , but in a round-robin basis) --bind-to-core (binds one process to each core in a sequential fashion) --bind-to

Out of Order Execution and Memory Fences

主宰稳场 提交于 2019-12-20 09:41:17
问题 I know that modern CPUs can execute out of order, However they always retire the results in-order, as described by wikipedia. "Out of Oder processors fill these "slots" in time with other instructions that are ready, then re-order the results at the end to make it appear that the instructions were processed as normal. " Now memory fences are said to be required when using multicore platforms, because owing to Out of Order execution, wrong value of x can be printed here. Processor #1: while f

What is a clock cycle and clock speed?

你离开我真会死。 提交于 2019-12-20 09:36:25
问题 I have been reading a book about the Computer's Processor. And i came across some of the terms like clock Ticks, clock Cycle and Clock Speed that i am finding very difficult to understand. I will be very thankful if someone can clarify this in a simple language. Thanks in advance ! 回答1: Clock Cycle is the speed of a computer processor, or CPU, is determined by the clock cycle, which is the amount of time between two pulses of an oscillator. Generally speaking, the higher number of pulses per

How was the first computer program created? [duplicate]

大城市里の小女人 提交于 2019-12-20 09:20:19
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How was the first compiler written? This question has always been bothering me. To compile a program, you need a compiler, which is also a type of program, so what compiled the compiler? Somebody told me that the first compilers were written in assembly or machine code. But thinking about that, that is still not the complete story. After all, how does the machine code go from the hard drive to RAM to the CPU

PHP script keeps doing mmap/munmap

瘦欲@ 提交于 2019-12-20 05:16:23
问题 My PHP script contains a loop, which does nothing much more than echoing and dereferencing pointers (like in $tab[$othertab[$i]]-> stuff). It was working great until yesterday, when this script starting being VERY slow (like 50 times slower than before). After using strace, i figured out that 90% of the time, the script does mmap/munmap. Here is a random portion of the strace log : mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fac0156c000 munmap

During an x86 software interrupt, when exactly is a context switch made?

ぐ巨炮叔叔 提交于 2019-12-20 03:32:29
问题 I am asking this because I am trying to implement interrupts in my toy kernel. So, I know that when an interrupt occurs, the CPU pushes various bits of information onto the stack. However, everywhere I search online shows different information in different order being pushed. I also know that if the interrupt occurred in user mode (Ring 3), the CPU must switch to kernel mode (Ring 0) before it can execute the ISR. I think it has something to do with the TSS and ss and esp , however I am not