Add files via upload
This commit is contained in:
30
MaxCpuRam/MaxCpu.cpp
Normal file
30
MaxCpuRam/MaxCpu.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
void cpuKiller(){
|
||||
int* p;
|
||||
while(p == p){
|
||||
(*p++)+1;
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
unsigned int cores = std::thread::hardware_concurrency();
|
||||
std::cout << "cores: " << cores << std::endl;
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
//threads.reserve(cores);
|
||||
|
||||
for(int i = 0; i < cores; i++){
|
||||
std::thread t(cpuKiller);
|
||||
threads.push_back(move(t));
|
||||
}
|
||||
|
||||
std::cout << threads.size() << std::endl;
|
||||
|
||||
for(int i = 0; i < cores; i++){
|
||||
threads[i].join();
|
||||
}
|
||||
|
||||
}
|
||||
8
MaxCpuRam/MaxRam.cpp
Normal file
8
MaxCpuRam/MaxRam.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
int main(){
|
||||
while(true){
|
||||
int* a = new int;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user