CPU usage program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sethukr@gmail.com

    #1

    CPU usage program

    Hi everybody,

    Can anyone give me a simple program which would consumes more CPU
    usage (more than 50%) in windows?

    Thanks,
    Sethu

  • santosh

    #2
    Re: CPU usage program

    sethukr@gmail.c om wrote:
    Hi everybody,
    >
    Can anyone give me a simple program which would consumes more CPU
    usage (more than 50%) in windows?
    int main(void)
    {
    volatile unsigned long i = 0;
    for (;;) i++;
    return 0;
    }

    Comment

    • Tor Rustad

      #3
      Re: CPU usage program

      sethukr@gmail.c om wrote:
      Hi everybody,
      >
      Can anyone give me a simple program which would consumes more CPU
      usage (more than 50%) in windows?

      The OS will try to stop such an application for consuming CPU cycles, so
      either you need to write a *rootkit*, or fool the OS billing system.


      Both methods, require *off-topic* code, which can be used by any
      *clueless* script kid, to attack computer systems.


      The <sethukr@gmail. comaccount, may already be tracked by US
      authorities, so I suggest you go under ground... before getting into
      trouble. :)


      --
      Tor <torust [at] online [dot] no>

      Comment

      • Keith Thompson

        #4
        Re: CPU usage program

        Tor Rustad <tor_rustad@hot mail.comwrites:
        sethukr@gmail.c om wrote:
        >Can anyone give me a simple program which would consumes more CPU
        >usage (more than 50%) in windows?
        >
        The OS will try to stop such an application for consuming CPU cycles,
        so either you need to write a *rootkit*, or fool the OS billing system.
        [...]

        <OT>
        Windows prevents any process from consuming more than 50% of the CPU?
        Really? How do I enable this?
        </OT>

        --
        Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
        San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
        "We must do something. This is something. Therefore, we must do this."
        -- Antony Jay and Jonathan Lynn, "Yes Minister"

        Comment

        • Richard Tobin

          #5
          Re: CPU usage program

          In article <1191856494.871 612.79090@22g20 00hsm.googlegro ups.com>,
          sethukr@gmail.c om <sethukr@gmail. comwrote:
          >Can anyone give me a simple program which would consumes more CPU
          >usage (more than 50%) in windows?
          Either have fewer than two CPUs (increasingly tricky these days), or
          write a multi-threaded program.

          -- Richard
          --
          "Considerat ion shall be given to the need for as many as 32 characters
          in some alphabets" - X3.4, 1963.

          Comment

          • Richard Heathfield

            #6
            Re: CPU usage program

            Keith Thompson said:

            <snip>
            Windows prevents any process from consuming more than 50% of the CPU?
            Yes. It achieves this by using 51% of the CPU itself.

            <g,d&r>

            --
            Richard Heathfield <http://www.cpax.org.uk >
            Email: -http://www. +rjh@
            Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
            "Usenet is a strange place" - dmr 29 July 1999

            Comment

            • Eric Sosman

              #7
              Re: CPU usage program

              Keith Thompson wrote On 10/08/07 16:33,:
              Tor Rustad <tor_rustad@hot mail.comwrites:
              >
              >>sethukr@gmail .com wrote:
              >>
              >>>Can anyone give me a simple program which would consumes more CPU
              >>>usage (more than 50%) in windows?
              >>
              >>The OS will try to stop such an application for consuming CPU cycles,
              >>so either you need to write a *rootkit*, or fool the OS billing system.
              >
              [...]
              >
              <OT>
              Windows prevents any process from consuming more than 50% of the CPU?
              Really? How do I enable this?
              </OT>
              <OT>

              Press the Windows "flag" key, press U, press U again.
              (YMMV on non-English installations.)

              </OT>

              --
              Eric.Sosman@sun .com

              Comment

              • Martien Verbruggen

                #8
                Re: CPU usage program

                On 8 Oct 2007 20:24:04 GMT,
                Richard Tobin <richard@cogsci .ed.ac.ukwrote:
                In article <1191856494.871 612.79090@22g20 00hsm.googlegro ups.com>,
                sethukr@gmail.c om <sethukr@gmail. comwrote:
                >
                >>Can anyone give me a simple program which would consumes more CPU
                >>usage (more than 50%) in windows?
                >
                Either have fewer than two CPUs (increasingly tricky these days), or
                write a multi-threaded program.
                Or run more than one copy of the same program.

                Martien
                --
                |
                Martien Verbruggen | Freudian slip: when you say one thing but
                | mean your mother.
                |

                Comment

                • Mark McIntyre

                  #9
                  Re: CPU usage program

                  On Mon, 08 Oct 2007 17:21:52 -0400, in comp.lang.c , Eric Sosman
                  <Eric.Sosman@su n.comwrote:
                  Press the Windows "flag" key, press U, press U again.
                  >(YMMV on non-English installations.)
                  Amusingly, Windows-U on my XP box invokes the Screen Magnifier and
                  attempts to read the menus to me...
                  --
                  Mark McIntyre

                  "Debugging is twice as hard as writing the code in the first place.
                  Therefore, if you write the code as cleverly as possible, you are,
                  by definition, not smart enough to debug it."
                  --Brian Kernighan

                  Comment

                  • Tor Rustad

                    #10
                    Re: CPU usage program

                    Keith Thompson wrote:
                    Tor Rustad <tor_rustad@hot mail.comwrites:
                    >sethukr@gmail.c om wrote:
                    >>Can anyone give me a simple program which would consumes more CPU
                    >>usage (more than 50%) in windows?
                    >The OS will try to stop such an application for consuming CPU cycles,
                    >so either you need to write a *rootkit*, or fool the OS billing system.
                    [...]
                    >
                    <OT>
                    Windows prevents any process from consuming more than 50% of the CPU?
                    Really? How do I enable this?
                    </OT>
                    Keith, very off-topic! *shocked*

                    Try: remove the buggy kernel mode code, and see SetPriorityClas s() and
                    SetThreadPriori ty() WIN32 API for ideas. :-P

                    For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
                    consume more than >50% CPU. BUT, those OS'es try to avoid this, by
                    scheduling time interrupts, which bill the running process/thread. When
                    it's quota is up, the kernel scheduler typically put the running user
                    mode process/thread to sleep. I'm not sure what the actual limit is on
                    Windows, but it's there.

                    See e.g. "Modern Operating Systems" 2.ed, p.796, Tanenbaum.

                    --
                    Tor <torust [at] online [dot] no>

                    Comment

                    • Richard Tobin

                      #11
                      Re: CPU usage program

                      In article <fPudnYplve23LZ faRVnzvQA@telen or.com>,
                      Tor Rustad <tor_rustad@hot mail.comwrote:
                      >For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
                      >consume more than >50% CPU. BUT, those OS'es try to avoid this
                      General purpose operating systems try to allocate time fairly between
                      processes. If there are no other processes wanting the CPU, there is
                      no reason for the OS to stop a process from using 100%.

                      Most systems have a mechanism to give a process a higher or lower
                      priority if requested ("nice" in traditional unix).

                      -- Richard
                      --
                      "Considerat ion shall be given to the need for as many as 32 characters
                      in some alphabets" - X3.4, 1963.

                      Comment

                      • Tor Rustad

                        #12
                        Re: CPU usage program

                        Richard Tobin wrote:
                        In article <fPudnYplve23LZ faRVnzvQA@telen or.com>,
                        Tor Rustad <tor_rustad@hot mail.comwrote:
                        >
                        >For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
                        >consume more than >50% CPU. BUT, those OS'es try to avoid this
                        >
                        General purpose operating systems try to allocate time fairly between
                        processes. If there are no other processes wanting the CPU, there is
                        no reason for the OS to stop a process from using 100%.

                        No process in user mode, will normally be able to gain 100%, except for
                        a *very* short time. Kernel will interrupt it, and do the scheduling and
                        it's internal work.

                        However, most likely OP was sitting with a dual core CPU... :)

                        --
                        Tor <torust [at] online [dot] no>

                        Comment

                        • Peter Pichler

                          #13
                          Re: CPU usage program [OT]

                          Mark McIntyre wrote:
                          On Mon, 08 Oct 2007 17:21:52 -0400, in comp.lang.c , Eric Sosman
                          <Eric.Sosman@su n.comwrote:
                          >
                          > Press the Windows "flag" key, press U, press U again.
                          >>(YMMV on non-English installations.)
                          >
                          Amusingly, Windows-U on my XP box invokes the Screen Magnifier and
                          attempts to read the menus to me...
                          Try doing it in sequence, as Eric Sosman suggested.

                          Comment

                          Working...