r******r 发帖数: 700 | 1 Who can try the shortest code that immediately consumes up all your CPU
power? |
l*****a 发帖数: 559 | 2 while true ?
【在 r******r 的大作中提到】 : Who can try the shortest code that immediately consumes up all your CPU : power?
|
c*****l 发帖数: 879 | 3 for(;;){
fork()
}
貌似大概这样 |
A*****i 发帖数: 3587 | |
r******r 发帖数: 700 | 5 yes. this little loop instantly eats up all your CPU.
while( true ){
}
Could something be even shorter?
【在 l*****a 的大作中提到】 : while true ?
|
c**y 发帖数: 2282 | 6 你那两行了:
BACK: goto BACK;
【在 r******r 的大作中提到】 : yes. this little loop instantly eats up all your CPU. : while( true ){ : : } : Could something be even shorter?
|
g**e 发帖数: 6127 | 7 this only occupies one core. need multithread
【在 r******r 的大作中提到】 : yes. this little loop instantly eats up all your CPU. : while( true ){ : : } : Could something be even shorter?
|
r******r 发帖数: 700 | 8 what compiler can directly execute this?
【在 c**y 的大作中提到】 : 你那两行了: : BACK: goto BACK;
|
c**y 发帖数: 2282 | 9 gcc 4.4.5测试无误
【在 r******r 的大作中提到】 : what compiler can directly execute this?
|
r******r 发帖数: 700 | 10 I tried on two cores, it still works.
The reason I brought about this is that today i had such a little bug.
【在 g**e 的大作中提到】 : this only occupies one core. need multithread
|
r*******e 发帖数: 7583 | 11 for(;;);
【在 c**y 的大作中提到】 : 你那两行了: : BACK: goto BACK;
|
g**e 发帖数: 6127 | 12 no it won't work.
【在 r******r 的大作中提到】 : I tried on two cores, it still works. : The reason I brought about this is that today i had such a little bug.
|
c**y 发帖数: 2282 | 13 这些都不会Crash的,fork那个靠普点,不过得include,就多一行了。
要不:
system("reboot");
【在 r*******e 的大作中提到】 : for(;;);
|
r*******e 发帖数: 7583 | 14 我没说会crash,只是相对goto来说能更短一点,哈哈
【在 c**y 的大作中提到】 : 这些都不会Crash的,fork那个靠普点,不过得include,就多一行了。 : 要不: : system("reboot");
|