|
18鱼币
小甲鱼写的使电脑发热的代码:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
pid_t pid[3];
int i;
for(i=0; i < 3; i++)
{
pid[i] = fork();
}
for(i=0; i < 3; i++)
{
if( !pid[i] )
while(1);
}
return 0;
}
#include <stdio.h>
#include <pthread.h>
void *get_heat(void *a)
{
while(1);
}
int main()
{
pthread_t threads[20];
int i;
void *result;
for(i=0; i < 20; i++)
{
pthread_create(&threads[i], NULL, get_heat, NULL);
}
for(i=0; i < 20; i++)
{
pthread_join(threads, &result);
}
return 0;
}
这是在Linux环境运行的,我只装了vs2013,请教一下除了装虚拟机建Linux,还有什么办法运行以上代码?
[/i][/i][/i] |
最佳答案
查看完整内容
有很多在win下支持GCC的编译器的,上网搜搜。
|