cpu

Controlling the fan speed and detecting the inside temperature of the pc with python?

我的梦境 提交于 2019-12-01 17:44:52
Since my pc's fan is very loud, I'd like to make myself a program to "shut it up" when it's not required to be running at full speed. I want to make it with python, so is there any module that can detect the temperature and/or set the fan speed? Seth You might be able to do it in WMI . There's a related question here . Cheeso Don't use python, or WMI. If you have Windows, and if you can't use speedfan, this is best done in the BIOS layer, with Microsoft's ASL Compiler . Using that, you can set temp thresholds for various fan speeds. It works nicely. Be careful though. This will void your

Do modern cpus skip multiplications by zero?

穿精又带淫゛_ 提交于 2019-12-01 17:11:20
问题 I would like to know if current cpus avoid multiplying two numbers when at least one of them is a zero. Thanks 回答1: Modern CPUs - what do you mean by that? Do you mean most commonly used (like x86, AMD64, ARM) or most recently developed. Every processor architecture has it's own properties. Moreover, each company (like Intel or AMD) can make processor different way (that usually being company secret). As you question goes, I doubt that. You know, even checking if number is equal to zero twice

What is -(-128) for signed single byte char in C?

十年热恋 提交于 2019-12-01 17:10:07
问题 My little program: #include <stdio.h> int main() { signed char c = -128; c = -c; printf("%d", c); return 0; } print: -128 Is minus (-) operator portable across CPU? 回答1: The operand of the unary minus first undergoes standard promitions, so it is of type int , which can represent the value -128 . The result of the operation is the value 128 , also of type int . The conversion from int to signed char , being a narrowing of signed types, is implementation-defined. (Your implementation seems to

How can Intel and AMD be different but still compatible?

白昼怎懂夜的黑 提交于 2019-12-01 14:44:27
As I have always understood it, AMD built their CPUs by reverse engineering Intel's instruction set and now pay Intel to use their instruction set, and Intel do the same for AMDs 64-bit instructions. This is how windows can be installed on both types of CPUs without needing to purchase a specific build, such as a version compiled for ARM, and so all apps, games etc work in the same way, working interchangeable on CPUs... However lately some things have been making me question some of this... Firstly, I've noticed some games have been a bit laggy on my system (AMD) and after reading it turns

Python - wait on a condition without high cpu usage

烈酒焚心 提交于 2019-12-01 14:23:33
In this case, say I wanted to wait on a condition to happen, that may happen at any random time. while True: if condition: #Do Whatever else: pass As you can see, pass will just happen until the condition is True. But while the condition isn't True the cpu is being pegged with pass causing higher cpu usage, when I simply just want it to wait until the condition occurs. How may I do this? See Busy_loop#Busy-waiting_alternatives : Most operating systems and threading libraries provide a variety of system calls that will block the process on an event, such as lock acquisition, timer changes, I/O

How can Intel and AMD be different but still compatible?

本秂侑毒 提交于 2019-12-01 14:01:44
问题 As I have always understood it, AMD built their CPUs by reverse engineering Intel's instruction set and now pay Intel to use their instruction set, and Intel do the same for AMDs 64-bit instructions. This is how windows can be installed on both types of CPUs without needing to purchase a specific build, such as a version compiled for ARM, and so all apps, games etc work in the same way, working interchangeable on CPUs... However lately some things have been making me question some of this...

c++ using too much cpu

不想你离开。 提交于 2019-12-01 12:41:19
ok im creating a game but it uses too much cpu but it doesn't uses too much memory. the cpu does increase and decrease. i have too many timers in my game, i kill the timer when i don't use it any more so that should cause a problem but what i think that causes the problem is there is too many messages in my message qeue. i have new laptop it is 5 months old and it has a high cpu. it uses about 40% of my cpu. is there way to reduce it because when it gets to 40% the game slows down. here is my code // Xstrike.cpp : Defines the entry point for the application. // #include "stdafx.h" #include

c++ using too much cpu

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 12:16:23
问题 ok im creating a game but it uses too much cpu but it doesn't uses too much memory. the cpu does increase and decrease. i have too many timers in my game, i kill the timer when i don't use it any more so that should cause a problem but what i think that causes the problem is there is too many messages in my message qeue. i have new laptop it is 5 months old and it has a high cpu. it uses about 40% of my cpu. is there way to reduce it because when it gets to 40% the game slows down. here is my

i.MX35 suspend CPU and DDR2 from IRAM

≡放荡痞女 提交于 2019-12-01 10:41:07
I have to put my device into a very deep low power mode from Linux 2.6.38 and therefore, it's necessary to suspend all components, including CPU und DDR2. What I found out so far is that I have to copy the core assembler function into the processor's internal memory and execute it from there. Basically, it looks like this: cpaddr = iram_alloc(SZ_1K, &iram_addr); if(!cpaddr) return -ENOMEM; suspend_iram_base = __arm_ioremap(iram_addr, SZ_1K, MT_HIGH_VECTORS); memcpy(suspend_iram_base, cpu_v6_sdram_off, SZ_1K); flush_icache_range(suspend_iram_base, suspend_iram_base + SZ_1K); flush_cache_all();

Get hardware information from /proc filesytem in Linux

早过忘川 提交于 2019-12-01 10:26:28
I use execv to run lshw command to get the CPU, disk, and memory in C code. But I would like to search another solution to get these information from /proc or any other existed data. Have any suggestion? Here is my code: char *params[9] = {"/usr/bin/lshw", "-short", "-c", "disk", "-c", "memory", "-c", "processor", 0}; //cmd params filled execv(params[0], params); Linux command: $ sudo lshw -short -c disk -c processor -c memory $ sudo lshw -short -c disk -c processor -c memory H/W path Device Class Description ====================================================== /0/0 memory 64KiB BIOS /0/22