I want to run a server with user-written scripts. But these scripts should only use one core (which should be the one with the lowest usage because there will be many concurrent scripts). Also I need to limit time and RAM for them.  Is there an easy way to achieve this, or do I need to check which core has the lowest usage and assign it to it via e.g. ulimit?
121879
I need to externally limit a process/session to a certain number of cores.  Are there any other possibilities than CPU affinity (I don't like the need to specify the actual cores) and cgroups (hard to integrate into our project)?
113829
I have a core .NET application that needs to spawn an abitrary number of sub processes. These processes need to be able to access some form of state object in the core application.  What is the best technique? I'll be moving a large amount of data between processes (Bitmaps), so it needs to be fast.
35006
I wrote a bash script that executes a Java jar for a n number of times.  In practice, I defined e foo() function, containing the invocation of the jar, and then I run this script:  for RUN in $(seq 1 $RUNS)  do      foo &amp;  done   Now, I would like to not execute runs times in parallel the jar. There is a wait to limit the number of parallel execution (like a wait every 10 process for instance)?
59383
Is Kernel space used when Kernel is executing on the behalf of the user program i.e. System Call? Or is it the address space for all the Kernel threads (for example scheduler)?  If it is the first one, than does it mean that normal user program cannot have more than 3GB of memory (if the division is 3GB + 1GB)? Also, in that case how can kernel use High Memory, because to what virtual memory address will the pages from high memory be mapped to, as 1GB of kernel space will be logically mapped?
64312
I am thinking of getting a dual Intel Xeon machine, each CPU is a quad core.  Will Ubuntu utilize both processors, especially with both being quad core, optimally?  Wanting to do Video editing and processing, but the Xeon machine's clock speed is actually slower than my current computer, so if both procs are not being used, I will actually end up with a slower machine than I already have.  I am not too familiar with dual processor machines. Thanks in advance for any answers.
24737
Lets say I have a loop in Bash:  for foo in `some-command` do    do-something $foo done   do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something's at once.  The naive approach seems to be:  for foo in `some-command` do    do-something $foo &amp; done   This will run all do-somethings at once, but there are a couple downsides, mainly that do-something may also have some significant I/O which performing all at once might slow down a bit. The other problem is that this code block returns immediately, so no way to do other work when all the do-somethings are finished.  How would you write this loop so there are always X do-somethings running at once?
19463
Whenever I render a video using the blender video editor only one core is ever used at any time. I have an 8 core CPU(FX-9590) yet regardless of whether blender is set to auto detect or a fixed 8 threads only one core ever sits at 100% at any given time. The rest of the cores sit and really low usage as if blender is completely ignoring them. I'm running blender 2.77a on Linux. I'm using Theora as the codec with an ogg container and Vorbis audio. How do I get blender to use all my cores?
92790
In a conversation with the network administator, I mentioned that my machine was a dual-core.  He told me it was not.  I brought up the task manager, went to the perfomance tab, and showed him that there are two separate CPU usage graphs.  I have a quad-core machine at home and it has four graphs.  He told there were two graphs on this particular machine because of hyper-threading.  I used to have a hyper-thread pentium 4 processor back in the day, but I never fully understood what it meant.  So what is the difference between hyper threading and dual-core?  And how do you tell which one you have?
52228
According to  on MDN, Firefox 57 finally runs things in different processes.  So is Firefox 57 multithreaded?  In particular, how many cores does it use at most? Say I open 20 tabs at once on a quad-core machine, will Firefox 57 launch as many threads, or at least as many as needed to max out my CPU?  (Chromium for instance spawns a number of sub-processes and very easily uses all the resources available. Firefox up to 56 in GNU/Linux is rarely seen going over 135 % of one core however many tabs I open.)
22021
Apparently my CPU or GPU overheats when Blender renders more than a few minutes.  The computer suddenly powers down, taking down all running apps, email I'm writing, etc.  This is almost never a problem with still scenes, which finish soon enough, but often with animation renders.    The problem occurs with either Cycles or BI renders.  I'm running on a custom-built quad core 64-bit linux desktop system.  (I'm not the one who built it. I am  a knuckle-dragging caveman with hardware issues.) (Yes, all the fans are blowing and dust has been cleaned off.)  So far the only way to prevent this for now is to choose in camera properties: Performance, Threads, Fixed, 1.     Someday, I'll get better hardware, but in the meantime, I suspect Blender could run indefinitely, even with multiple threads, if I could make it pause for perhaps one minute between each frame when animating, just to cool down. How to make this happen?  At least, a way to run an arbitrary Python script between frames, or once per minute during any rendering. Such a script could contain a sleep stat  Even better, if Blender could throttle its rendering effort based on readings of the CPU temperature sensor.   Is that possible?  UPDATE: I've nearly forgotten about this issue, since writing a quick Python script to watch the CPU temperature, sending SIGSTOP and SIGCONT as gandalf3 describes. Zero crashes ever since. I reboot my machine once or twice per year for kernel upgrades, otherwise it's 100% up.  ANOTHER UPDATE: I took the machine apart, popped off the CPU heatsink, and applied fresh thermal paste.  Ever since, the CPU temperature has been running something like 30deg (C) cooler all the time.  Zero shutdowns, and I don't use the Python script any more unless I'm feeling paranoid.
39337
I have a script that I would like to run as a service on my Ubuntu Server 11.04 headless box. That is, I want to have the correct files under /etc/init.d/ and to be able to control it via the service command.  Is there any guide available that will show me how to do this?
36292
Our application is growing fast so now we need to scale the infrastructure to don't slow down the entire website independently on how many users we have  The backend system is based on many curl calls lasting 1-10 seconds and they need to be executed in parallel  We currently have a 4GB ram 4 core vps but sometime we get 503 error when all the 50 channels start in parallel (we setup 50 cron job) that execute 5 curl call/each  These numbers are going to increment fast so we need to find a solution to don't let the end user wait more than a minute to get his things done  Do we need a dedicated server, or it won't make much difference? Or set up aws lambda functions with sns queue? Amazon would be the best solution because whatever amount of sns messages we put in the queue and instantly they will get processed by enabling the trigger, but the lambda function currently don't support PHP so we would to rewrite all the code in Python  How would you manage this situation to improve the performance?
84622
I am running a web server at home using Ubuntu 11.4 (maybe? I can't 100% recall) on an older AMD 2400+ desktop with 1 or 2 GB of RAM. Sorry I can't recall the details 100%.  Anyway, I have a KVM hooked up to a monitor and PS2 keyboard that I use to switch between the server and my iMac (The keyboard is only hooked up so I can switch between the two easily. Many times a week, Pingdom will tell me the server is down and I can't hit the server. When I get home (it rarely happens when I am home), I hit the Ctrl key twice to switch to the server, hit the space bar and everything is now up and running again. I need to look again, but I don't believe there is any power saving features turned on in the BIOS.  Does anyone have any other suggestions of what I may have going on? I have my uncle's website running on it now and I really would like to have a better up-time than 95%  As a note, I do not have any GUI installed so everything has to be done on the console (or through WebMin) and I know my way around, but I am by no means experienced.
120792
I have a webserver that has 8GB of ram and is running a pretty intensive php site (1 site) that does file manipulation, graphing, emailing, forums, you name it.  The environment is far from static which leads me to believe that very little could be gained from caching anything in ram since almost every request to the server creates new or updated pages.  And a lot of caching is done client side so we have a ton of 304 requests when it comes to images, javascript, css.  Additionally I do have language files that are written to flat files on the server where cached ram definitely is good rather than reading from disk.  But there are only a handful of files like this.  In about a two weeks I've gone from having 98% free ram to 4% free ram.  This has occurred during a time in which we also push several large svn updates onto the server.  My question is whether my server will be better tuned if I periodically clear my cache (I'm aware of Linus Torvalds' feeling about cache) using the following command:  sync; echo 3 &gt; /proc/sys/vm/drop_caches   Or would I be better off editing the following file:  /proc/sys/vm/swappiness     If I replace the default value of 60 with 30 I should have much less swapping going on and a lot more reuse of stale cache.  It sure feels good to see all that cache freed up using the first command but I'd be lying to you if I told you this was good for the desktop environment.  But what about a web server like I've described above?  Thoughts?  EDIT: I'm aware that the system will acquire memory as it needs it from the cache memory but thanks for pointing that our for clarity.  Am I imagining things when Apache slows down when most of the server memory is stored in cache?  Is that a different issue altogether?
58542
Is there a Pythonic way to have only one instance of a program running?   The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this?    (Take into consideration that program is expected to fail sometimes, i.e. segfault - so things like "lock file" won't work)
68117
I want to deploy multiple versions of an app server on my local machine for development purposes (testing for compatibility, etc). I've got about 5 that I'll want to have installed at any given time, but really only need 1 or 2 of them on a day to day basis. I'd rather turn on/off the others on demand.  Originally I had problems deploying them all when I ran into memory issues, but setting -XX:MaxPermSize=256m took care of that. Now I've realized I don't need them all at once.  Is there a way to specify that certain applications should not auto-start?
76640
VirtualBox, and possibly other VM software, allows the user to specify the number of CPUs exposed to the VM. In my particular case, I have a dual core CPU, with Windows 7 64-bit running natively, and Ubuntu 9.04 64-bit as the VM.  The help file suggests not setting this above the number of physical cores available. This makes sense. So, is it best allocating 1 or 2 CPU cores? Does this depend entirely on the native CPU load?