Thanks for correct some concepts here. On Thu, Aug 4, 2011 at 10:47 PM, Stan Hoeppner <s...@hardwarefreak.com> wrote: > On 8/4/2011 8:12 AM, lina wrote: >> Hi, >> >> I noticed when make -j 8, the 8 cores can be fully occupied. >> >> can I use some way to enable 8 cores at the same time when I run >> something, such as a bash script? > > This will fully answer your question, and then some: > http://tldp.org/HOWTO/Parallel-Processing-HOWTO.html > > Multiprocessing has been around for many decades as well as the methods > to program for it. Most regular users simply never heard of it because > only "business" machines had more than one processor. A dual, quad, 6, > 8, or 12 core CPU is simply a multiprocessor computer where all the > processing units fit on a single chip, instead of many chips as in > decades past. From a programming standpoint, there is little difference > from a 1980s multiprocessor UNIX machine and today's 8 core desktop. > The term "processor" is used by systems programmers, not "core". "Core" > is a marketing term of CPU companies. A "core" is a "processor". A > chip is NOT a processor unless it only has one core. Get used to this > terminology when discussing programming. The term "core" does not exist > in programming. It is a hardware description, not a software > description. To the kernel, a "core" is a processor. > > The short short answer: The Linux process scheduler will efficiently > place processes and threads on hundreds of CPU cores for execution. It > is up to the programmer, sometimes the sysadmin or user, to generate the > processes and threads, i.e. "the workload", necessary to occupy all > processors in a machine. If there is insufficient work to occupy all > the processors, they will simply sit idle. > > 1. Write an application or script that forks or spawns a number of > processes equal to or greater than the number of processors (CPU cores) > in the system. This is what 'make -j[x]' gives you when x is equal to > or greater than the number of CPU cores. Postfix spawns multiple smtpd > and smtp processes for inbound/outbound mail delivery, allowing > scalability across dozens of cores (although mail is rarely CPU bound). > The Apache web server forks dozens or hundreds of children allowing > multiprocessor scalability. These are but two examples of applications > that can take advantage of a multiprocessor system. Yes, a single CPU > with many cores is a "multiprocessor". > > 2. Write an application that uses POSIX or Linux threads, creating one > thread per CPU core in the machine. > > -- > Stan > > > -- > To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: http://lists.debian.org/4e3ab117.3020...@hardwarefreak.com > >
-- Best Regards, lina -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAG9cJmkqNo-REjznYZZkzmddkLDK9btLotLQM7=HXNi7=7j...@mail.gmail.com