Add files via upload

This commit is contained in:
Hatvani Tamás
2024-02-27 14:51:29 +01:00
committed by GitHub
parent 87707069d7
commit dd1165d56d
2 changed files with 38 additions and 0 deletions

30
MaxCpuRam/MaxCpu.cpp Normal file
View 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
View File

@@ -0,0 +1,8 @@
#include<bits/stdc++.h>
int main(){
while(true){
int* a = new int;
}
}