multicore

How can I get the CPU core number from within a user-space app (Linux, C)?

社会主义新天地 提交于 2019-11-27 08:39:23
Presumably there is a library or simple asm blob that can get me the number of the current CPU that I am executing on. Use sched_getcpu to determine the CPU on which the calling thread is running. See man getcpu (the system call) and man sched_getcpu (a library wrapper). However, note what it says: The information placed in cpu is only guaranteed to be current at the time of the call: unless the CPU affinity has been fixed using sched_setaffinity(2), the kernel might change the CPU at any time. (Normally this does not happen because the scheduler tries to minimize movements between CPUs to

Is volatile bool for thread control considered wrong?

二次信任 提交于 2019-11-27 07:26:48
As a result of my answer to this question , I started reading about the keyword volatile and what the consensus is regarding it. I see there is a lot of information about it, some old which seems wrong now and a lot new which says it has almost no place in multi-threaded programming. Hence, I'd like to clarify a specific usage (couldn't find an exact answer here on SO). I also want to point out I do understand the requirements for writing multi-threaded code in general and why volatile is not solving things. Still, I see code using volatile for thread control in code bases I work in. Further,

Can I force cache coherency on a multicore x86 CPU?

浪子不回头ぞ 提交于 2019-11-27 06:19:33
The other week, I wrote a little thread class and a one-way message pipe to allow communication between threads (two pipes per thread, obviously, for bidirectional communication). Everything worked fine on my Athlon 64 X2, but I was wondering if I'd run into any problems if both threads were looking at the same variable and the local cached value for this variable on each core was out of sync. I know the volatile keyword will force a variable to refresh from memory, but is there a way on multicore x86 processors to force the caches of all cores to synchronize? Is this something I need to worry

I need to call accurate CPU usage of a single process

狂风中的少年 提交于 2019-11-27 06:08:08
问题 The Trick is I also need to be able to do it on multi core machines. My education in C# is a tad broken. I have managed the following code. Can anyone help me out? Iv tried using the "_Total" flag and I have tried modifying some other code snippets that looked like they tried to detect the amount of cores. I was told however they did not include HT and only supported physical not logical processors. I was trying to get it to do both. Apparently their is a way to manually do this using (

Was Visual Studio 2008, 2010 or 2012 (v11) written to use multi cores?

独自空忆成欢 提交于 2019-11-27 05:54:54
问题 Basically i want to know if the visual studio IDE and/or compiler in 2010 and 2012 was written to make use of a multi core environment (i understand we can target multi core environments in all versions using parallelism, but that is not my question). I am trying to decide on if i should get a higher clock dual core or a lower clock quad core, as i want to try and figure out which processor will give me the absolute best possible experience with Visual Studio 2010 or 2012 (v11) (ide and

What's the status of multicore programming in Haskell?

放肆的年华 提交于 2019-11-27 05:44:48
What's the status of multicore programming in Haskell? What projects, tools, and libraries are available now? What experience reports have there been? Don Stewart In the 2009-2012 period, the following things have happened: 2012: From 2012, the parallel Haskell status updates began appearing in the Parallel Haskell Digest . 2011: Parallel and Concurrent Programming in Haskell , a tutorial. version 1.1 released by Simon Marlow Haskell and parallelism , mentioned in an article in the Economist magazine, Jun 2nd 2011. Parallel tree scans via composition , an article by Conal Elliott Numeric

How do interrupts in multicore/multicpu machines work?

余生颓废 提交于 2019-11-27 05:20:46
问题 I recently started diving into low level OS programming. I am (very slowly) currently working through two older books, XINU and Build Your Own 32 Bit OS, as well as some resources suggested by the fine SO folks in my previous question, How to get started in operating system development. It could just be that I haven't encountered it in any of those resources yet, but its probably because most of these resources were written before ubiquitous multicore systems, but what I'm wondering is how

How to optimize the following code with nested while-loop? Multicore an option?

筅森魡賤 提交于 2019-11-27 03:50:24
问题 I am having a challenge with a piece of code that takes very long to execute and I am wondering what are the key tricks to optimize the execution time of this code. I have to admit that the input data.frame is significant (140,000 rows) and that the output data.frame is approximately 220,000 rows. A sample of the input data.frame: head(extremes) X_BusinessIDDescription min max month ID105 2007-12-01 2008-06-01 2007-12-01 ID206 2007-12-01 2009-07-01 2007-12-01 ID204 2007-12-01 2008-02-01 2007

Get GNU Octave to work with a multicore processor. (Multithreading)

孤街醉人 提交于 2019-11-27 03:10:42
问题 I want to be able to program multiple threads with gnu octave so it will utilize multiple processors. I installed GNU Octave on Fedora 17 Linux and did the following: yum install octave Which installed on my computer the latest version of octave, 3.6.2. It works great, however when you multiply two huge matrices together it bogs down the one CPU that octave uses. It would be nice if the matrix multiplication utilizes all of the cores, since in this case the CPU is obviously the bottleneck.

x86 LOCK question on multi-core CPUs

余生颓废 提交于 2019-11-27 03:01:34
Is it true that the x86 ASM "LOCK" command prefix causes all cores to freeze while the instruction following "LOCK" is being executed? I read this in a blog post and it doesn't make sense. I can't find anything that indicates if this is true or not. It's about locking the memory bus for that address. The Intel 64 and IA-32 Architectures Software Developer's Manual - Volume 3A: System Programming Guide, Part 1 tells us: 7.1.4 Effects of a LOCK Operation on Internal Processor Caches. For the Intel486 and Pentium processors, the LOCK# signal is always asserted on the bus during a LOCK operation,