Author |
Message |
1stStrike Cute like a kitty
Joined: Dec 28 2002 Posts: 427 Offline
|
Posted: Sun Apr 11, 2004 9:10 am Post maybe stupid Post subject: |
 |
|
|
|
Programming is one of the most boring, annoying and pain in the ass things out there. I get no joy whatsoever from it and hate every class I'm forced to go to. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Apr 11, 2004 10:17 am Post maybe stupid Post subject: |
 |
|
|
|
Awww 1st, you're no fun! _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
ExplodyThingy Server Help Squatter
Age:38 Gender: Joined: Dec 15 2002 Posts: 528 Location: Washington DC Offline
|
Posted: Sun Apr 11, 2004 1:04 pm Post maybe stupid Post subject: |
 |
|
|
|
while(first.patrypooper()) { ; } _________________ There are no stupid question, but there are many inquisitive idiots.
Loot
Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Apr 11, 2004 2:27 pm Post maybe stupid Post subject: |
 |
|
|
|
 |
|
Back to top |
|
 |
Dustpuppy Server Help Squatter

Age:40 Gender: Joined: Jan 23 2003 Posts: 215 Location: England Offline
|
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:38 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Thu Apr 15, 2004 1:50 pm Post maybe stupid Post subject: |
 |
|
|
|
Helicon wrote: | [..]
this just runs until the int ceiling value... it stops |
for ( ; ; )
 |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Thu Apr 15, 2004 3:18 pm Post maybe stupid Post subject: |
 |
|
|
|
^_^ ugg _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 15, 2004 4:26 pm Post maybe stupid Post subject: |
 |
|
|
|
Of course, most of the examples posted so far would use 100% CPU, so they do far from nothing.  _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Apr 15, 2004 4:48 pm Post maybe stupid Post subject: |
 |
|
|
|
But technicly, even code that is doing nothing is doing something. It's doing nothing, and nothing is something.
Everything is something, even nothing.
And if you think I have a lot of things (like nothing, everything, and something) in this post, you have another thing coming. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Thu Apr 15, 2004 6:01 pm Post maybe stupid Post subject: |
 |
|
|
|
Thing count: 13  |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Thu Apr 15, 2004 8:10 pm Post maybe stupid Post subject: |
 |
|
|
|
Dr Brain wrote: | But technicly, even code that is doing nothing is doing something. It's doing nothing, and nothing is something.
Everything is something, even nothing.
And if you think I have a lot of things (like nothing, everything, and something) in this post, you have another thing coming. |
Nothing can have no properties, cuz no porperty is a property and nothing is something! That's some weired stuff...
Anyways, back to topic...
@ekted:
Which codes of the ones posted does not use 100% of the cpu?
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... _________________ It's a shark! Oh my god! Unbelievable! |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 15, 2004 9:07 pm Post maybe stupid Post subject: |
 |
|
|
|
As far as the "doing nothing forever" topic, only mine uses 0% CPU:
WaitForSingleEvent();
as long as the event never triggers. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Thu Apr 15, 2004 10:17 pm Post maybe stupid Post subject: |
 |
|
|
|
It's impossible that a loop can use 0% CPU... it has to be doing something somewhere...
Err and interesting title, MGB  |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Fri Apr 16, 2004 12:33 am Post maybe stupid Post subject: |
 |
|
|
|
WaitForSingleEvent() is a Windows function that suspends your thread until the specified event occurs. It does not run. It does not execute any instructions. It does not take any CPU. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Fri Apr 16, 2004 8:14 am Post maybe stupid Post subject: |
 |
|
|
|
Wacky.  |
|
Back to top |
|
 |
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Mon Apr 19, 2004 4:40 am Post maybe stupid Post subject: |
 |
|
|
|
The purest infinite loop uses no looping constructs or explicit recursion, only the idea of self-application:
((lambda (x) (x x)) (lambda (x) (x x)))
And this one makes your head explode when you try to figure out how it works:
((call/cc (lambda (x) (x x))) (call/cc (lambda (x) (x x))))
Finally, if you're looking for something to make your CPU actually do nothing, as opposed to looping infinitely, the best method is to remove the power cord from the back of your box. It saves more energy than just putting your thread to sleep, too! |
|
Back to top |
|
 |
Maucaub Newbie
Joined: Apr 15 2004 Posts: 12 Offline
|
Posted: Sat Apr 24, 2004 12:52 am Post maybe stupid Post subject: |
 |
|
|
|
Grelminar wrote: | ((call/cc (lambda (x) (x x))) (call/cc (lambda (x) (x x))))
|
Ugh, that's just .... evil ....
And just to be anal for those who care about such things, a NOP truly does nothing while EB FE actually does alter the program counter. Instructions are pre-incremented by the hardware in the CPU, hence a NOP does nothing but wait for the next instruction while EB FE substracts 2 from the instruction pointer (that's what the FE part is for!). Of course, all of these details become blurred when considering modern superscalar pipelined architectures with dynamic scheduling and branch prediction, anyway ... |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Apr 24, 2004 1:10 am Post maybe stupid Post subject: |
 |
|
|
|
Well, the RESULT of a NOP is that the PC in incremented. The RESULT of EB FE is that the PC does not change. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sat Apr 24, 2004 10:15 am Post maybe stupid Post subject: |
 |
|
|
|
oh I just thought of how to do it on a TI-83
Lbl A
Goto A
or you could just do
While(1)
End _________________
 |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Apr 24, 2004 10:43 am Post maybe stupid Post subject: |
 |
|
|
|
If the PC does not change with EB FE how do you break out of it? Are you supposed to put stuff between the EB and FE? |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Sat Apr 24, 2004 1:38 pm Post maybe stupid Post subject: |
 |
|
|
|
What is a EB FE anyway? A Wait for Interupt? |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sat Apr 24, 2004 1:41 pm Post maybe stupid Post subject: |
 |
|
|
|
Why would
ever inc the PC?
There's no sense in it... I think...
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sat Apr 24, 2004 1:43 pm Post maybe stupid Post subject: |
 |
|
|
|
50% Packetloss wrote: | What is a EB FE anyway? A Wait for Interupt? |
Mr Ekted wrote: | It's Intel machine code for:
label: jmp label |
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Apr 24, 2004 3:29 pm Post maybe stupid Post subject: |
 |
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | Why would
ever inc the PC?
There's no sense in it... I think...
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
Well, internally what happens is once an instruction is loaded--in this case 2 bytes--the program counter (called EIP in Intel) is advanced 2 bytes. Then the instruction is executed. This instruction basically says EIP = EIP - 2. So the actual increment and decrement does occur in the micro-code.
To answer the other question: If you indeed had EB FE in your program and the CPU "found" it, your program would go 100% CPU and "lock up", requiring a kill. It is not a naturally occurring instruction, unless you wrote some C code like:
|
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sat Apr 24, 2004 4:30 pm Post maybe stupid Post subject: |
 |
|
|
|
Mr Ekted wrote: | [..]Well, internally what happens is once an instruction is loaded--in this case 2 bytes--the program counter (called EIP in Intel) is advanced 2 bytes. Then the instruction is executed. This instruction basically says EIP = EIP - 2. So the actual increment and decrement does occur in the micro-code. |
Yeah, acutally all that "jmp lbl" does is to decrement the eip to the point where the lbl is...
Which is, in this case, the same as it has been before jmp.
I'm going to write my A-level exam on monday, and a part of it will be assembler for 8085. Interupt aso...
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
 |
|